org.apache.qpid.server.exchange
Class HeadersExchange

java.lang.Object
  extended by org.apache.qpid.server.exchange.AbstractExchange
      extended by org.apache.qpid.server.exchange.HeadersExchange
All Implemented Interfaces:
Exchange, Managable

public class HeadersExchange
extends AbstractExchange

An exchange that binds queues based on a set of required headers and header values and routes messages to these queues by matching the headers of the message against those with which the queues were bound.

 The Headers Exchange

  Routes messages according to the value/presence of fields in the message header table.
  (Basic and JMS content has a content header field called "headers" that is a table of
   message header fields).

  class = "headers"
  routing key is not used

  Has the following binding arguments:

  the X-match field - if "all", does an AND match (used for GRM), if "any", does an OR match.
  other fields prefixed with "X-" are ignored (and generate a console warning message).
  a field with no value or empty value indicates a match on presence only.
  a field with a value indicates match on field presence and specific value.

  Standard instances:

  amq.match - pub/sub on field content/value
  


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.server.exchange.AbstractExchange
AbstractExchange.ExchangeMBean
 
Field Summary
 
Fields inherited from class org.apache.qpid.server.exchange.AbstractExchange
_autoDelete, _durable, _exchangeMbean, _ticket
 
Constructor Summary
HeadersExchange()
           
 
Method Summary
protected  AbstractExchange.ExchangeMBean createMBean()
          Concrete exchanges must implement this method in order to create the managed representation.
 void deregisterQueue(java.lang.String routingKey, AMQQueue queue)
           
protected  java.util.Map getHeaders(org.apache.qpid.framing.ContentHeaderBody contentHeaderFrame)
           
 void registerQueue(java.lang.String routingKey, AMQQueue queue, org.apache.qpid.framing.FieldTable args)
           
 void route(AMQMessage payload)
           
 
Methods inherited from class org.apache.qpid.server.exchange.AbstractExchange
close, getManagedObject, getName, getTicket, initialise, isAutoDelete, isDurable, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HeadersExchange

public HeadersExchange()
Method Detail

registerQueue

public void registerQueue(java.lang.String routingKey,
                          AMQQueue queue,
                          org.apache.qpid.framing.FieldTable args)
                   throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

deregisterQueue

public void deregisterQueue(java.lang.String routingKey,
                            AMQQueue queue)
                     throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

route

public void route(AMQMessage payload)
           throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

getHeaders

protected java.util.Map getHeaders(org.apache.qpid.framing.ContentHeaderBody contentHeaderFrame)

createMBean

protected AbstractExchange.ExchangeMBean createMBean()
                                              throws org.apache.qpid.AMQException
Description copied from class: AbstractExchange
Concrete exchanges must implement this method in order to create the managed representation. This is called during initialisation (template method pattern).

Specified by:
createMBean in class AbstractExchange
Returns:
the MBean
Throws:
org.apache.qpid.AMQException