Today I will illustrate how to setup Event Hub for Infor Process Automation (IPA). The goal is to receive M3 events in IPA in order to trigger approval flows, for example to trigger a User approval flow when a new User is created in M3, or to trigger a Purchase Order flow when a new Purchase Order is created in M3. This technique has been around for several years and replaces pretty much all the previous techniques to trigger flows.
This post is intended for readers already familiar with IPA, yet not too familiar with Event Hub.
About Event Hub
Event Hub is a publish-subscribe distributed messaging system for M3. It seems to use JBoss HornetQ, the “open source project to build a multi-protocol, embeddable, very high performance, clustered, asynchronous messaging system”, it seems to use JGroups, “a toolkit for reliable messaging [that] can be used to create clusters whose nodes can send messages to each other”, it seems to use Netty, “an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients”, and it seems to use Disruptor, a “High Performance Inter-Thread Messaging Library”, based on unzipping the Grid Archive file Infor\LifeCycle Manager\LCM-Server\products\eventhub-installer\components\eventhub-gar-2.0.16.gar.
M3 produces millions of events as part of its daily operation. For example: users open programs, they create new records and update existing ones, the database gets updated, etc. M3 is the Producer of events. The Documents can be M3 Programs (such as M3 Customer – CRS610) and M3 Tables (such as OCUSMA). The Operations on M3 Programs can be: Start, eXit, Fail, reQuest, and Response. The Operations on M3 Tables can be Create, Update, and Delete. When an event happens in M3, M3 sends that event to Event Hub. Then Event Hub distributes that event to any subscriber that is interested in that event, for example to M3 Enterprise-Collaborator (MeC) whom will exchange BODs and initiate EDI transactions, to Infor Enterprise Search (IES) whom will update the search engine’s indexes, to Infor Process Automation (IPA) whom will trigger flows, to Infor Customer Lifecycle Management (CLM) whom will synchronize M3 and CLM customer records, etc.
I like Event Hub because it’s a beautiful piece of engineering, and it’s based on modern, well documented, open source software.
The Infor LifeCycle Manager (LCM) InfoCenter has detailed documentation about Event Hub: overview, events, documents, operations, subscriptions, administration, etc. For that, go to your LCM InfoCenter at http://lcmserver:4062/ and then navigate to Documentation > Infor Smart Office Infocenter > Installation Guides > Infor ION Grid Extensions Installation and Administration Guide > Event Hub and Event Analytics Grid Extensions:
The HelloWorld scenario
The simple Hello World scenario I will illustrate in this post is the following: when the user closes M3 Program EUS001 I will trigger a HelloWorld flow. It’s as simple as that. Why not. It doesn’t have any value from a functional point of view, but it’s a great illustration from a technical point of view. Here are the baby steps:
First, I will go to the Event Hub Configuration in my Grid and determine what the host and port number are to subscribe to Event Hub.
Then, I will enter the host and port number in IPA Rich Client Admin to setup IPA as a subscriber of Event Hub. (Conversely, IPA can also be a publisher and publish events to Event Hub but I won’t cover that scenario here.)
Then, I will create a HelloWorld flow, and I will setup a subscription M3:EUS001:X that will trigger the flow. The flow will be a simple Start -> End flow with no intermediate activity nodes. No need for fluff.
Finally, I will do a complete test, I will: start Infor Smart Office, open and close EUS001, and analyze the resulting WorkUnit in IPA.
Event Hub Configuration
Let’s go to the Event Hub Configuration in the Grid and determine what the host and port number are to subscribe to Event Hub:
- Open Infor LifeCycle Manager (LCM)
- Expand the Grid (for example, Development, Test, Production)
- Expand the Products until you find EventHub (you can expand the tree, or use the filter)
- Right-click > Configure Application
- In the Bindings section, write down the Host:
- Select Edit Properties
- Expand Server
- Write down the Port number:
Setup IPA as a subscriber of Event Hub
Then, let’s enter the host and port number in IPA Rich Client Admin to setup IPA as a subscriber of Event Hub:
- Start the IPA Rich Client Admin
- Switch the data area (for example, dev, test, prod, etc.)
- Start Channels Administrator (either search for channel, either go to Start > Applications > Process Server Administrator > Administration)
- Create an Event Hub Channel (Actions > Create):
- Enter a Name, for example EventHub
- Enter a Description, for example EventHub
- Check the box External
- Enter the Host
- Enter the Port Number:
- Click Save, the status bar will say “Channel Created”
- Select Actions > Activate, the status bar will say “Activate Completed”
Create a flow, the subscription, and the trigger
Then, let’s create a HelloWorld flow and setup a subscription M3:EUS001:X that will trigger the flow.
- Create a new HelloWorld flow in Infor Process Designer (IPD), a simple Start -> End flow with no intermediate activity nodes will suffice (you can add other nodes if you want), and deploy it on the server with Process > Upload process:
- Back in the Event Hub Channel in IPA Rich Client Admin, switch to the tab Event Hub Channel Receivers and create a new Receiver:
- Enter a Receiver and Description, for example HelloWorld.
- Enter Subscription M3:EUS001:X.
- Select Process HelloWorld (the flow).
- Select Startup type Automatic.
- Click Save, the status bar will say “Pfi Receiver Created”:
- Select Actions > Activate, the status bar will “Activate Completed”.
- Close the Event Hub Receiver window.
- Close the Event Hub Channel Receivers window.
- You will be back in the Channels Administrator window. Make sure the Event Hub Channel EventHub is Active and the Event Hub Receiver HelloWorld is Active.
- You can close the Channels Administrator window.
Finally, let’s do a complete test: start Infor Smart Office, open and close EUS001, and analyze the resulting WorkUnit in IPA.
- Go to Infor Smart Office.
- Open EUS001 (mforms://eus001), and close it (F3):
- That will cause the event M3:EUS001:X to happen in M3, Event Hub will forward the event to IPA, and IPA will trigger the HelloWorld flow.
- Back in IPA Rich Client Admin, open the Work Units (Start > Applications > Process Server Administrator > Administration > Work Units)
- Find the latest WorkUnit for the HelloWorld Process:
- Open it, and switch to the WorkUnit Variables, it will show all the keys/values for the event:
That’s it! We setup IPA as a subscriber of Event Hub, we created a receiver to subscribe to a specific event and trigger our flow, we did a test and caused the event to happen, and we analyzed the resulting WorkUnit. That illustrates how to setup Event Hub for IPA to receive M3 events in order to trigger a flow.
Next time I will show you how to setup Event Analytics for IPA and how to setup Drools Rules to filter events with conditions.
If you liked this, please subscribe to this blog by clicking the Follow button, and let us know your comments in the section below. You can also become an author and share your ideas (let me know and I’ll send you an author invite).