Message Image  

App Connect

IBM App Connect introduces a new way to detect situations in your applications 

Wed July 01, 2020 09:23 AM

A ‘Situation detector’ node has been added to the toolbox palette of the IBM App Connect flow editor allowing you to create flows that can detect complex situations in your data. The role of the Situation detector node is to collect events and detect situations based on the number of events received, when they are received, and the correlation between them.

As an example the Situation detector node can detect situations such as:

“There are at least 4 new opportunities in Salesforce from the same account in the last 90 days”

In the example below I show how to detect and react to this situation with the Situation detector node. We also leverage the recent ‘Notification’ node introduced in this post.

We start by creating an event-driven flow using the Salesforce application’s ‘New Opportunity’ event. This event is followed by a Salesforce ‘Retrieve Account’ action so that we get the name of accounts for opportunities. We then add the Situation detector which can be found within the toolbox palette. This gives us the following flow:

As you can see when you add the Situation detector a parallel branch of the flow is created to store the event in the Situation detector node. You can still continue your flow in the main branch if needed.

Let’s now specify the conditions for the detection of the situation. To do that, we specify within the editor the number of events required, the time period, and the correlation expression.

Here, I am asking the Situation detector node to detect when 4 opportunities are created with the same Account ID in 90 days.

Now lets add a Notification node within the sub flow of the Situation detector to get notified when this situation is detected. In this example I just want to be notified with a push notification on my desktop.

Within the notification title I can provide the account name. Note that when you receive the situation the payload of the flow contains all the events that are constituting the situation. The payload is then an array, that’s why the expression for the account name looks like:

See how in this expression I take the first element (index 0) in the array of events to retrieve its account name.

With IBM App Connect expressions, you can go even further and do more complex operations on the events in the context. For example, we can compute the total amount of opportunities easily using the aggregation expressions on the array.

Total amount of opportunities {{$sum($Situationdetector.Trigger.Amount)}}

As soon as 4 opportunities have been detected I receive a push notification in my notification feed:

We can extend this example by completing the flow with an ‘If’ node that would help us filter by opportunity. For example, if we are only interested in being notified about large opportunities.

I hope you will enjoy the combination of Situation detector and Notification nodes for creating more powerful flows.



0 Favorited
0 Files