blob: e6ef9e07b7a4cfe16991218fcb7c797c5846466e [file] [log] [blame]
Business Activity Monitoring
The *Camel BAM* module provides a Business Activity Monitoring (BAM)
framework for testing business processes across multiple message
exchanges on different link:endpoint.html[Endpoint] instances.
Consider, for example, a simple system in which you submit Purchase
Orders into system A and then receive Invoices from system B. You might
want to test that, for a given Purchase Order, you receive a matching
Invoice from system B within a specific time period.
How Camel BAM Works
Camel BAM uses a link:correlation-identifier.html[Correlation
Identifier] on an input message to determine the _Process Instance_ to
which it belongs. The process instance is an entity bean which can
maintain state for each _Activity_ (where an activity typically maps to
a single endpoint - such as the submission of Purchase Orders or the
receipt of Invoices).
You can then add rules to be triggered when a message is received on any
activity - such as to set time expectations or perform real time
reconciliation of values across activities.
Simple Example
The following example shows how to perform some time based rules on a
simple business process of 2 activities - A and B - which correspond
with Purchase Orders and Invoices in the example above. If you would
like to experiment with this scenario, you may edit this[Test
Case], which defines the activities and rules, and then tests that they
return new ProcessBuilder(entityManagerFactory, transactionTemplate) {
public void configure() throws Exception {
// let's define some activities, correlating on an XPath on the message bodies
ActivityBuilder a = activity("seda:a").name("a")
ActivityBuilder b = activity("seda:b").name("b")
// now let's add some rules
As you can see in the above example, we first define two activities, and
then rules to specify when we expect them to complete for a process
instance and when an error condition should be raised.p. The
ProcessBuilder is a link:routebuilder.html[RouteBuilder] and can be
added to any link:camelcontext.html[CamelContext].
Complete Example
For a complete example please see the link:examples/bam-example.html[BAM
Example], which is part of the standard Camel
Use Cases
In the world of finance, a common requirement is tracking trades. Often
a trader will submit a Front Office Trade which then flows through the
Middle Office and Back Office through various systems to settle the
trade so that money is exchanged. You may wish to test that the front
and back office trades match up within a certain time period; if they
don't match or a back office trade does not arrive within a required
amount of time, you might signal an alarm.