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

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

public class UncomposedMessageDeliveryAdapter
extends java.lang.Object

Adapter class for delivering uncomposed (ESB unaware) message payloads to a target service.

Basically wires a ServiceInvoker instance with a MessageComposer instance.

Author:
tom.fennelly@jboss.com
See Also:
ServiceInvoker

Constructor Summary
UncomposedMessageDeliveryAdapter(java.lang.String serviceCategory, java.lang.String serviceName, MessageComposer composer)
          Public constructor.
 
Method Summary
 void deliverAsync(java.lang.Object messagePayload)
          Asynchronously deliverAsync the supplied message to the target service associated with this adapter instance.
 java.lang.Object deliverSync(java.lang.Object messagePayload, long timeoutMillis)
          Synchronously deliver the supplied message to the target service associated with this adapter instance, decomposing the reply message payload.
 Message deliverSyncWithoutDecomposing(java.lang.Object messagePayload, long timeoutMillis)
          Synchronously deliver the supplied message to the target service associated with this adapter instance, without decompsing the synchronous reply message.
 ServiceInvoker getDeliveryAdapter()
          Get the "composed" message delivery adapter instance through which this adpter is delivering message, after composing them.
static UncomposedMessageDeliveryAdapter getGatewayDeliveryAdapter(ConfigTree gatewayConfig, MessageComposer defaultComposer)
          Utility factory method for creation of an uncomposed message delivery adapter from a gateway configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UncomposedMessageDeliveryAdapter

public UncomposedMessageDeliveryAdapter(java.lang.String serviceCategory,
                                        java.lang.String serviceName,
                                        MessageComposer composer)
                                 throws MessageDeliverException
Public constructor.

Parameters:
serviceCategory - The category name of the Service to which this instance will deliver messages.
serviceName - The name of the Service to which this instance will deliver messages.
composer - The the message composer class for this delivery instance.
Throws:
RegistryException - Failed to lookup EPRs for the specified Service.
MessageDeliverException
Method Detail

deliverSync

public java.lang.Object deliverSync(java.lang.Object messagePayload,
                                    long timeoutMillis)
                             throws MessageDeliverException,
                                    RegistryException,
                                    FaultMessageException
Synchronously deliver the supplied message to the target service associated with this adapter instance, decomposing the reply message payload.

To deliver synchronusly without decomposing the reply, see deliverSyncWithoutDecomposing(Object,long).

Parameters:
messagePayload - Message payload to be packaged, or a channel specific container class for the message payload (e.g. a JMS message).
timeoutMillis - Number of milliseconds before synchronous reply pickup should timeout.
Returns:
The reply message payload (decomposed).
Throws:
MessageDeliverException - Failed to deliverAsync message, after trying all available EPRs.
RegistryException
FaultMessageException

deliverSyncWithoutDecomposing

public Message deliverSyncWithoutDecomposing(java.lang.Object messagePayload,
                                             long timeoutMillis)
                                      throws MessageDeliverException,
                                             RegistryException,
                                             FaultMessageException
Synchronously deliver the supplied message to the target service associated with this adapter instance, without decompsing the synchronous reply message.

Parameters:
messagePayload - Message payload to be packaged, or a channel specific container class for the message payload (e.g. a JMS message).
timeoutMillis - Number of milliseconds before synchronous reply pickup should timeout.
Returns:
The reply Message. The caller must decompose the message.
Throws:
MessageDeliverException - Failed to deliverAsync message, after trying all available EPRs.
RegistryException
FaultMessageException

deliverAsync

public void deliverAsync(java.lang.Object messagePayload)
                  throws MessageDeliverException,
                         RegistryException
Asynchronously deliverAsync the supplied message to the target service associated with this adapter instance.

Parameters:
messagePayload - Message payload to be packaged, or a channel specific container class for the message payload (e.g. a JMS message).
Throws:
MessageDeliverException - Failed to deliverAsync message, after trying all available EPRs.
RegistryException

getDeliveryAdapter

public ServiceInvoker getDeliveryAdapter()
Get the "composed" message delivery adapter instance through which this adpter is delivering message, after composing them.

Returns:
Message Delivery Adapter.

getGatewayDeliveryAdapter

public static UncomposedMessageDeliveryAdapter getGatewayDeliveryAdapter(ConfigTree gatewayConfig,
                                                                         MessageComposer defaultComposer)
                                                                  throws ConfigurationException
Utility factory method for creation of an uncomposed message delivery adapter from a gateway configuration.

Parameters:
gatewayConfig - The gateway configuration.
defaultComposer - The default message composer, used when the configuration doesn't specify a composer.
Returns:
The adapter instance.
Throws:
ConfigurationException - Invalid gateway configuration.