org.jboss.messaging.core.plugin.contract
Interface PostOffice

All Superinterfaces:
MessagingComponent
All Known Subinterfaces:
ClusteredPostOffice
All Known Implementing Classes:
DefaultClusteredPostOffice, DefaultPostOffice

public interface PostOffice
extends MessagingComponent

A PostOffice A post office holds bindings of queues to conditions. When routing a reference, the post office routes the reference to any binding whose condition matches the condition specified in the call to route(...) Currently we only support conditions where the condition is an exact text match, and there is a single binding per queue.

Version:
$Revision: 2202 $ $Id: PostOffice.java 2202 2007-02-08 10:50:26Z timfox $
Author:
Tim Fox, Clebert Suconic, Ovidiu Feodorov

Method Summary
 Binding bindQueue(Condition condition, Queue queue)
           
 Binding getBindingforChannelId(long channelId)
           
 Binding getBindingForQueueName(java.lang.String queueName)
          Get the binding for the specified queue name.
 java.util.Collection getBindingsForCondition(Condition condition)
          List the bindings that match the specified condition
 java.lang.String getOfficeName()
           
 boolean isLocal()
           
 boolean route(MessageReference ref, Condition condition, Transaction tx)
          Route a reference.
 Binding unbindQueue(java.lang.String queueName)
           
 
Methods inherited from interface org.jboss.messaging.core.plugin.contract.MessagingComponent
start, stop
 

Method Detail

getOfficeName

public java.lang.String getOfficeName()

bindQueue

public Binding bindQueue(Condition condition,
                         Queue queue)
                  throws java.lang.Exception
Throws:
java.lang.Exception

unbindQueue

public Binding unbindQueue(java.lang.String queueName)
                    throws java.lang.Throwable
Throws:
java.lang.Throwable

getBindingsForCondition

public java.util.Collection getBindingsForCondition(Condition condition)
                                             throws java.lang.Exception
List the bindings that match the specified condition

Throws:
java.lang.Exception

getBindingForQueueName

public Binding getBindingForQueueName(java.lang.String queueName)
                               throws java.lang.Exception
Get the binding for the specified queue name.

Throws:
java.lang.Exception

route

public boolean route(MessageReference ref,
                     Condition condition,
                     Transaction tx)
              throws java.lang.Exception
Route a reference.

Parameters:
condition - - the message will be routed to a queue if specified condition matches the condition of the binding.
tx - - the transaction or null if not in the context of a transaction.
Returns:
true if reference was accepted by at least one queue.
Throws:
java.lang.Exception

isLocal

public boolean isLocal()
Returns:
true if it is a non clustered post office

getBindingforChannelId

public Binding getBindingforChannelId(long channelId)
                               throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2006 JBoss Inc. All Rights Reserved.