For the list of all supported Decision Insight downloads and releases, see the Downloads page.

Import the Payment Received events

1. About closing events

The Payments Received events is a bit different from the other ones because it's also a closing event. A closing event indicates when an instance of an entity is complete. Here, when the payment for an Order is received, the order is considered to be complete. 

When you create a mapping for the Payment Received event, you want for an event to:

  1. Have its attributes updated.
  2. And then, have the order instance be unbound. 

Otherwise, if the instance is unbound first, you will not be able to see any updates about the order instance in the application. 

Timeline of an order instance in the application

Here are three timelines of existence for a purchase order:

Timelines of an order instance Description

normal timeline of existence for a Purchase Order

Here an order instance is created.During the lifespan of the instance, new events update the attributes of the order.

You can view these changes using the time machine controls when you navigate after the timestamp of an update.

 unbind an active instance

Here an active instance is unbound. The event that updates the attributes takes place at the exact same time as the order instance is unbound. The unbind instance removes the order instance from the active instances, so no further updates to the order instance can be made.

Because both events take place the same time, the unbind operation cancels out the attribute updates. This means, when you navigate the time machine, you won't be able to see any updates on that order.

Here, we've added an unbind delay. This delay enables you to manitain all updates to the order instance as well as the unbind operation itself.

Create an unbind delay

How much of a delay is needed? Any non-zero interval. A single microsecond is fine.

To create an unbind delay:

  • Use the timestamp in your data as the update time.
  • Create a second timestamp as the unbind time. 

Introducing Camel utilities

There are several useful utilities that you can add to your route. For more information, see How to use Camel utilities in Routes.

To create a second timestamp in your route, use the <u:date-add> utility.

This utility enables you to add (or subtract) time – in everything from milliseconds to years – to create a new time attribute. Put that to use in the next steps.

Think ahead: How much of an unbind delay do you want to add?

The idea here is to have the unbind operation at a time later than the Payment Received event. What do you think would be a good time interval between the payment event and the unbind?

In most cases, you only need the minimum delay, 1 millisecond. Not this time.

Because this is a learning exercise and not a customer-facing application, use 5 minutes for the unbind delay. Five minutes is the rhythm between data points displayed on a dashboard. That means you will be able to see the "active" instance on a dashboard before it is unbound and becomes completed.

2. Update the mapping for Payment Received

Use the previous Payment mapping as a basis for adding new information and unbinding the instance of Order. The mapping for Payments Received requires the following:

  • Add the invoice Number parameter.

  • Add the credit Card Number parameter.

  • Specify the relation to Step.

  • Add a separate timestamp for the unbind operation




On the left menu, click Mappings.

2 Select the mapPaymentReceived mapping. Create a backup copy of this mapping and call it xmapPaymentReceived. Then edit the real Payment mapping.
3 Edit the mapPaymentReceived mapping.

Add parameters for Step, invoice Number, and cC Number.


Add a new Instant parameter with the name FiveMinutesLater.


In the operations section, look at the Unbind operation. For that operation, click the checkbox for "Override operation begin time" and select FiveMinutesLater as the parameter. This tells the mapping to use this as the time to perform the Unbind operation. It does not affect the timing of any of the other aspects of this mapping. You will set the value for the FiveMinutesLater parameter when you edit the route for Payment.


Add new operations to change the values of an attribute for Step, cC Number, and invoice Number.


Click Save.


Copy the routing context for your new parameters.

Introduction: Headers

Until this point, when working within a route, you have only used "body" elements. In this next step, you will use a "header" – another logical construct of Camel. For now, you don't need to have a deep understanding of the difference between the two. You will create and use a header to carry information into the portion of your Route.

3. Update the rouOrder route to handle payment received events

The following is a quick recap of the updates to mae to the rouOrder route: 

  • Add the invoice Number attribute. 

  • Add the credit Card Number attribute.

  • Define the FiveMinutesLater timestamp for the unbind operation.

  • Add a new section to manage payment received events .

Add the new attributes to the route




On the left menu, click Routes, then select the rouOrder route.


Place your cursor after the u:map entry for Step.

3 Paste the snippet from the mapPayment mapping. The pasted contents should contain the u:map entry statements for invoice number, cc number, and FiveMinutesLater.

Add the simple expressions to pass invoice Number (offset 8) and cc Number (offset 9) to the mapping.


Note: There is a comment on the line where you should add the expression for FiveMinutesLater . Leave the comment as is for now. You need to define that timestamp first.

Define the FiveMinutesLater statement in a header

The following shows how to set a header for your route to define the value of the FiveMinutesLater timestamp.

Step Action

Position your cursor on the line under:

	<simple> ${body}</simple>

Hit Enter to create a blank line.


On that blank line, start the definition of a header for your route. The setHeader statement declares that you want to create and name a new header:

<setHeader headerName="FiveMinutesLater">

A closing tag is automatically added.

3 Hit Enter again to create a blank line.

Now define the shift you want to make to the timestamp. In this case, you want 5 minutes:

<u:date-add scalar="5" type="minutes">

A closing tag is automatically added.

5 Hit Enter again to create a blank line.

What your route expects next is for you to define what time/date value you expect to bump with the time scalar. That tag is:



Note that this time, the closing tag is not added. It is a good practice to enter the closing tag now.


Between the beginning and closing statements for u:date, use a simple expression to pick up the timestamp from the data. This expression is the same as the one you use to set the u:map-entry for timestamp:



Those statements create a header called FiveMinutesLater and set the value of that header to be 5 minutes later than the timestamp of a received event.

If the section of your route looks like below, then proceed:

            <simple> ${body}</simple>
            <setHeader headerName="FiveMinutesLater">
                <u:date-add scalar="5" type="minutes">

Pass the information from that header to your mapping.

When you pasted the route context from the mapping, you did not replace the comment for FiveMinutesLater. Do that now. Select the comment line and replace it with this statement to reference the value from the header:


Manage payment received events

Step Action

Add a new section to send information to the Payment route when the Step name is Payment Received. This section can follow directly behind the second and before the statements. There is an example of these statements in the figure below. Note the changes to the log messages.

  <u:map-entry key="FiveMinutesLater">
                    <simple>${body[step]} == "New Order"</simple>
                    <log message="Sent to new mapping ${body}"/>
                    <to uri="tnd-absorption:mapNewOrder"/>
                    <simple>${body[step]} == "Order Valid"</simple>
                    <log message="Sent to valid mapping ${body}"/>
                    <to uri="tnd-absorption:mapValidOrder"/>
                    <simple>${body[step]} == "Payment Received"</simple>
                    <log message="Sent to received mapping ${body}"/>
                    <to uri="tnd-absorption:mapPaymentReceived"/>
                    <log message="Skipping ${body[step]}"/>

Be cautious, comment out the <to uri> statement for the payment received event and check the logs before running the route for real.

3 Click Save.
4 Run the route.

Check your logs. When you click on one of the log messages, you should see something like this in the detail lines below it:


You can see that the time for FiveMinutesLater is fine minutes later than the original timestamp. Depending upon the time zone on your system, it is likely that the hour (and possibly the date) of the two timestamps are different. ADI will manage that for you. The difference in hours is not important.

6 If the logs are correct, go back to the route, uncomment the statements, then save the route and re-process the data.

View the results on the dashboard

Navigate to the Search for Orders and see how orders have changed.

Make sure your time is set to June 1 at 11:45, you should see:

  • Two completed orders
  • Seven orders in the Order Valid step
  • One order in Payment Received – and that payment should look like the image below:

If that is what you see, you have successfully managed payment received events. 

Related Links