org.logicblaze.lingo.jms
Interface Requestor

All Known Implementing Classes:
OneWayRequestor

public interface Requestor

Represents a JMS based requestor which is capable of performing various Message Exchange Patterns such as one-way, synchronous request-response, receive etc.

Version:
$Revision: 1.1 $

Method Summary
 void close()
          Closes the Requestor and its session.
 String createCorrelationID()
          Creates a new correlation ID.
 Session getSession()
          Provides access to the underlying JMS session so that you can create messages.
 void oneWay(Destination destination, Message message)
          Sends a one way message, not waiting for the response.
 Message receive(long timeout)
          Receives a message waiting for a maximum timeout if the timeout value is > 0 ir waiting forever if the timeout is < 0 or not waiting at all if the timeout is zero
 Message request(Destination destination, Message message)
          Sends a request and waits for a reply.
 Message request(Destination destination, Message message, long timeout)
          Sends a request and waits for a reply up to a maximum timeout.
 

Method Detail

oneWay

public void oneWay(Destination destination,
                   Message message)
            throws JMSException
Sends a one way message, not waiting for the response.

Parameters:
destination - the server side destination
message - the message to send
Throws:
JMSException

request

public Message request(Destination destination,
                       Message message)
                throws JMSException
Sends a request and waits for a reply. The temporary queue is used for the JMSReplyTo destination, and only one reply per request is expected.

Parameters:
destination - the server side destination
message - the message to send
Returns:
the reply message
Throws:
JMSException - if the JMS provider fails to complete the request due to some internal error.

request

public Message request(Destination destination,
                       Message message,
                       long timeout)
                throws JMSException
Sends a request and waits for a reply up to a maximum timeout. The temporary queue is used for the JMSReplyTo destination, and only one reply per request is expected.

Parameters:
destination - the server side destination
message - the message to send
Returns:
the reply message
Throws:
JMSException - if the JMS provider fails to complete the request due to some internal error.

receive

public Message receive(long timeout)
                throws JMSException
Receives a message waiting for a maximum timeout if the timeout value is > 0 ir waiting forever if the timeout is < 0 or not waiting at all if the timeout is zero

Throws:
JMSException

getSession

public Session getSession()
Provides access to the underlying JMS session so that you can create messages.


close

public void close()
           throws JMSException
Closes the Requestor and its session.

Since a provider may allocate some resources on behalf of a Requestor outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

Note that this method closes the Session object passed to the Requestor constructor.

Throws:
JMSException - if the JMS provider fails to close the Requestor due to some internal error.

createCorrelationID

public String createCorrelationID()
Creates a new correlation ID. Note that because the correlationID is used on a per-temporary destination basis, it does not need to be unique across more than one destination. So a simple counter will suffice.

Returns:


Copyright © 2005 LogicBlaze, Inc.. All Rights Reserved.