com.bea.wlai.event
Interface IEventRouter

All Known Implementing Classes:
LocalEventRouter

public interface IEventRouter

Defines objects that are used to route events generated by instances of IEventGenerator into the WLAI environment.


Nested Class Summary
static interface IEventRouter.IRoutingInfo
          Marker interface for a routing information instance.
 
Method Summary
 void eisAvailable(String description)
          Allows the EventGenerator to indicate that its EIS instance is now available.
 void eisUnavailable(String reason)
          Allows the EventGenerator to indicate that its EIS instance is temporarily unavailable.
 Status getEventGeneratorStatus()
          Get an indication of the health/status of the EventGenerator.
 String[] getEventRouterInstanceIDs()
          Get a list of IDs this event router represents.
 IEventRouter.IRoutingInfo getEventRoutingInfo(com.bea.wlai.common.IEventDefinition eventDef)
          Prearrange for the delivery of events of the given type by getting a IRoutingInfo object that allows for very efficient delivery of events conforming to the given IEventDefinition.
 com.bea.wlai.common.IEventDefinition[] getEventTypeSummary()
          Get a list of event definitions currently being serviced by this event router.
 String getGUID()
          Gets the globally unique ID of this event router instance or null if none was given.
 String getName()
          Gets the name of this event router instance or null if none was given.
 boolean isEISAvailable()
          Get the availability of the EIS instance for the EventGenerator.
 void postEvent(com.bea.wlai.common.IEvent event)
          Post the given event to all listeners for this event router.
 void postEvent(IEventRouter.IRoutingInfo ri, com.bea.wlai.common.IEvent event)
          Post an event to all subscribers using an IRoutingInfo object obtained from a prior call to getEventRoutingInfo().
 void setEventGeneratorStatus(Status status)
          Allows an EventGenerator to indicate its health/status to the EventRouter.
 

Method Detail

getName

public String getName()
Gets the name of this event router instance or null if none was given. The name can be thought to represent the logical purpose of this router and its generator as defined at design-time.


getGUID

public String getGUID()
Gets the globally unique ID of this event router instance or null if none was given.


getEventRouterInstanceIDs

public String[] getEventRouterInstanceIDs()
Get a list of IDs this event router represents. An event router instance ID means different things for different adapters, but is generally thought to represent a planned/defined instance of the event router. This instance can be moved around from machine to machine to handle system outage and load balancing scenarios.

Returns:
The list of IDs defined for this event router or null if none were defined.

postEvent

public void postEvent(com.bea.wlai.common.IEvent event)
               throws Exception
Post the given event to all listeners for this event router.

Parameters:
event - The event to post
Throws:
Exception - if any error occurs delivering the event. It is the responsibility of the caller to handle storing this event for delivery at a later time.

getEventTypeSummary

public com.bea.wlai.common.IEventDefinition[] getEventTypeSummary()
Get a list of event definitions currently being serviced by this event router.

Returns:
An array of IEventDefinition objects representing all events this router has been asked to deliver.

eisUnavailable

public void eisUnavailable(String reason)
Allows the EventGenerator to indicate that its EIS instance is temporarily unavailable. The EventRouter will force the status of the EventGenerator to SUSPENDED and use the given description as the reason for the EventGenerator being suspended. EventGenerator implementations should provide meaningful reason information when calling this method.


eisAvailable

public void eisAvailable(String description)
Allows the EventGenerator to indicate that its EIS instance is now available. The EventRouter will force the status of the EventGenerator to HEALTHY and use the given description as the reason for the EventGenerator being resumed. If no description is available or needed, pass null for the description.


isEISAvailable

public boolean isEISAvailable()
Get the availability of the EIS instance for the EventGenerator. By default the event router will return true until a call is made by the event generator to eisUnavailable().


setEventGeneratorStatus

public void setEventGeneratorStatus(Status status)
Allows an EventGenerator to indicate its health/status to the EventRouter. The method should not be used to indicate that the EIS instance is unavailable/available (use the eisUnavailable() and eisAvailable() methods for this). The status parameter should be one of the defined Status.XXX values if possible. If no pre-defined status value is appropriate to describe the status of the EventGenerator, it may use values greater than 100 to indicate the status. The adapter should then document what the adapter-specific status codes mean.


getEventGeneratorStatus

public Status getEventGeneratorStatus()
Get an indication of the health/status of the EventGenerator. Status values greater than 100 are adapter-specific. The adapter should document what the adapter-specific status codes mean.


getEventRoutingInfo

public IEventRouter.IRoutingInfo getEventRoutingInfo(com.bea.wlai.common.IEventDefinition eventDef)
                                              throws Exception
Prearrange for the delivery of events of the given type by getting a IRoutingInfo object that allows for very efficient delivery of events conforming to the given IEventDefinition. The caller can use the returned IRoutingInfo for future calls to postEvent(IRoutingInfo, IEvent). This method and the postEvent(IRoutingInfo, IEvent) method together provide a facility for increasing event delivery throughput for events of a given type. This is true because the dynamic linkage between event and subscriber is only calculated once in the call to getRoutingInfo() and not repeately as it would be when calling postEvent(IEvent).

Throws:
Exception
See Also:
postEvent(com.bea.wlai.common.IEvent)

postEvent

public void postEvent(IEventRouter.IRoutingInfo ri,
                      com.bea.wlai.common.IEvent event)
               throws Exception
Post an event to all subscribers using an IRoutingInfo object obtained from a prior call to getEventRoutingInfo().

Parameters:
ri -
event -
Throws:
Exception
See Also:
getEventRoutingInfo(com.bea.wlai.common.IEventDefinition)