17

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

enter image description here

Raghunandan J
  • 584
  • 1
  • 6
  • 22

5 Answers5

11

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
NiranjanK
  • 427
  • 2
  • 6
  • 23
  • Do you know what request does this build? I'm trying to build request in Rest Client for VS code and I don't know how to pass those properties. – Piotr Perak Jan 16 '19 at 15:08
  • The correct endpoint URI is `http://admin:admin@:8161/api/message?destination=://`. This indeed allows to provide additional JMS properties. – Dimitri Hautot May 25 '21 at 07:40
  • To be more precise, the `destination`JMS property can be provided in the URI or as form data (your choice), but the trailing `/api/message` in the URI is mandatory. – Dimitri Hautot May 25 '21 at 16:10
9

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
JRichardsz
  • 14,356
  • 6
  • 59
  • 94
4

You cannot, the console provides very limited message send facilities. If you want to send full blown messages then use a JMS client.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
3

A "hacky way" is to use your browser's developer tools to insert a hidden field in the "sendMessage.action". The name of the new hidden field should be the name of the custom header that you want to send.

For example, in Chrome,

  1. Right-click the section header named "Send a JMS Message" and select "Inspect" for the menu that pops up
  2. You will see the <form> element right below the selected element
  3. Click on the 3 dots to the left of the first <input type="hidden".../> element and duplicate it

enter image description here

  1. On the duplicate <input type="hidden".../> change the name to contain the value of your customer header name and in the value attribute set the desired value of the header

enter image description here

  1. Now when you click the "Send" button, the custom header will be part of the message
tfarooqi
  • 49
  • 6
  • This worked for me. I have long json body , so this is better than curl for me as I don't have to deal with formatting the json to use with curl on command line . – ViratKohli Nov 15 '22 at 14:57
1

You can use an application like JMSToolBox

titou10
  • 2,814
  • 1
  • 19
  • 42