In working recently with a large Oracle customer on SOA and BAM, I discovered that some BAM best practices are not quite as well known as I had always assumed! The BAM docs are always being improved and updated but here is some information that may be useful when designing BAM applications.
When using EMS (Enterprise Message Source) as a BAM feed, the best practice is to use one EMS to write to one Data Object. There is a possibility of collisions and duplicates when multiple EMS's write to the same row of a DO at the same time. A recent customer I worked with had 17 EMS's writing to one DO at the same time. Every sensor in their BPEL process writes to one topic but the Topic was read by 1 EMS corresponding to one sensor. They then used XSL within BAM to transform the payload into the BAM DO format. And hence for a given BPEL instance, 17 sensors fired, populated 1 JMS topic, this was consumed by 17 EMS which in turn wrote to 1 DataObject. You can imagine what would happen for later versions of the application that needed to send more information to BAM !
We suggested they modify their design to use one Master XSL based on sensorname for all sensors relating to a DO- say Data Object 'Orders' and were able to thus reduce the 17 EMS to 1 with a master XSL.
For those of you wondering about how squeaky clean this design is, you are right ! This is indeed not squeaky clean and that brings us to yet another 'inferred' best practice.
Transformations and Calculations
It is optimal to do transformations within an engine like BPEL. Not only does this provide modelling ease with a nice GUI XSL mapper in JDeveloper, the XSL engine in BPEL is quite efficient at runtime as well. Doing your XSL transformations in BAM, especially larger/more complex transformations, is not considered a best practice.
The same is true for any non-trivial calculations as well. It is best to do all transformations, calcuations, and data cleansing in BPEL, or like layer, and then send this to BAM (via JMS, WS etc.) This delegates the function of report rendering and the mechanics of real-time reporting to the Oracle BAM reporting tool which it is best suited for.
All nulls are not created equal Here is yet another possibly known fact but reiterated here. For an EMS with an Upsert operation:
a) If Empty tags or tags with no value are sent like <Tag1/> or <Tag1></Tag1>, the DO will be overwritten with --null-- b) If Empty tags are suppressed ie not generated at all, the corresponding DO field will NOT be overwritten. The field will have whatever value existed previously.
For an EMS with an Insert operation, both tags with an empty value and no tags result in –null-- being written to the DO.
I hope you have found this information useful.