org.logicblaze.lingo.jms.impl
Class SingleThreadedRequestor

java.lang.Object
  extended by org.logicblaze.lingo.jms.impl.OneWayRequestor
      extended by org.logicblaze.lingo.jms.impl.SingleThreadedRequestor
All Implemented Interfaces:
Requestor, org.springframework.beans.factory.DisposableBean
Direct Known Subclasses:
MultiplexingRequestor

public class SingleThreadedRequestor
extends OneWayRequestor

A simple Requestor which can only be used by one thread at once and only used for one message exchange at once.

Version:
$Revision: 93 $

Constructor Summary
SingleThreadedRequestor(javax.jms.Connection connection, javax.jms.Session session, javax.jms.MessageProducer producer, javax.jms.Destination serverDestination, boolean ownsConnection)
           
SingleThreadedRequestor(javax.jms.Connection connection, javax.jms.Session session, javax.jms.MessageProducer producer, javax.jms.Destination serverDestination, javax.jms.Destination clientDestination, boolean ownsConnection)
           
SingleThreadedRequestor(JmsProducerConfig config, javax.jms.Destination serverDestination, javax.jms.Destination clientDestination)
           
 
Method Summary
 void close()
          Closes the Requestor and its session.
protected static javax.jms.TemporaryQueue createTemporaryDestination(javax.jms.Session session)
           
 javax.jms.Destination getInboundDestination()
           
protected  javax.jms.MessageConsumer getReceiver()
           
 boolean isDeleteTemporaryDestinationsOnClose()
           
protected  void populateHeaders(javax.jms.Message message)
          A hook to allow custom implementations to process headers differently.
 javax.jms.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
 javax.jms.Message request(javax.jms.Destination destination, javax.jms.Message message)
          Sends a request and waits for a reply.
 javax.jms.Message request(javax.jms.Destination destination, javax.jms.Message message, long timeout)
          Sends a request and waits for a reply up to a maximum timeout.
 void setDeleteTemporaryDestinationsOnClose(boolean deleteTemporaryDestinationsOnClose)
           
 
Methods inherited from class org.logicblaze.lingo.jms.impl.OneWayRequestor
createCorrelationID, destroy, doSend, doSend, getConnection, getDeliveryMode, getMessageProducer, getPriority, getSession, getTimeToLive, newInstance, nextCounter, request, send, send, send, setDeliveryMode, setPriority, setTimeToLive, validateDestination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleThreadedRequestor

public SingleThreadedRequestor(JmsProducerConfig config,
                               javax.jms.Destination serverDestination,
                               javax.jms.Destination clientDestination)
                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException

SingleThreadedRequestor

public SingleThreadedRequestor(javax.jms.Connection connection,
                               javax.jms.Session session,
                               javax.jms.MessageProducer producer,
                               javax.jms.Destination serverDestination,
                               javax.jms.Destination clientDestination,
                               boolean ownsConnection)
                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException

SingleThreadedRequestor

public SingleThreadedRequestor(javax.jms.Connection connection,
                               javax.jms.Session session,
                               javax.jms.MessageProducer producer,
                               javax.jms.Destination serverDestination,
                               boolean ownsConnection)
                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException
Method Detail

request

public javax.jms.Message request(javax.jms.Destination destination,
                                 javax.jms.Message message)
                          throws javax.jms.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
Overrides:
request in class OneWayRequestor
Parameters:
destination - the server side destination
message - the message to send
Returns:
the reply message
Throws:
javax.jms.JMSException - if the JMS provider fails to complete the request due to some internal error.

request

public javax.jms.Message request(javax.jms.Destination destination,
                                 javax.jms.Message message,
                                 long timeout)
                          throws javax.jms.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
Overrides:
request in class OneWayRequestor
Parameters:
destination - the server side destination
message - the message to send
Returns:
the reply message
Throws:
javax.jms.JMSException - if the JMS provider fails to complete the request due to some internal error.

receive

public javax.jms.Message receive(long timeout)
                          throws javax.jms.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
Overrides:
receive in class OneWayRequestor
Throws:
javax.jms.JMSException

close

public void close()
           throws javax.jms.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
Overrides:
close in class OneWayRequestor
Throws:
javax.jms.JMSException - if the JMS provider fails to close the Requestor due to some internal error.

isDeleteTemporaryDestinationsOnClose

public boolean isDeleteTemporaryDestinationsOnClose()

setDeleteTemporaryDestinationsOnClose

public void setDeleteTemporaryDestinationsOnClose(boolean deleteTemporaryDestinationsOnClose)

createTemporaryDestination

protected static javax.jms.TemporaryQueue createTemporaryDestination(javax.jms.Session session)
                                                              throws javax.jms.JMSException
Throws:
javax.jms.JMSException

populateHeaders

protected void populateHeaders(javax.jms.Message message)
                        throws javax.jms.JMSException
Description copied from class: OneWayRequestor
A hook to allow custom implementations to process headers differently.

Overrides:
populateHeaders in class OneWayRequestor
Throws:
javax.jms.JMSException

getReceiver

protected javax.jms.MessageConsumer getReceiver()
                                         throws javax.jms.JMSException
Throws:
javax.jms.JMSException

getInboundDestination

public javax.jms.Destination getInboundDestination()
                                            throws javax.jms.JMSException
Throws:
javax.jms.JMSException


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