Package org.ow2.joram.mom.amqp
Class TopicExchange
- java.lang.Object
-
- org.ow2.joram.mom.amqp.IExchange
-
- org.ow2.joram.mom.amqp.TopicExchange
-
- All Implemented Interfaces:
Externalizable,Serializable,IExchangeMBean
public class TopicExchange extends IExchange
The topic exchange type works as follows:- 1. A message queue binds to the exchange using a routing pattern, P.
- 2. A publisher sends the exchange a message with the routing key R.
- 3. The message is passed to the message queue if R matches P.
The routing pattern follows the same rules as the routing key with the addition that * matches a single word, and # matches zero or more words. Thus the routing pattern *.stock.# matches the routing keys usd.stock and eur.stock.db but not stock.nasdaq.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classTopicExchange.KeyAndPatternClass used to keep trace of the key which leads to the pattern.
-
Field Summary
Fields Modifier and Type Field Description private Map<TopicExchange.KeyAndPattern,Set<String>>bindingsstatic StringDEFAULT_NAMEstatic Loggerloggerprivate static longserialVersionUIDdefine serialVersionUID for interoperabilitystatic StringTYPE-
Fields inherited from class org.ow2.joram.mom.amqp.IExchange
DEFAULT_EXCHANGE_NAME, durable, name, PREFIX_EXCHANGE
-
-
Constructor Summary
Constructors Constructor Description TopicExchange()TopicExchange(String name, boolean durable)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(String queueName, String routingKey, Map<String,Object> arguments)private static PatterncreatePattern(String routingPattern)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
-
logger
public static final Logger logger
-
DEFAULT_NAME
public static final String DEFAULT_NAME
- See Also:
- Constant Field Values
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
bindings
private Map<TopicExchange.KeyAndPattern,Set<String>> bindings
-
-
Constructor Detail
-
TopicExchange
public TopicExchange()
-
TopicExchange
public TopicExchange(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
-
-