WebSphere WebSphere Enterprise Service Bus V6.0.1 操作系统: AIX, HP-UX, Linux, Solaris, Windows

从已接收事件中检索数据

事件源使用 CommonBaseEvent 的方法来检索事件属性数据。

执行此任务的目的和时间

当事件源接收到事件时,它可以使用 CommonBaseEvent 的 getter 方法来检索事件属性数据。例如,以下代码段检索单个事件并读取 msg 属性的内容。

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

如果要检索的属性是复杂属性(公共基本事件规范中的 CommonBaseEvent 的子元素),则返回值是表示复杂数据类型的专用类的实例。随后,您可以使用返回对象的 getter 方法从该对象检索属性数据。例如,以下代码段检索 componentId 的值(它是复杂属性);然后它会检索嵌套 component 属性的内容(它是字符串)以读取源组件的名称。

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

任务主题

使用条款 | 评价此页

Timestamp icon上次更新时间: 3 Mar 2006
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.websphere.wesb.doc.nl1_6.0.1\doc\tcei_admin_retrieveEventData.html

(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.
本信息中心基于 Eclipse 技术。(http://www.eclipse.org)