如何使用 curl 命令在 activemq 主题中发布消息?

kum*_*mar 2 java curl activemq-classic

如何在 ActiveMQ 主题中使用 发布消息curl?我试过:

curl -XPOST -d "body=message" http://admin:admin@localhost:8161/api/message?destination=queue://orders.input
Run Code Online (Sandbox Code Playgroud)

但响应是未经授权的用户 401。

eeb*_*sen 5

Per the ActiveMQ documentation both of the following worked for me:

curl -XPOST -u admin:admin -d "body=message" http://localhost:8161/api/message/orders.input?type=queue

curl -XPOST -d "body=message with alt syntax" http://admin:admin@localhost:8161/api/message?destination=queue://orders.input
Run Code Online (Sandbox Code Playgroud)

Are you able to log into the web interface and view the queues using the credentials admin/admin? Try to view http://localhost:8161/admin/queues.jsp to confirm.