MEC Part 9 – MEC and Event Hub

In the previous post we discussed about how to use printing of a M3 document to trigger a MEC process using MBM initiator. In this post we will look at how to use M3 Event Hub to trigger a MEC process based on an event occurred in M3.

If you are familiar with the Publisher-Subscriber Design Pattern, M3 Event Hub acts as an event publisher, which broadcasts  defined events when they occur. Any channel subscribed to M3 Event Hub can receive these events. MEC provides a option of subscribing its receiving channels to Event Hub, so that it can receive events published by the Event Hub and trigger MEC processes based on these events.

Let’s say we want to trigger a MEC process, whenever a new Customer Order Line is added to a customer order.

1. First of all a receiving channel should be defined in the Partner Admin Tool to receive events from M3 Event Hub. For that go to Partner Admin → Manage → Communication → Receive Tab and create a new Receiving channel. Give a desired name and set the protocol to EventHub Subscriber. You can leave the other parameters as they are.

01

2. Now we have to subscribe to an event in M3 so that Event Hub generates a trigger when that particular event occurs. This can be directly done through Partner Admin Tool. For that, go to Partner Admin → Manage → EventHub Subscriptions → New.

02

3. Give a name and a description to the subscription. In this case we are trying to capture the event of adding a customer order line. So I have named it as Customer Order Line Create Event.

4. Then we have to define the subscription rule in the below pattern.

03

5. According to above pattern, our subscription rule would be M3:OOLINE:C: :P2. Once the subscription rule is entered click OK.

04

6. Now this newly created subscription should be assigned to a receiving channel. For that, select the created subscription from EventHub Subscriptions list and click Edit. In the displayed dialog tick the correct receiving channel.

05

7. For this subscription to take effect MEC and Event Hub components should be restarted. Once these components are up, go to Event Hub Management Pages.

8. Newly created MEC receiving channel MEC-M3-EventHub should now be in the subscribers list and there should be one subscription in this subscriber.

08

9. If you go in to the subscriptions, you will see the subscription we defined in the Partner Admin.

07

10. Now whenever a customer order line is added (a record is created in OOLINE table), Event Hub will generate an event and it will flow in to MEC since MEC is subscribed to this event.

Create a new Partner Agreement and use AnalyticsHubValue XML detection (or create a new XML detection) in the Partner Admin Tool to detect the received event and trigger a MEC process.

09

Have a Nice Day…

One thought on “MEC Part 9 – MEC and Event Hub

  1. Very useful information. Thanks for sharing this. Is there a email address I can contact you ? I have question I need to check with you.

    Like

Leave a comment