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:
ConfiguredObject<ExchangeConfigType,ExchangeConfig>, ExchangeConfig, Exchange, ExchangeReferrer, 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 interface org.apache.qpid.server.exchange.Exchange
Exchange.BindingListener, Exchange.Task
 
Field Summary
static ExchangeType<HeadersExchange> TYPE
           
 
Fields inherited from class org.apache.qpid.server.exchange.AbstractExchange
_autoDelete, _durable, _exchangeMbean, _ticket
 
Constructor Summary
HeadersExchange()
           
 
Method Summary
protected  AbstractExchangeMBean createMBean()
          Concrete exchanges must implement this method in order to create the managed representation.
 ArrayList<BaseQueue> doRoute(InboundMessage payload)
           
 org.apache.log4j.Logger getLogger()
           
 boolean hasBindings()
          Returns true if this exchange has at least one binding associated with it.
 boolean isBound(AMQQueue queue)
           
 boolean isBound(org.apache.qpid.framing.AMQShortString routingKey)
          Determines whether a message is routing to any queue using a specific _routing key
 boolean isBound(org.apache.qpid.framing.AMQShortString routingKey, AMQQueue queue)
          Determines whether a message would be isBound to a particular queue using a specific routing key
 boolean isBound(org.apache.qpid.framing.AMQShortString routingKey, org.apache.qpid.framing.FieldTable arguments, AMQQueue queue)
          Determines whether a message would be isBound to a particular queue using a specific routing key and arguments
protected  void onBind(Binding binding)
           
protected  void onUnbind(Binding binding)
           
 
Methods inherited from class org.apache.qpid.server.exchange.AbstractExchange
addBinding, addBindingListener, addCloseTask, addReference, close, getAlternateExchange, getArguments, getBindingCount, getBindingCountHigh, getBindings, getByteReceives, getByteRoutes, getConfigStore, getConfigType, getCreateTime, getId, getManagedObject, getMsgReceives, getMsgRoutes, getName, getNameShortString, getParent, getQueueRegistry, getTicket, getType, getTypeShortString, getVirtualHost, hasReferrers, initialise, isAutoDelete, isBound, isBound, isBound, isDurable, removeBinding, removeBindingListener, removeCloseTask, removeReference, route, setAlternateExchange, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final ExchangeType<HeadersExchange> TYPE
Constructor Detail

HeadersExchange

public HeadersExchange()
Method Detail

doRoute

public ArrayList<BaseQueue> doRoute(InboundMessage payload)
Specified by:
doRoute in class AbstractExchange

isBound

public boolean isBound(org.apache.qpid.framing.AMQShortString routingKey,
                       org.apache.qpid.framing.FieldTable arguments,
                       AMQQueue queue)
Description copied from interface: Exchange
Determines whether a message would be isBound to a particular queue using a specific routing key and arguments

Returns:

isBound

public boolean isBound(org.apache.qpid.framing.AMQShortString routingKey,
                       AMQQueue queue)
Description copied from interface: Exchange
Determines whether a message would be isBound to a particular queue using a specific routing key

Returns:

isBound

public boolean isBound(org.apache.qpid.framing.AMQShortString routingKey)
Description copied from interface: Exchange
Determines whether a message is routing to any queue using a specific _routing key

Returns:

isBound

public boolean isBound(AMQQueue queue)

hasBindings

public boolean hasBindings()
Description copied from interface: Exchange
Returns true if this exchange has at least one binding associated with it.

Returns:

createMBean

protected AbstractExchangeMBean createMBean()
                                     throws JMException
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:
JMException

getLogger

public org.apache.log4j.Logger getLogger()
Specified by:
getLogger in class AbstractExchange

onBind

protected void onBind(Binding binding)
Specified by:
onBind in class AbstractExchange

onUnbind

protected void onUnbind(Binding binding)
Specified by:
onUnbind in class AbstractExchange


Licensed to the Apache Software Foundation