org.jboss.soa.esb.listeners.message
Class Invoker

java.lang.Object
  extended by org.jboss.soa.esb.listeners.message.Invoker

public class Invoker
extends java.lang.Object

Utility class to hide implementation details for sending Command messages and optionally awaiting for a response.

Author:
schifest@heuristica.com.ar

Constructor Summary
Invoker()
           
 
Method Summary
static void invoke(AbstractCommandVehicle command, java.lang.String category, java.lang.String name)
          Encapsulate command in an ESB Message, and deliver.
static Message invokeAndAwaitResponse(AbstractCommandVehicle command, java.lang.String category, java.lang.String name, int maxWaitMillis)
          Encapsulate command in an ESB Message, deliver it, and wait for a response Message.
static Message invokeAndAwaitResponse(Message outgoing, int maxWaitMillis)
          Deliver an ESB Message and wait for a response Message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Invoker

public Invoker()
Method Detail

invoke

public static void invoke(AbstractCommandVehicle command,
                          java.lang.String category,
                          java.lang.String name)
                   throws RegistryException,
                          MalformedEPRException,
                          CourierException
Encapsulate command in an ESB Message, and deliver.

Parameters:
command - AbstractCommandMessage - Transform into an ESB Message, and send
category - String - Service category name for Registry inquiry
name - String - Service name for Registry inquiry
Throws:
RegistryException
MalformedEPRException
CourierException

invokeAndAwaitResponse

public static Message invokeAndAwaitResponse(AbstractCommandVehicle command,
                                             java.lang.String category,
                                             java.lang.String name,
                                             int maxWaitMillis)
                                      throws RegistryException,
                                             MalformedEPRException,
                                             CourierException,
                                             CourierTimeoutException
Encapsulate command in an ESB Message, deliver it, and wait for a response Message.

Parameters:
command - AbstractCommandMessage - Transform into an ESB Message, and send
category - String - Service category name for Registry inquiry
name - String - Service name for Registry inquiry
maxWaitMillis - int - Maximum time to wait for a response
Returns:
Throws:
RegistryException
MalformedEPRException
CourierException
CourierTimeoutException - - If response was not received in specified time

invokeAndAwaitResponse

public static Message invokeAndAwaitResponse(Message outgoing,
                                             int maxWaitMillis)
                                      throws CourierException,
                                             MalformedEPRException,
                                             CourierTimeoutException
Deliver an ESB Message and wait for a response Message.

Parameters:
outgoing - Message - should contain at least the toEPR
maxWaitMillis - int - Maximum time to wait for a response
Returns:
Throws:
CourierException
MalformedEPRException
CourierTimeoutException - - If response was not received in specified time