Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
Business Activity Monitor (BAM) Example
The BAM (Business Activity Monitor) example shows how to monitor your transaction flows using Camel.
In this example we will use Camel to monitor a business process consisting of
Then we will check to see that for every purchase order created by system A, that system B will generate an invoice within the specified amount of time (2 seconds in this example). If an invoice is not generated within the allowed amount of time and error is generated and sent to an Endpoint.
This example lives in the examples/camel-example-bam directory. It will poll the following directories
There is also a spring configuration file in src/resources/META-INF/services/camel-context.xml which defines the JPA
So lets start with the activities definition in MyActivities
Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
The first two lines of code sets up the inputs for the BAM activities via the activity() method which defines
Then the final line of code defines the temporal rules to use; namely that it is considered to be an error if an invoice is not received within 2 seconds of a purchase order being received. When a failure occurs in this example we just send it to the Log component to log out an error level message to commons-logging / log4j. You could change this to use some of the other Components such as ActiveMQ, JMS, IRC, Mail, XMPP etc.
Running the example
To run the example we use the Camel Maven Plugin. For example from the source or binary distribution the following should work
If you prefer you can just run the Main directly using
Failing that you can run the Main from inside your IDE if you prefer. Follow the Building instructions to create an Eclipse/IDEA project to import