javax.jbi.messaging
Interface DeliveryChannel


public interface DeliveryChannel

Bi-directional communication channel used to interact with the Normalized Message Service.

Author:
JSR208 Expert Group

Method Summary
 MessageExchange accept()
          Blocking call used to service a MessageExchange instance which has been initiated by another component.
 MessageExchange accept(long timeout)
          Identical to accept(), but returns after specified interval even if a message exchange is unavailable.
 void close()
          Closes the delivery channel, halting all message traffic.
 MessageExchangeFactory createExchangeFactory()
          Create a message exchange factory.
 MessageExchangeFactory createExchangeFactory(javax.xml.namespace.QName interfaceName)
          Create a message exchange factory for the given interface name.
 MessageExchangeFactory createExchangeFactory(ServiceEndpoint endpoint)
          Create a message exchange factory for the given endpoint.
 MessageExchangeFactory createExchangeFactoryForService(javax.xml.namespace.QName serviceName)
          Create a message exchange factory for the given service name.
 void send(MessageExchange exchange)
          Routes a MessageExchange instance through the Normalized Message Service to the appropriate servicing component.
 boolean sendSync(MessageExchange exchange)
          Routes a MessageExchange instance through the Normalized Message Service to the appropriate servicing component, blocking until the exchange is returned.
 boolean sendSync(MessageExchange exchange, long timeout)
          Routes a MessageExchange instance through the Normalized Message Service to the appropriate servicing component, blocking until the specified timeout is reached.
 

Method Detail

close

public void close()
           throws MessagingException
Closes the delivery channel, halting all message traffic.

Throws:
MessagingException - fatal error while closing channel.

createExchangeFactory

public MessageExchangeFactory createExchangeFactory()
Create a message exchange factory. This factory will create exchange instances with all appropriate properties set to null.

Returns:
a message exchange factory

createExchangeFactory

public MessageExchangeFactory createExchangeFactory(javax.xml.namespace.QName interfaceName)
Create a message exchange factory for the given interface name.

Parameters:
interfaceName - name of the interface for which all exchanges created by the returned factory will be set
Returns:
an exchange factory that will create exchanges for the given interface; must be non-null

createExchangeFactoryForService

public MessageExchangeFactory createExchangeFactoryForService(javax.xml.namespace.QName serviceName)
Create a message exchange factory for the given service name.

Parameters:
serviceName - name of the service for which all exchanges created by the returned factory will be set
Returns:
an exchange factory that will create exchanges for the given service; must be non-null

createExchangeFactory

public MessageExchangeFactory createExchangeFactory(ServiceEndpoint endpoint)
Create a message exchange factory for the given endpoint.

Parameters:
endpoint - endpoint for which all exchanges created by the returned factory will be set for
Returns:
an exchange factory that will create exchanges for the given endpoint

accept

public MessageExchange accept()
                       throws MessagingException
Blocking call used to service a MessageExchange instance which has been initiated by another component. This method supports concurrent invocation for multi-threaded environments.

Returns:
mesage exchange instance
Throws:
MessagingException - failed to accept

accept

public MessageExchange accept(long timeout)
                       throws MessagingException
Identical to accept(), but returns after specified interval even if a message exchange is unavailable.

Parameters:
timeout - time to wait in milliseconds
Returns:
mesage exchange instance or null if timeout is reached
Throws:
MessagingException - failed to accept

send

public void send(MessageExchange exchange)
          throws MessagingException
Routes a MessageExchange instance through the Normalized Message Service to the appropriate servicing component. This method supports concurrent invocation for multi-threaded environments.

Parameters:
exchange - message exchange to send
Throws:
MessagingException - unable to send exchange

sendSync

public boolean sendSync(MessageExchange exchange)
                 throws MessagingException
Routes a MessageExchange instance through the Normalized Message Service to the appropriate servicing component, blocking until the exchange is returned. This method supports concurrent invocation for multi-threaded environments.

Parameters:
exchange - message exchange to send
Returns:
true if the exchange has been processed and returned by the servicing component, false otherwise.
Throws:
MessagingException - unable to send exchange

sendSync

public boolean sendSync(MessageExchange exchange,
                        long timeout)
                 throws MessagingException
Routes a MessageExchange instance through the Normalized Message Service to the appropriate servicing component, blocking until the specified timeout is reached. This method supports concurrent invocation for multi-threaded environments.

Parameters:
exchange - message exchange to send
timeout - time to wait in milliseconds
Returns:
true if the exchange has been processed and returned by the servicing component, false in the case of timeout.
Throws:
MessagingException - unable to send exchange

Built 06/07/2005 11:16 AM on acer (SunOS 5.9)

Copyright (c) 2004-2005 Sun Microsystems Inc., All Rights Reserved.