-
Notifications
You must be signed in to change notification settings - Fork 13
Async Message Queue
Yair Ogen edited this page May 15, 2014
·
23 revisions
Foundation Communication supports a simple API that exposes API or async messaging. Although JMS being a standard we've found that many times other vendors can do better. Many such vendors are not JMS Compliant (like RabbitMQ) or have a richer non-jms API (like HornetQ core).
Following is an explanation on how to use and configure the Queue API.
The Main building blocks are:
- Message - Basic message POJO.
- MessageConsumer - basic interface that defines API available for message consumers.
- MessageProducer - basic interface that defines API available for message producers.
- HornetQMessagingFactory - This is the main API tp be used to instantiate new consumers and producers. This class supports a Per Thread lifecycle for HornetQ session, consumers and producers
final MessageProducer producer = HornetQMessagingFactory.createProducer("example");
producer.sendMessage("hello world!");
//optionally send message properties
Map<String,Object> props = new HashMap<String,Object>();
props.put("key1","value2");
producer.sendMessage("hello world!",props);
}