| org.obe.spi.service.ApplicationEventBroker
All known Subclasses: org.obe.event.AbstractApplicationEventBroker,
ApplicationEventBroker | public interface ApplicationEventBroker extends WorkflowService(Code) | | Provides access to temporal events and external events originating in third
party applications.
The workflow engine subscribes to events by specifying the event type, an
optional set of event keys, an optional predicate, and a set of correlation
keys. The combination of event type, event keys and predicate are used to
discriminate the precise event instance to which the engine is subscribing.
The correlation keys encapsulate the workflow context and typically contain
between one and four strings: processDefinitionId, processInstanceId,
activityInstanceId and transitionId. All elements of the array must be
non-null.
This somewhat complex scheme is intended to enhance performance, since in a
production system the alternative of evaluating large numbers of simple
expressions would not perform well. The event type definitions and the
expressions used to compute the key values from the inbound event data are
registered in the event broker.
When unsubscribing, all existing subscriptions which match the array of
correlation keys are cancelled, even if it contains fewer elements than the
existing subscription. This enables a process instance, for example, to
cancel all outstanding subscriptions in one call by passing just the
processDefinitionId and processInstanceId.
author: Adrian Price See Also: ApplicationEvent See Also: ApplicationEventListener |
Inner Class :interface EventSubscription | |
Inner Class :interface ApplicationEventSubscription extends EventSubscription | |
Inner Class :interface TemporalEventSubscription extends EventSubscription | |
Method Summary | |
void | addApplicationEventListener(ApplicationEventListener listener) Adds an application event listener. | void | createEventType(EventTypeMetaData eventType) Registers an application event type. | void | deleteEventType(String eventType) Unregisters an application event type. | EventTypeMetaData[] | findEventTypeMetaData() Finds meta-data for all application event types. | EventTypeMetaData | findEventTypeMetaData(String eventId) Finds meta-data for a specific application event type.
Parameters: eventId - The application event ID. | void | fireApplicationEvent(ApplicationEvent event, String[] correlationKeys) Notifies listeners of an event which matches the specified correlation
keys. | void | publish(Object source, Map attrs) Injects an application event for matching. | void | publish(ApplicationEvent event) Injects an application event for matching. | void | removeApplicationEventListener(ApplicationEventListener listener) Removes an application event listener. | ApplicationEventSubscription | subscribe(String eventType, Object[] eventKeys, String predicate, Date effective, Date expiry, int count, String[] correlationKeys, WorkflowContext ctx) Subscribes to an application event. | TemporalEventSubscription | subscribe(String eventType, Date effective, String[] correlationKeys) Subscribes to a single timed event. | TemporalEventSubscription | subscribe(String eventType, Date effective, Date expiry, int count, Duration interval, String calendar, boolean recoverable, String[] correlationKeys) Subscribes to a series of timed events. | boolean | supportsKeyBasedSubscriptions() Whether this event broker implementation supports key-based
subscriptions. | void | unsubscribe(String[] correlationKeys, boolean exact) Cancels matching subscriptions. | void | updateEventType(EventTypeMetaData eventType) Updates an application event type. |
deleteEventType | void deleteEventType(String eventType) throws RepositoryException(Code) | | Unregisters an application event type.
Parameters: eventType - The application event name. throws: ObjectNotFoundException - if the application event name is notregistered. throws: RepositoryException - if the application event type could not beunregistered for some other reason. |
findEventTypeMetaData | EventTypeMetaData[] findEventTypeMetaData() throws RepositoryException(Code) | | Finds meta-data for all application event types. This method is intended
to support design-time clients and management applications.
The list of all application event types. throws: RepositoryException - if an error occurred. |
fireApplicationEvent | void fireApplicationEvent(ApplicationEvent event, String[] correlationKeys)(Code) | | Notifies listeners of an event which matches the specified correlation
keys. This method is present solely to support custom event broker
implementations. It should not be called by client code.
Parameters: event - The matching event. Parameters: correlationKeys - The correlation keys from the matchedsubscription. See Also: AsyncFireApplicationEvent |
publish | void publish(Object source, Map attrs) throws RepositoryException, EvaluatorException(Code) | | Injects an application event for matching. This overload of the
publish method provides a loosely coupled integration
mechanism that imposes minimal requirements on the source application.
Matching subscriptions which do not specify an expiry date are cancelled
when they have been fulfilled.
If contentType is not specified, the method infers it from
the event data by calling @link #process(Object).
Similarly, if schema is not specified, the method infers it
from the event data . For a contentType of
text/xml , the schema is of the form
{<namespace>}<tag-name> , where
<namespace> is either the PublicId or SystemId of a
DTD if specified, or the namespace URI of the document element. If no
<namespace> is present, the schema is simply
<tag-name> . For a contentType of
application/x-java-object , the schema is the
fully qualified Java class name.
Parameters: source - The source object which raised the event. Parameters: attrs - Additional metadata about the event data. See Also: ApplicationEventBroker.publish(ApplicationEvent) |
subscribe | ApplicationEventSubscription subscribe(String eventType, Object[] eventKeys, String predicate, Date effective, Date expiry, int count, String[] correlationKeys, WorkflowContext ctx) throws RepositoryException(Code) | | Subscribes to an application event. The event broker uses the specified
event type, keys and predicate to match a particular event occurrence
to the subscription.
The matching events and the correlation keys from the subscription are
delivered to the external event listener that was registered in a prior
call to addApplicationEventListener .
Parameters: eventType - The name of the event type. Must be registered with theevent broker. Parameters: eventKeys - The keys required to identify the particular eventoccurrence of interest. The keys act as a coarse grained filter that canbe efficiently compared with the corresponding keys on an inbound event.Can be null , but beware the potential performance impact ifpredicate is not null , because the event brokerwould have to evaluate all such conditions for every occurrence ofeventType . Parameters: predicate - An additional qualifying condition required to identifythe particular event occurrence of interest. The predicate is evaluatedagainst the inbound ApplicationEvent. Parameters: effective - The date/time at which the subscription becomeseffective. Can be null , in which case the subscriptionbecomes effective immediately. Parameters: expiry - The date/time at which the subscription expires. Can benull , in which case the subscription never expires. Parameters: count - The number of such events to deliver. The subscriptionautomatically expires when the count th event has beendelivered or when expiry elapses, whichever occurs sooner.Constraint: count == -1 || count >= 1 . Parameters: correlationKeys - Contextual information that will be passed to theevent listener when the event occurs. Typically contains unique keysfor various workflow entities. Parameters: ctx - Workflow execution context. The event subscription. throws: RepositoryException - if the subscription could not be created. See Also: ApplicationEventBroker.addApplicationEventListener See Also: ApplicationEventBroker.unsubscribe |
subscribe | TemporalEventSubscription subscribe(String eventType, Date effective, Date expiry, int count, Duration interval, String calendar, boolean recoverable, String[] correlationKeys) throws RepositoryException(Code) | | Subscribes to a series of timed events. The event broker schedules
the delivery of a series of up to count events of the
specified eventType . The subscription expires when that
number of events has been delivered or at the specified
expiry date, whichever is sooner. The delivery time for the
next event in the series is computed against the specified
calendar by adding interval to the previous
effective date.
The matching events and the correlation keys from the subscription are
delivered to the external event listener that was registered in a prior
call to addApplicationEventListener .
Parameters: eventType - The name of the event type. Parameters: effective - The date/time at which to deliver the first event. Parameters: expiry - The date/time at which the subscription expires. Can benull . Parameters: count - The number of such events to deliver. The subscriptionautomatically expires when the count th event has beendelivered or when expiry elapses, whichever occurs sooner.Constraint: count == -1 || count >= 1 . Parameters: interval - The interval between events in the series. Parameters: calendar - The name of theBusinessCalendar BusinessCalendar to use whenperforming temporal computations. Can be null . Parameters: recoverable - true if the temporal events arerecoverable (i.e., must still be processed even if they occurred whilethe server was down). Parameters: correlationKeys - Contextual information that will be passed to theevent listener when the event occurs. Typically contains unique keysfor various workflow entities. The event subscription. throws: RepositoryException - if the subscription could not be created. See Also: ApplicationEventBroker.subscribe(String,Date,String[]) See Also: ApplicationEventBroker.unsubscribe See Also: ApplicationEventBroker.addApplicationEventListener |
supportsKeyBasedSubscriptions | boolean supportsKeyBasedSubscriptions()(Code) | | Whether this event broker implementation supports key-based
subscriptions.
true if it does. |
unsubscribe | void unsubscribe(String[] correlationKeys, boolean exact) throws RepositoryException(Code) | | Cancels matching subscriptions. The subscriptions must have been
established by a prior call to
ApplicationEventBroker.subscribe .
Parameters: correlationKeys - Keys identifying the subscriptions to cancel. Parameters: exact - true to cancel only those subscriptions whosecorrelationKeys match exactly in number and value. false permits all subscriptions within a particular scope to be cancelled. Forexample, {x,y} would match {x,y}, {x,y,z1} ... {x,y,zN} etc. inexactly, but would only match {x,y} exactly. throws: RepositoryException - if the subscriptions could not be removed. See Also: ApplicationEventBroker.subscribe(String,Object[],String,Date,Date,int,String[],WorkflowContext) See Also: ApplicationEventBroker.subscribe(String,Date,String[]) See Also: ApplicationEventBroker.subscribe(String,Date,Date,int,Duration,String,boolean,String[]) |
|
|