org.logicblaze.lingo.jms.impl
Class OneWayRequestor

java.lang.Object
  extended byorg.logicblaze.lingo.jms.impl.OneWayRequestor
All Implemented Interfaces:
Requestor
Direct Known Subclasses:
SingleThreadedRequestor

public class OneWayRequestor
extends Object
implements Requestor

A simple requestor which only supports one-way and so does not need a consumer.

Version:
$Revision: 1.2 $

Constructor Summary
OneWayRequestor(JmsProducer producer, Destination serverDestination)
           
 
Method Summary
 void close()
          Closes the Requestor and its session.
 String createCorrelationID()
          Creates a new correlation ID.
protected  void doSend(Destination destination, Message message, long timeToLive)
           
 int getDeliveryMode()
          The default delivery mode of request messages
 int getPriority()
          The default priority of request messages
 Session getSession()
          Provides access to the underlying JMS session so that you can create messages.
 long getTimeToLive()
          The default time to live on request messages
protected  long nextCounter()
           
 void oneWay(Destination destination, Message message)
          Sends a one way message, not waiting for the response.
 void oneWay(Destination destination, Message message, long timeToLive)
           
protected  void populateHeaders(Message message)
           
 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 setDeliveryMode(int deliveryMode)
           
 void setPriority(int priority)
           
 void setTimeToLive(long timeToLive)
          Sets the maximum time to live for requests
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneWayRequestor

public OneWayRequestor(JmsProducer producer,
                       Destination serverDestination)
Method Detail

getDeliveryMode

public int getDeliveryMode()
The default delivery mode of request messages


setDeliveryMode

public void setDeliveryMode(int deliveryMode)

getPriority

public int getPriority()
The default priority of request messages


setPriority

public void setPriority(int priority)

getTimeToLive

public long getTimeToLive()
The default time to live on request messages


setTimeToLive

public void setTimeToLive(long timeToLive)
Sets the maximum time to live for requests


oneWay

public void oneWay(Destination destination,
                   Message message)
            throws JMSException
Description copied from interface: Requestor
Sends a one way message, not waiting for the response.

Specified by:
oneWay in interface Requestor
Parameters:
destination - the server side destination
message - the message to send
Throws:
JMSException

oneWay

public void oneWay(Destination destination,
                   Message message,
                   long timeToLive)
            throws JMSException
Throws:
JMSException

getSession

public Session getSession()
Description copied from interface: Requestor
Provides access to the underlying JMS session so that you can create messages.

Specified by:
getSession in interface Requestor

close

public void close()
           throws JMSException
Description copied from interface: Requestor
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.

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

receive

public Message receive(long timeout)
                throws JMSException
Description copied from interface: Requestor
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

Specified by:
receive in interface Requestor
Throws:
JMSException

request

public Message request(Destination destination,
                       Message message)
                throws JMSException
Description copied from interface: Requestor
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.

Specified by:
request in interface Requestor
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
Description copied from interface: Requestor
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.

Specified by:
request in interface Requestor
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.

populateHeaders

protected void populateHeaders(Message message)
                        throws JMSException
Throws:
JMSException

doSend

protected void doSend(Destination destination,
                      Message message,
                      long timeToLive)
               throws JMSException
Throws:
JMSException

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.

Specified by:
createCorrelationID in interface Requestor
Returns:

nextCounter

protected long nextCounter()


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