jersey rest web Service with Activemq middleware integration

梦想的初衷 提交于 2019-11-26 10:50:06

Have you seen the REST documentation at Apache ActiveMQ: http://activemq.apache.org/rest.html

Also are you talking about embedding ActiveMQ as a broker inside Tomcat, or do you run ActiveMQ broker in a seperate box/jvm?

As the standalone ActiveMQ has REST API out of the box, as stated in that link above.

please refer : http://java.dzone.com/articles/jms-activemq

its solve your problem just make one function for send message and incorporate that in you process where you wont.

The reason you are seeing ActiveMQ admin console while hitting rest URL due to missing credentials, Please pass credentials using basic authentication. I wrote a groovy client to call rest URL. You can use something similar....

import groovyx.net.http.HTTPBuilder;
import groovyx.net.http.Method;
import groovyx.net.http.ContentType;
import groovyx.net.http.RESTClient;
import groovyx.net.http.HttpResponseDecorator;
import groovy.json.JsonSlurper;

def headers= ["Authorization": 'Basic'   +'admin:admin'.bytes.encodeBase64().toString()];
println headers;
def restClient = new RESTClient('http://servername:8161');
def restClientResponse = restClient.get(path: '/api/message/queueName?type=queue',headers:headers,requestContentType: ContentType.JSON)
println restClientResponse.status;
println restClientResponse.headers['Content-Length'];
println restClientResponse.getData();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!