public class Dispatcher
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
AGENT_BUSY |
static int |
AGENT_NOT_BUSY |
Modifier and Type | Method and Description |
---|---|
void |
dispatch(Envelope envelope)
Dispatch the envelope to he appropriate object's message handler.
|
void |
processTimeOuts()
Invoke timeout processing for each message where timeout has occurred.
|
void |
registerEventHandler(java.lang.String service,
long subscriptionId,
Manager manager)
Register a manager as an event message handler for a service/subscription.
|
void |
registerMessage(java.lang.String invokeId,
Manager manager)
Register a manager as a message handler for an invoke id.
|
void |
registerMessage(java.lang.String invokeId,
Manager manager,
int timeout)
Register a manager as a message handler for an invoke id.
|
void |
registerServer(java.lang.String service,
Agent agent)
Register an agent as a message handler for a service
|
void |
serverAvailable(java.lang.String service,
Agent agent)
Mark an agent as available.
|
int |
serverCount(java.lang.String service)
Get the count of agents for a service.
|
int |
serverCountAvailable(java.lang.String service)
Get the count of available agents for a service.
|
void |
serverUnavailable(java.lang.String service,
Agent agent)
Mark an agent as unavailable.
|
java.lang.String |
toString() |
void |
unregisterEventHandler(java.lang.String service,
long subscriptionId)
Unregister a manager for a service/subscription.
|
void |
unregisterMessage(java.lang.String invokeId)
Unregister a manager for an invoke id.
|
void |
unregisterServer(java.lang.String service,
Agent agent)
Unregister an agent for a service.
|
public static final int AGENT_BUSY
public static final int AGENT_NOT_BUSY
public void dispatch(Envelope envelope) throws NoHandlerException, EnvelopeOverflowException, VendorTransportException
envelope
- The envelope to be dispatched.NoHandlerException
- There is no available handler for this envelope.EnvelopeOverflowException
VendorTransportException
public void processTimeOuts()
public void registerEventHandler(java.lang.String service, long subscriptionId, Manager manager) throws java.lang.IllegalArgumentException, DuplicateEntryException
service
- The service (for example, "Demo.Sales").subscriptionId
- The subscription's id (obtained from the response envelope).manager
- The manager handling this subscription.java.lang.IllegalArgumentException
- The service is not recognised.DuplicateEntryException
- There's already an entry for this service/agent.public void registerMessage(java.lang.String invokeId, Manager manager) throws DuplicateEntryException
invokeId
- The invoke id (obtained from the request envelope).manager
- The manager handling this invoke id.DuplicateEntryException
- There's already an entry for this invoke id/manager.public void registerMessage(java.lang.String invokeId, Manager manager, int timeout) throws DuplicateEntryException
invokeId
- The invoke id (obtained from the request envelope).manager
- The manager handling this invoke id.timeout
- The timeout, in seconds.DuplicateEntryException
- There's already an entry for this invoke id/manager.public void registerServer(java.lang.String service, Agent agent) throws DuplicateEntryException
service
- The service (for example, "Demo.Sales").agent
- The agent handling this service.DuplicateEntryException
- There's already an entry for this service/agent.public void serverAvailable(java.lang.String service, Agent agent) throws java.lang.IllegalArgumentException
service
- The service being handled.agent
- The agent.java.lang.IllegalArgumentException
- The agent has not been previously registered.public int serverCount(java.lang.String service)
service
- The service.public int serverCountAvailable(java.lang.String service)
service
- The service.public void serverUnavailable(java.lang.String service, Agent agent) throws java.lang.IllegalArgumentException
service
- The service being handled.agent
- The agent.java.lang.IllegalArgumentException
- The agent has not been previously registered.public java.lang.String toString()
toString
in class java.lang.Object
public void unregisterEventHandler(java.lang.String service, long subscriptionId) throws java.lang.IllegalArgumentException
service
- The service.subscriptionId
- The subscription id.java.lang.IllegalArgumentException
public void unregisterMessage(java.lang.String invokeId)
invokeId
- The invoke id.public void unregisterServer(java.lang.String service, Agent agent)
service
- The service.agent
- The agent.