de.danet.an.workflow.api
Interface EventSubscriber

All Superinterfaces:
WfObject

public interface EventSubscriber
extends WfObject

An EventSubscriber represents a connection to the workflow engine's event queue. From its creation with WorkflowService.createEventSubscriber until its destruction with WorkflowService.release all events from the workflow engine are delivered to the EventSubscriber. EventSubscribers should be released using WorkflowService.release when no longer needed as they may consume considerable resources.

Version:
$Revision: 1.3 $
Author:
Michael Lipp

Method Summary
 WfAuditEvent receive()
          Receives the next audit event.
 WfAuditEvent receive(long timeout)
          Receives the next audit event that arrives within the specified timeout interval.
 WfAuditEvent receiveNoWait()
          Receives the next audit event if one is immediately available.
 void setEventHandler(WfAuditHandler handler)
          Sets a handler for received events that is automatically invoked.
 

Method Detail

receive

public WfAuditEvent receive()
                     throws java.io.IOException
Receives the next audit event. This method blocks until the next event is received.

Returns:
the audit event
Throws:
java.io.IOException - if an error occurs

receive

public WfAuditEvent receive(long timeout)
                     throws java.io.IOException
Receives the next audit event that arrives within the specified timeout interval.

Parameters:
timeout - the timeout value (in milliseconds). If 0, the method blocks until a message is received.
Returns:
the audit event or null if the timeout expires
Throws:
java.io.IOException - if an error occurs

receiveNoWait

public WfAuditEvent receiveNoWait()
                           throws java.io.IOException
Receives the next audit event if one is immediately available.

Returns:
the audit event or null if no event is available
Throws:
java.io.IOException - if an error occurs

setEventHandler

public void setEventHandler(WfAuditHandler handler)
                     throws java.io.IOException
Sets a handler for received events that is automatically invoked. If a handler has been set, the receive methods may not be called.

Parameters:
handler - the event handler
Throws:
java.io.IOException - if an error occurs