How to create listner REST consumer in ActiveMQ

我的梦境 提交于 2020-02-25 05:35:17

问题


I have created ActiveMQ consumer as follow in order consume queued item

but my problem is how can I keep checking on this queue since content publishing to this perticular queue can happen anytime but I can't keep listening to the queue since I'm using rest client GET method(HTTP) (NOT jms TCP connection), using infinite loop is no solution for me. Is there any out of the box solution for this other than custom solution within the ActiveMQ rest inteface

PropertyResourceBundle prop = CommonUtils.getInstance().getProperties();
String serverUrl = prop.getString("spring.activemq.server-url");
String userName = prop.getString("spring.activemq.user");
String password = prop.getString("spring.activemq.password");

String url = serverUrl + "/api/message?destination=queue:

RestClient client = new RestClient(userName, password);
String activeMQResponse = client.get(url);
System.out.println(activeMQResponse);

来源:https://stackoverflow.com/questions/40865735/how-to-create-listner-rest-consumer-in-activemq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!