org.jboss.jms.client.container
Class ClientConsumer
java.lang.Object
org.jboss.jms.client.container.ClientConsumer
public class ClientConsumer
- extends java.lang.Object
- Version:
- $Revision: 2774 $
$Id: MessageCallbackHandler.java 2774 2007-06-12 22:43:54Z timfox $
- Author:
- Ovidiu Feodorov, Tim Fox/a>
Constructor Summary |
ClientConsumer(boolean isCC,
int ackMode,
SessionDelegate sess,
ConsumerDelegate cons,
java.lang.String consumerID,
java.lang.String queueName,
int bufferSize,
QueuedExecutor sessionExecutor,
int maxDeliveries,
boolean shouldAck,
boolean handleFlowControl,
long redeliveryDelay)
|
Method Summary |
void |
addToFrontOfBuffer(MessageProxy proxy)
|
static void |
callOnMessage(SessionDelegate sess,
MessageListener listener,
java.lang.String consumerID,
java.lang.String queueName,
boolean isConnectionConsumer,
MessageProxy m,
int ackMode,
int maxDeliveries,
SessionDelegate connectionConsumerSession,
boolean shouldAck)
|
void |
cancelBuffer()
|
void |
close(long lastDeliveryId)
|
java.lang.String |
getConsumerId()
|
MessageListener |
getMessageListener()
|
long |
getRedeliveryDelay()
|
void |
handleMessage(java.lang.Object message)
Handles a message sent from the server. |
boolean |
isClosed()
|
MessageProxy |
receive(long timeout)
Method used by the client thread to get a Message, if available. |
void |
setConsumerId(java.lang.String consumerId)
|
void |
setMessageListener(MessageListener listener)
|
void |
synchronizeWith(ClientConsumer newHandler)
Needed for failover
Note this can't lock the mainLock since receive() also locks the main lock
and this would prevent failover occuring when a consumer is blocked on receive() |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ClientConsumer
public ClientConsumer(boolean isCC,
int ackMode,
SessionDelegate sess,
ConsumerDelegate cons,
java.lang.String consumerID,
java.lang.String queueName,
int bufferSize,
QueuedExecutor sessionExecutor,
int maxDeliveries,
boolean shouldAck,
boolean handleFlowControl,
long redeliveryDelay)
callOnMessage
public static void callOnMessage(SessionDelegate sess,
MessageListener listener,
java.lang.String consumerID,
java.lang.String queueName,
boolean isConnectionConsumer,
MessageProxy m,
int ackMode,
int maxDeliveries,
SessionDelegate connectionConsumerSession,
boolean shouldAck)
throws JMSException
- Throws:
JMSException
isClosed
public boolean isClosed()
handleMessage
public void handleMessage(java.lang.Object message)
throws java.lang.Exception
- Handles a message sent from the server.
- Parameters:
message
- The message
- Throws:
java.lang.Exception
setMessageListener
public void setMessageListener(MessageListener listener)
throws JMSException
- Throws:
JMSException
cancelBuffer
public void cancelBuffer()
throws JMSException
- Throws:
JMSException
close
public void close(long lastDeliveryId)
throws JMSException
- Throws:
JMSException
receive
public MessageProxy receive(long timeout)
throws JMSException
- Method used by the client thread to get a Message, if available.
- Parameters:
timeout
- - the timeout value in milliseconds. A zero timeount never expires, and the
call blocks indefinitely. A -1 timeout means receiveNoWait(): return the next message
or null if one is not immediately available. Returns null if the consumer is
concurrently closed.
- Throws:
JMSException
getMessageListener
public MessageListener getMessageListener()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getConsumerId
public java.lang.String getConsumerId()
setConsumerId
public void setConsumerId(java.lang.String consumerId)
addToFrontOfBuffer
public void addToFrontOfBuffer(MessageProxy proxy)
throws java.lang.Exception
- Throws:
java.lang.Exception
synchronizeWith
public void synchronizeWith(ClientConsumer newHandler)
- Needed for failover
Note this can't lock the mainLock since receive() also locks the main lock
and this would prevent failover occuring when a consumer is blocked on receive()
getRedeliveryDelay
public long getRedeliveryDelay()
Copyright © 2006 JBoss Inc. All Rights Reserved.