hello activemq,
i am using amq 5.15.9 and want to consume messages using the REST API. i
am hitting the issue described in the documentation @
https://activemq.apache.org/rest
"When consuming messages using the REST API, you have to keep session
alive between GET requests, or you’ll create a separate consumer for
every request and due to prefetch limit your succeeding call will hang."
I wrote my consumer in Java 8 using
org.springframework.web.client.RestTemplate
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getAuthorizationHeader());
headers.set("Connection", "Keep-Alive");
HttpEntity<String> request = new HttpEntity<String>("", headers);
ResponseEntity<String> response =
restTemplate.exchange(
"http://localhost:8161/api/message/quote?type=queue",
HttpMethod.GET,
request,
String.class);
and getting a successful consume on first request and hanging request
from then on with 204 response after a long wait...
can someone please share an example of working Java consumer using the
REST API? I does not matter if based on RestTemplate or other tool for
HTTP client requests.
Thanks much in advance.
Luigi