org.jboss.messaging.core
Interface Channel

All Superinterfaces:
DeliveryObserver, Distributor, Receiver
All Known Subinterfaces:
ClusteredQueue, Queue
All Known Implementing Classes:
ChannelSupport, LocalClusteredQueue, PagingFilteredQueue, RemoteQueueStub

public interface Channel
extends DeliveryObserver, Distributor, Receiver

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: 2386 $ $Id: Channel.java 2386 2007-02-21 18:07:44Z timfox $
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.
 void activate()
           
 java.util.List browse()
           
 java.util.List browse(Filter filter)
           
 void clear()
          Clears non-recoverable state but not persisted state, so a recovery of the channel is possible TODO really?
 void close()
          Close the channel
 void deactivate()
           
 void deliver()
          Delivers as many references as possible to its router until no more deliveries are returned.
 long getChannelID()
           
 int getDeliveringCount()
           
 int getMaxSize()
           
 int getMessageCount()
           
 int getMessagesAdded()
           
 int getScheduledCount()
          Count scheduled for delivery
 boolean isActive()
           
 boolean isRecoverable()
           
 void load()
           
 java.util.List recoverDeliveries(java.util.List messageIds)
           
 void removeAllReferences()
          Remove all the references in the channel
 void setMaxSize(int newSize)
           
 void unload()
           
 
Methods inherited from interface org.jboss.messaging.core.DeliveryObserver
acknowledge, cancel
 
Methods inherited from interface org.jboss.messaging.core.Distributor
add, contains, getNumberOfReceivers, iterator, remove
 
Methods inherited from interface org.jboss.messaging.core.Receiver
handle
 

Method Detail

getChannelID

public long getChannelID()
Returns:
the unique ID of the channel

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.

browse

public java.util.List browse()
Returns:
a List containing messages being held by the channel.

browse

public java.util.List browse(Filter filter)
Parameters:
filter - - may be null, in which case no filter is applied.
Returns:
a List containing message references of messages whose state is maintained by this State instance.

deliver

public void deliver()
Delivers as many references as possible to its router until no more deliveries are returned.


close

public void close()
Close the channel


clear

public void clear()
Clears non-recoverable state but not persisted state, so a recovery of the channel is possible TODO really?

Specified by:
clear in interface Distributor

getMessageCount

public int getMessageCount()
Returns:
Total message count = undelivered + delivering + scheduled

getDeliveringCount

public int getDeliveringCount()
Returns:
Count being delivered

getScheduledCount

public int getScheduledCount()
Count scheduled for delivery


removeAllReferences

public void removeAllReferences()
                         throws java.lang.Throwable
Remove all the references in the channel

Throws:
java.lang.Throwable

load

public void load()
          throws java.lang.Exception
Throws:
java.lang.Exception

unload

public void unload()
            throws java.lang.Exception
Throws:
java.lang.Exception

activate

public void activate()

deactivate

public void deactivate()

isActive

public boolean isActive()

recoverDeliveries

public java.util.List recoverDeliveries(java.util.List messageIds)

getMaxSize

public int getMaxSize()

setMaxSize

public void setMaxSize(int newSize)

getMessagesAdded

public int getMessagesAdded()


Copyright © 2006 JBoss Inc. All Rights Reserved.