CICS events - How do you consume a CBE message?
SteveWebb 0600009FE5 Visits (3322)
I've been working with CICS for quite a while and I thought I would share a few tips regarding CICS event processing. I want to talk about the common base event (CBE) format for this post because it is a bit different from the other formats. The CBE format has an additional layer that wasn't obvious when I started working with it. Hopefully this will save you some time.
CICS events offer a new way to capture business data without making modifications to existing CICS programs. CICS can capture and emit events based on an event binding that you create and deploy with the CICS Explorer event binding editor.
Event formats and EP Adapters
Who will consume the events?
When CICS emits an event, it builds the event data (sometimes referred to as the event payload) and "wraps" this in the format type that you selected with the CICS Explorer event binding editor. The event payload, or business data, will be similar for each format, but the "wrapping" of the message will vary depending on the format you choose. For example, if you use the WBE format, CICS will build the payload and then "wrap" it in a WBE format that can be interpreted and processed by an ESB or event consumer using the WBE schema.
CBE is common with a twist
The event data is nothing new, it is the actual business data or payload captured for the CICS event. This is referred to as the dynamic part of the CBE event since the event data can change for each event captured, and the event data will vary for different event capture specifications. The schema for the event data can be exported from the Adapter tab in the CICS event binding editor.
The CICS CBE static portion does not change; it remains the same for all events emitted by CICS. The static portion is unique to CICS and the schema is supplied and installed with CICS in location /usr
The CBE 1.0.1 part represents the outermost section of the CBE event. For details on the CBE 1.0.1 specification and the actual schema, see Common Base Event and Common Base Event XML schema on developerWorks.
Here's how it all fits together. CBE 1.0.1 contains an xs:any slot in the CBE schema that holds the "event data". To avoid confusion for our discussion, let's call this "event data" the "CBE 1.0.1 event data". CICS combines the event data (CICS dynamic part containing the business data) and the CICS CBE static part to form the "CBE 1.0.1 event data" for the xs:any slot described in the CBE schema. An example of the combined CICS event data and CICS CBE static portion
is shown below in Figure 1. I've outlined the event data part, labeled "cic
An enterprise service bus (ESB) or event consumer will need to understand all three components of the message in order to process it and get at the actual payload portion. Usually this involves importing the schema definitions for each portion into the ESB or event consumer so that it can properly interpret and process the message.
Similar processing is required for the other format types, but I thought it was worth mentioning the CBE format in particular since it might not be obvious how to interpret the CBE format and where to find the schemas, especially CBE 1.0.1.