I do it by adding them to the URI in the POST request's start-line.  
For example, here is some debug output from my app:

            131203 12:26:48 DEBUG Executing POST request.
            131203 12:26:48 DEBUG >>> POST 
/api/message?destination=requestq&type=queue&clientId=80BDF909-EF88-4F53-91CA-73D0E1637825&JMSPriority=2&JMSTimeToLive=15000&JMSCorrelationID=ABCdef&CorrelationID=ABCdef
 HTTP/1.1
            131203 12:26:48 DEBUG >>> Content-Type: text/xml; 
charset=windows-1252
            131203 12:26:48 DEBUG >>> Content-Length: 18
            131203 12:26:48 DEBUG >>> Host: localhost:8161
            131203 12:26:48 DEBUG >>> Accept: */*
            131203 12:26:48 DEBUG >>> Authorization: Basic ****************
            131203 12:26:48 DEBUG >>> User-Agent: SAS/9
            131203 12:26:48 DEBUG >>>
            131203 12:26:48 DEBUG <<< HTTP/1.1 200 OK
            131203 12:26:48 DEBUG <<< messageID: 
ID:d77423-58463-1386090271156-3:7:1:1:1
            131203 12:26:48 DEBUG <<< Content-Length: 12
            131203 12:26:48 DEBUG <<< Server: Jetty(7.6.9.v20130131)
            131203 12:26:48 DEBUG <<<
            131203 12:26:48 DEBUG Request POST returns status 200.

In the above example, you may wonder why I added a "CorrelationID" property in 
addition to "JMSCorrelationID".  I do that because when GETting messages using 
ActiveMQ's REST API, the ActiveMQ broker does *NOT* provide the correlation ID 
header field as an HTTP header.  I view that as a significant short-coming and 
entered Jira AMQ-4072<https://issues.apache.org/jira/browse/AMQ-4072> back on 
24Sep2012, but that Jira was closed because I didn't provide any test cases or 
a patch.

        Since the MessageServlet does create HTTP headers for message 
*properties*, I have my app specifically look for either an HTTP header named 
JMSCorrelationID or CorrelationID.  That enables my app to use the REST API to 
select based on correlation ID only if the messages contain a "CorrelationID" 
*property*.  Remember, the ActiveMQ's MessageServlet does not add an HTTP 
header line for the message's JMSCorrelationID header field.  I would love to 
see this fixed so I don't have to tell customers to provide both when putting 
messages on the queue with some client other than mine.

Cheers,
sv

sasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasas
Stephen Vincent
Platform R&D
Tel: + 1 919 531 7556
stephen.vinc...@sas.com

-----Original Message-----
From: alterego [mailto:alter11...@gmail.com]
Sent: Tuesday, December 03, 2013 2:20 AM
To: users@activemq.apache.org
Subject: ActiveMQ: REST API and JMS Headers

Hello,

When putting messages to ActiveMQ via the RESTful API (see for example 
http://activemq.apache.org/rest.html), how am I able to set the JMS Headers 
such as Correlation Id, Priority, ReplyToQueue, Expiry, etc?  Can someone 
please let me know or point me to the appropriate resource?

Note that the sender is not a Java application.


Thanks.



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMQ-REST-API-and-JMS-Headers-tp4675015.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Reply via email to