WebSphere WebSphere Enterprise Service Bus, Version 6.0.1 Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Retrieving data from a received event

An event source uses methods of the CommonBaseEvent to retrieve event property data.

Why and when to perform this task

When an event source receives an event, it can then use the getter methods of CommonBaseEvent to retrieve the event property data. For example, the following code fragment retrieves a single event and then reads the content of the msg property.

CommonBaseEvent event = eventAccess.queryEventByGlobalInstanceId(eventId);
String eventMessage = event.getMsg();

If the property you want to retrieve is a complex property (a subelement of CommonBaseEvent in the Common Base Event specification), the returned value is an instance of the specialized class representing the complex data type. You can then use the getter methods of the returned object to retrieve the property data from that object. For example, the following code fragment retrieves the value of componentId, which is a complex property; it then retrieves the content of the nested component property, which is a string, to read the name of the source component.

CommonBaseEvent event = eventAccess.queryEventByGlobalInstanceId(eventId);
ComponentIdentification componentId = event.getSourceComponentId();
String componentName = componentId.getComponent();

Task topic

Terms of Use | Rate this page

Timestamp iconLast updated: 13 Dec 2005
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.websphere.wesb.doc\doc\tcei_admin_retrieveEventData.html

(C) Copyright IBM Corporation 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)