org.logicblaze.lingo.jms.impl
Class MultiplexingRequestor

java.lang.Object
  extended byorg.logicblaze.lingo.jms.impl.OneWayRequestor
      extended byorg.logicblaze.lingo.jms.impl.SingleThreadedRequestor
          extended byorg.logicblaze.lingo.jms.impl.MultiplexingRequestor
All Implemented Interfaces:
MessageListener, Requestor

public class MultiplexingRequestor
extends SingleThreadedRequestor
implements MessageListener

A Requestor which will use a single producer, consumer and temporary topic for resource efficiency, but will use correlation IDs on each message and response to ensure that each threads requests can occur synchronously.

This class can be used concurrently by many different threads at the same time.

Version:
$Revision: 1.4 $

Constructor Summary
MultiplexingRequestor(Session session, JmsProducer producer, Destination serverDestination)
           
MultiplexingRequestor(Session session, JmsProducer producer, Destination serverDestination, Destination clientDestination)
           
 
Method Summary
protected  JMSException createJMSException(Exception e)
           
protected  void doSend(Destination destination, Message message, long timeout)
           
static Requestor newInstance(ConnectionFactory connectionFactory, Destination serverDestination)
           
static Requestor newInstance(ConnectionFactory connectionFactory, Destination serverDestination, Destination clientDestination)
           
 void onMessage(Message message)
          Processes inbound responses from requests
 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
 void registerHandler(String correlationID, ReplyHandler handler)
           
 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.
 
Methods inherited from class org.logicblaze.lingo.jms.impl.SingleThreadedRequestor
close, createTemporaryDestination, getReceiver, populateHeaders
 
Methods inherited from class org.logicblaze.lingo.jms.impl.OneWayRequestor
createCorrelationID, getDeliveryMode, getPriority, getSession, getTimeToLive, nextCounter, oneWay, oneWay, setDeliveryMode, setPriority, setTimeToLive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplexingRequestor

public MultiplexingRequestor(Session session,
                             JmsProducer producer,
                             Destination serverDestination,
                             Destination clientDestination)
                      throws JMSException

MultiplexingRequestor

public MultiplexingRequestor(Session session,
                             JmsProducer producer,
                             Destination serverDestination)
                      throws JMSException
Method Detail

newInstance

public static Requestor newInstance(ConnectionFactory connectionFactory,
                                    Destination serverDestination)
                             throws JMSException
Throws:
JMSException

newInstance

public static Requestor newInstance(ConnectionFactory connectionFactory,
                                    Destination serverDestination,
                                    Destination clientDestination)
                             throws JMSException
Throws:
JMSException

registerHandler

public void registerHandler(String correlationID,
                            ReplyHandler handler)

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
Overrides:
request in class SingleThreadedRequestor
Throws:
JMSException

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
Overrides:
request in class SingleThreadedRequestor
Throws:
JMSException

onMessage

public void onMessage(Message message)
Processes inbound responses from requests

Specified by:
onMessage in interface MessageListener

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
Overrides:
receive in class SingleThreadedRequestor
Throws:
JMSException

doSend

protected void doSend(Destination destination,
                      Message message,
                      long timeout)
               throws JMSException
Overrides:
doSend in class OneWayRequestor
Throws:
JMSException

createJMSException

protected JMSException createJMSException(Exception e)


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