Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send message headers (properties) for a message in active mq web console localhost:8161?

I searched a lot in web, couldn't find any answers.

enter image description here

like image 287
Raghunandan J Avatar asked Aug 09 '17 10:08

Raghunandan J


People also ask

How do I send a message using ActiveMQ console?

If you click on the Send URL on the header menu, you'll need to manually enter the name of your queue or topic. The header to store the counter is automatically set to JMSXMessageCounter. Your message will go into Message body text area, after that you can just click Send.

How do I move messages from one queue to another in ActiveMQ?

Using file systemSave messages to a file. Go to the target queue. Load messages from file. Go back to source queue.


2 Answers

Activemq console can not be used in this case but you can use the curl command to send messages with header which exposes the api's of web console. Please refer below link:

ActiveMQ Rest

For example, using below command , uses the proerties "key=2dffvdfbfd"

curl -XPOST -d "body=Test message" -d "key=2dffvdfbfd" http://admin:admin@<brokerIp>:8161
like image 68
NiranjanK Avatar answered Nov 16 '22 07:11

NiranjanK


Web console does not allow to send custom jms header or properties.

So, you need to use the rest api:

http://activemq.apache.org/rest.html

The following curl worked for me:

  • activemq 5.14.x
  • queue name = avenger_tasks
  • body message = {'a': 'b'}
  • jms header name = JMSCorrelationID
  • jms header value = 9999
    curl -H 'Authorization: Basic YWabcdefg==' \
    -d "body={'a': 'b'}"  \
    -d "JMSCorrelationID=9999" \
    -d "JMSReplyTo=NickFury"   \
    -d "SomeProperty=SomeValue"   \
    http://localhost:8161/api/message/avenger_tasks?type=queue

Or with user and password

    curl -u admin:admin \
    -d "body={'a': 'b'}"  \
    -d "JMSCorrelationID=9999" \
    -d "JMSReplyTo=NickFury"   \
    -d "SomeProperty=SomeValue"   \
    http://localhost:8161/api/message/avenger_tasks?type=queue
like image 7
JRichardsz Avatar answered Nov 16 '22 07:11

JRichardsz