org.jboss.messaging.core
Interface Channel

All Superinterfaces:
DeliveryObserver, Distributor, Receiver
All Known Implementing Classes:
ChannelSupport

public interface Channel
extends DeliveryObserver, Receiver, Distributor

A Channel is a transactional, reliable message delivery mechanism that forwards a message from a sender to one or more receivers. The channel tries to deliver a message synchronously, if possible, and stores the message for re-delivery if synchronous delivery is not possible. A channel implementation may chose to be transactional, reliable or none of the above. A simple channel implementation may not able to accept messages/acknowledgments transactionally, and may not guarantee recoverability in case of failure. A transactional channel must be able to guarantee atomicity when accepting messages/acknowledgments. A reliable channel must be able to guarantee atomicity and recoverability in case of failure. However, recoverability is guaranteed only for reliable messages. For non-reliable message, the channel will do its best effort.

Version:
$Revision: 1.24 $ $Id: Channel.java,v 1.24 2006/06/24 09:05:38 timfox Exp $
Author:
Ovidiu Feodorov, Tim Fox

Method Summary
 boolean acceptReliableMessages()
          A non-recoverable channel cannot guarantee recoverability for reliable messages so by default it won't accept reliable messages.
 java.util.List browse()
           
 java.util.List browse(Filter filter)
           
 void close()
           
 boolean deliver()
           
 boolean deliver(Receiver receiver)
          Synchronously pushes the "oldest" message stored by the channel to the receiver.
 long getChannelID()
           
 MessageStore getMessageStore()
           
 boolean isRecoverable()
           
 
Methods inherited from interface org.jboss.messaging.core.DeliveryObserver
acknowledge, cancel
 
Methods inherited from interface org.jboss.messaging.core.Receiver
handle
 
Methods inherited from interface org.jboss.messaging.core.Distributor
add, clear, contains, iterator, remove
 

Method Detail

getChannelID

public long getChannelID()

isRecoverable

public boolean isRecoverable()
Returns:
true if the channel can guarantee recoverability for reliable messages. Recoverability is not guaranteed for non-reliable messages (and should not be provided by default, for performance reasons), even if the channel is recoverable.

acceptReliableMessages

public boolean acceptReliableMessages()
A non-recoverable channel cannot guarantee recoverability for reliable messages so by default it won't accept reliable messages. However, there are situations when discarding a reliable message is acceptable for a specific instance of a channel, so it should be a way to configure the channel to do so. A channel indicates unequivocally whether it accepts reliable messages or not returning true or false as result of this method. A recoverable channel must always accept reliable messages, so this method must always return true for a recoverable channel.

Returns:
false if the channel doesn't accept reliable messages.
See Also:
State.acceptReliableMessages()

browse

public java.util.List browse()
Returns:
a List containing messages being held by the channel. The list includes messages in process of being delivered and messages for which delivery hasn't been attempted yet.

browse

public java.util.List browse(Filter filter)
See Also:
browse()

getMessageStore

public MessageStore getMessageStore()

deliver

public boolean deliver(Receiver receiver)
Synchronously pushes the "oldest" message stored by the channel to the receiver. If receiver is null, it delivers the message to the first available receiver.

Returns:
true if a message was handed over to the receiver and the channel got a delivery in exchange, or false otherwise.

deliver

public boolean deliver()

close

public void close()


Copyright © 2006 JBoss Inc. All Rights Reserved.