Bridge JMS (MQ) to Restful services.
Annotation based MQ adapter, alternative of wmq resouce adaptor.
<dependency>
<groupId>com.cheeray</groupId>
<artifactId>jms-rest</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
JMS_UTIL_WAIT_INTERVAL: Timeout of reading a message, default is 1000, set to 0 will be waiting unlimitedly.
JMS_UTIL_RETRY_INTERVAL: Interval to retry connection, default is 10000.
JMS_UTIL_SLEEP_INTERVAL: Interval to wait for new message, default is 100ms.
/**Annotate the class with @MAware and the method that consuming a string message with @MConsumer, for example:*/
@MAware
public class Consumer {
...
@MConsumer({ @MQueue(channel = "CLIENT.MQ.CHANNEL", host = "MQ_HOST",
manager = "MQ_MANAGER", port = 3434, queue = "MQ.QUEUE.IN") })
public void onInbound(String msg) throws InterruptedException {
// TODO: process the string message.
}
...
}
/**Annotate the class with @MAware and the method that consuming a string message with @MProducer, for example:*/
@MAware
public class Producer {
...
@MProducer(value = { @MQueue(channel = "CLIENT.MQ.CHANNEL",
host = "MQ_HOST", manager = "MQ_MANAGER", port = 3434,
queue = "MQ.QUEUE.IN") }, backouts = { @MQueue(
channel = "CLIENT.MQ.CHANNEL.BO", host = "MQ_HOST_BO",
manager = "MQ_MANAGER_BO", port = 3434, queue = "MQ.QUEUE.IN.BO") })
public String send(...) throws InterruptedException {
// TODO: process the string message.
}
...
}
Before CDI 1.2, producer is not auto intercepted, see http://docs.jboss.org/weld/reference/latest/en-US/html_single/#_enabling_interceptors.
Alternatively, a DispatchEvent can be fired inside the producing method to send the message directly.
Setting | Description
----------|----------
host | MQ host
port | MQ port
channel | MQ channel
manager | MQ manager
queues | Queue names
threads | Number of threads to run
Setting | Description
----------|-------------
scheme |HTTP scheme
server |RESTful server
port |Listen/Pubish port
context |RESTful service context
Set “JMS_REST_LOG_DIR” to the directory for logs. Default is “/var/log/jms-rest” and “bridge.log” is the log file.
Apache License Version 2.0