How to emit a Common Base Event in Java

A quick tip on how to emit a CBE. I usually put this block of code into a utility java project and add it to my module’s dependency editor so I can emit events in my modules.

  ECSEmitter emitter = new ECSEmitter("com/ibm/events/configuration/emitter/Default", null);

// create common base event

eventCommonBaseEvent cbe = emitter.createCommonBaseEvent(null);

// Work your CBE setting magic then


// emit the CBE.


// make sure to close the emitter when done to be safe.

The workhorse is the ECSEmitter. The Default JNDI for the default emitter is as above. It’s highly unlikely that your admin changed this.

Business Integration Server has extended CEI by adding an Event Correlation Sphere (ECS) facade to it, which provides access to CEI through an ECSEmitter class. Compared to CEI APIs, the advantage of using ECSEmitter is that it preserves the event context. ECSEmitter automatically adds two context elements — the current and parent context — to the events that are sent using this emitter.

For some reason, most of the docs about ECSEmitter are from the v5.1 product days but the information contained is perfectly relevant today. The context information it is referring to is meta-info about which component/module/operation emitted the event. This can be very useful for tracing purposes if you use CEI in that manner.

Author: dan

Leave a Reply

Your email address will not be published. Required fields are marked *