Package org.ow2.joram.mom.amqp
Class HeadersExchange
- java.lang.Object
-
- org.ow2.joram.mom.amqp.IExchange
-
- org.ow2.joram.mom.amqp.HeadersExchange
-
- All Implemented Interfaces:
Externalizable,Serializable,IExchangeMBean
public class HeadersExchange extends IExchange
The headers exchange type works as follows:- 1. A message queue is bound to the exchange with a table of arguments containing the headers to be matched for that binding and optionally the values they should hold. The routing key is not used.
- 2. A publisher sends a message to the exchange where the 'headers' property contains a table of names and values.
- 3. The message is passed to the queue if the headers property matches the arguments with which the queue was bound.
It can take one of two values, dictating how the rest of the name value pairs in the table are treated during matching:- (i) 'all' implies that all the other pairs must match the headers property of a message for that message to be routed (i.e. and AND match)
- (ii) 'any' implies that the message should be routed if any of the fields in the headers property match one of the fields in the arguments table (i.e. an OR match)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Map<Map<String,Object>,Set<String>>bindingsstatic StringDEFAULT_NAMEprivate static longserialVersionUIDdefine serialVersionUID for interoperabilitystatic StringTYPE-
Fields inherited from class org.ow2.joram.mom.amqp.IExchange
DEFAULT_EXCHANGE_NAME, durable, logger, name, PREFIX_EXCHANGE
-
-
Constructor Summary
Constructors Constructor Description HeadersExchange()HeadersExchange(String name, boolean durable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(String queueName, String routingKey, Map<String,Object> arguments)voiddoPublish(String routingKey, boolean mandatory, boolean immediate, AMQP.Basic.BasicProperties properties, byte[] body, int channelNumber, short serverId, long proxyId)Set<String>getBoundQueues()StringgetType()booleanisUnused()voidreadExternal(ObjectInput in)voidremoveQueueBindings(String queueName)voidsetArguments(Map<String,Object> arguments)voidunbind(String queueName, String routingKey, Map<String,Object> arguments)voidwriteExternal(ObjectOutput out)-
Methods inherited from class org.ow2.joram.mom.amqp.IExchange
checkPublication, createExchange, deleteExchange, getHandledMessageCount, getName, getPublishedMessageCount, isDurable, loadExchange, publish, publishToQueue, saveExchange
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
DEFAULT_NAME
public static final String DEFAULT_NAME
- See Also:
- Constant Field Values
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HeadersExchange
public HeadersExchange()
-
HeadersExchange
public HeadersExchange(String name, boolean durable)
-
-
Method Detail
-
unbind
public void unbind(String queueName, String routingKey, Map<String,Object> arguments) throws NotFoundException
- Specified by:
unbindin classIExchange- Throws:
NotFoundException
-
doPublish
public void doPublish(String routingKey, boolean mandatory, boolean immediate, AMQP.Basic.BasicProperties properties, byte[] body, int channelNumber, short serverId, long proxyId) throws NoConsumersException, NotFoundException, TransactionException
- Specified by:
doPublishin classIExchange- Throws:
NoConsumersExceptionNotFoundExceptionTransactionException
-
setArguments
public void setArguments(Map<String,Object> arguments)
- Specified by:
setArgumentsin classIExchange
-
getType
public String getType()
-
removeQueueBindings
public void removeQueueBindings(String queueName)
- Specified by:
removeQueueBindingsin classIExchange
-
getBoundQueues
public Set<String> getBoundQueues()
- Specified by:
getBoundQueuesin interfaceIExchangeMBean- Specified by:
getBoundQueuesin classIExchange
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Overrides:
writeExternalin classIExchange- Parameters:
out-- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classIExchange- Parameters:
in-- Throws:
IOExceptionClassNotFoundException
-
-