org.logicblaze.lingo.jms
Interface Requestor

All Known Implementing Classes:
MultiplexingRequestor, OneWayRequestor, SingleThreadedRequestor

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.6 $

Method Summary
 void close()
          Closes the Requestor and its session.
 String createCorrelationID()
          Creates a new correlation ID.
 Connection getConnection()
          Provides access to the underlying Connection this requestor is using
 MessageProducer getMessageProducer()
          Returns the underying producer
 Session getSession()
          Provides access to the underlying JMS session so that you can create messages.
 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.
 void request(Destination destination, Message requestMessage, ReplyHandler handler, long timeout)
          Sends a request and provides a handler for all responses until the request is considered dead (or it is timed out).
 void send(Destination destination, Message message)
          Sends a one way message, not waiting for the response.
 void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive)
          Sends a message to the given destination in a way that can be implemented in JMS 1.0.2b as well as using the JMS 1.1 send() method on MessageProducer
 

Method Detail

send

void send(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

send

void send(Destination destination,
          Message message,
          int deliveryMode,
          int priority,
          long timeToLive)
          throws JMSException
Sends a message to the given destination in a way that can be implemented in JMS 1.0.2b as well as using the JMS 1.1 send() method on MessageProducer

Throws:
JMSException - if the message could not be sent

request

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

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

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

request

void request(Destination destination,
             Message requestMessage,
             ReplyHandler handler,
             long timeout)
             throws JMSException
Sends a request and provides a handler for all responses until the request is considered dead (or it is timed out).

Throws:
JMSException

getMessageProducer

MessageProducer getMessageProducer()
Returns the underying producer


getConnection

Connection getConnection()
Provides access to the underlying Connection this requestor is using


getSession

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


close

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

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-2006 LogicBlaze, Inc.. All Rights Reserved.