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

Querying the existence of events in an event group

You can determine the existence of events without retrieving them.

Why and when to perform this task

In some situations, you might want to find out whether any events exist in a particular event group without actually retrieving the events. To do this, use the eventExists() method of the event access bean.

Steps for this task

  1. If you need to create an event access bean, see Creating an event access bean
  2. Call the eventExists(String, String) method of the EventAccess bean.
    boolean hasEvents = eventAccess.eventExists(eventGroup,
                                                eventSelector);

    The parameters of this method are as follows:

    eventGroup
    A string containing the name of the event group you want to check for events. This must be the name of an existing event group defined in the event infrastructure configuration.
    eventSelector
    A string containing an optional event selector that further refines the query. The query only checks for events that match both the specified event group and the additional event selector. An event selector is specified in the form of an XPath expression (for more information, see Writing event selectors). If you do not want to specify an additional event selector, this parameter can be null.

Result

The returned boolean object equals true if any events exist that match the specified event group and event selector, false if none exist.

Example

The following code fragment checks for the existence of any events in an event group called critical_hosts and retrieves any that exist.
if (eventAccess.eventExists("critical_hosts",null)) {
   CommonBaseEvent[] events = 
     eventAccess.queryByEventGroup("critical_hosts",
                                   null,
                                   true);
   }

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_adminCBEB_queryEventExists.html

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