org.jboss.jms.server.endpoint
Class ServerConsumerEndpoint

java.lang.Object
  extended byorg.jboss.jms.server.endpoint.ServerConsumerEndpoint
All Implemented Interfaces:
Closeable, ConsumerEndpoint, Filter, Receiver, java.io.Serializable

public class ServerConsumerEndpoint
extends java.lang.Object
implements Receiver, Filter, ConsumerEndpoint

Concrete implementation of ConsumerEndpoint. Lives on the boundary between Messaging Core and the JMS Facade.

Version:
$Revision: 1.43 $ $Id: ServerConsumerEndpoint.java,v 1.43 2006/06/26 18:41:21 timfox Exp $
Author:
Ovidiu Feodorov, Tim Fox
See Also:
Serialized Form

Constructor Summary
protected ServerConsumerEndpoint(int id, Channel channel, ServerSessionEndpoint sessionEndpoint, java.lang.String selector, boolean noLocal, JBossDestination dest)
           
 
Method Summary
 boolean accept(Routable r)
          Tests whether the routable should be accepted.
protected  void acknowledgeAll()
           
protected  void acknowledgeTransactionally(long messageID, Transaction tx)
           
 void activate()
           
protected  void cancelAllDeliveries()
           
 void cancelDeliveries(java.util.List messageIDs)
           
 void cancelDelivery(long messageID)
           
 void close()
          Close the instance
 void closing()
          Tell the instance to prepare to close
 long deactivate()
           
protected  void disconnect()
          Disconnect this consumer from the Channel that feeds it.
 JBossDestination getDestination()
           
 MessageProxy getMessageNow(boolean wait)
          We attempt to get the message directly fron the channel first.
 ServerSessionEndpoint getSessionEndpoint()
           
 Delivery handle(DeliveryObserver observer, Routable reference, Transaction tx)
          A receiver can return an active, "done" or null delivery.
protected  boolean isReady()
           
protected  void promptDelivery()
           
protected  void remove()
          Actually remove the consumer and clear up any deliveries it may have
protected  void removeDelivery(java.lang.String messageID)
           
protected  void setStarted(boolean started)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerConsumerEndpoint

protected ServerConsumerEndpoint(int id,
                                 Channel channel,
                                 ServerSessionEndpoint sessionEndpoint,
                                 java.lang.String selector,
                                 boolean noLocal,
                                 JBossDestination dest)
                          throws InvalidSelectorException
Method Detail

handle

public Delivery handle(DeliveryObserver observer,
                       Routable reference,
                       Transaction tx)
Description copied from interface: Receiver
A receiver can return an active, "done" or null delivery. The method returns null in case the receiver doesn't accept the message. The return value is unspecified when the message is submitted in the context of a transaction (tx not null).

Specified by:
handle in interface Receiver
Parameters:
observer - - the component the delivery should be acknowledged to.
See Also:
Delivery, DeliveryObserver

accept

public boolean accept(Routable r)
Description copied from interface: Filter
Tests whether the routable should be accepted.

Specified by:
accept in interface Filter
Returns:
true if the Filter accepts the routable - i.e. let's it pass.

closing

public void closing()
             throws JMSException
Description copied from interface: Closeable
Tell the instance to prepare to close

Specified by:
closing in interface Closeable
Throws:
JMSException

close

public void close()
           throws JMSException
Description copied from interface: Closeable
Close the instance

Specified by:
close in interface Closeable
Throws:
JMSException

cancelDelivery

public void cancelDelivery(long messageID)
                    throws JMSException
Specified by:
cancelDelivery in interface ConsumerEndpoint
Throws:
JMSException

cancelDeliveries

public void cancelDeliveries(java.util.List messageIDs)
                      throws JMSException
Specified by:
cancelDeliveries in interface ConsumerEndpoint
Throws:
JMSException

getMessageNow

public MessageProxy getMessageNow(boolean wait)
                           throws JMSException
We attempt to get the message directly fron the channel first. If we find one, we return that. Otherwise, if wait = true, we register as being interested in receiving a message asynchronously, then return and wait for it on the client side.

Specified by:
getMessageNow in interface ConsumerEndpoint
Throws:
JMSException

deactivate

public long deactivate()
                throws JMSException
Specified by:
deactivate in interface ConsumerEndpoint
Returns:
the last message ID delivered to the client consumer
Throws:
JMSException

activate

public void activate()
              throws JMSException
Specified by:
activate in interface ConsumerEndpoint
Throws:
JMSException

toString

public java.lang.String toString()

getDestination

public JBossDestination getDestination()

getSessionEndpoint

public ServerSessionEndpoint getSessionEndpoint()

remove

protected void remove()
               throws JMSException
Actually remove the consumer and clear up any deliveries it may have

Throws:
JMSException

acknowledgeAll

protected void acknowledgeAll()
                       throws JMSException
Throws:
JMSException

acknowledgeTransactionally

protected void acknowledgeTransactionally(long messageID,
                                          Transaction tx)
                                   throws JMSException
Throws:
JMSException

removeDelivery

protected void removeDelivery(java.lang.String messageID)
                       throws JMSException
Throws:
JMSException

cancelAllDeliveries

protected void cancelAllDeliveries()
                            throws JMSException
Throws:
JMSException

setStarted

protected void setStarted(boolean started)

promptDelivery

protected void promptDelivery()

disconnect

protected void disconnect()
Disconnect this consumer from the Channel that feeds it. This method does not clear up deliveries, except the "arrested" ones


isReady

protected boolean isReady()


Copyright © 2006 JBoss Inc. All Rights Reserved.