ActiveMQ: consumer / producer implement different

2019-09-18 02:52发布

问题:

I am getting into Message Queueing recently (with ActiveMQ) and experimenting.

So far I have been able to set up one producer with 2 consumers written in Java implementing JMS over Tcp. The producer sends 2 types of messages to the queue in ActiveMQ, while at the other end, 2 consumers from a different machine pick up the messages based on the message properties.

My question was:

  • Does the consumer/producer need to implement the same protocol, or
    Would it be possible to have a producer send messages to the Queue with JMS and have a client (like node js) use another protocol (like AMQP) and collect messages from the same queue?

Thank you for your advice,

回答1:

Probably the answer to your question is documented at Oracle's JMS as a MOM Standard:

It’s important to note that JMS is an API standard, not a protocol standard. Because all JMS clients implement the same interface, it is easy to port one vendor's clinet to another vendor's JMS provide implementation. But different JMS vendors typically cannot communicate directly with one another.



回答2:

ActiveMQ implements the standard JMS client library using it's own protocol (OpenWire) however it also supports several other protocols allowing you to connect from other client like an MQTT client, STOMP client or an AMQP client and consume / produce from a Queue.

To see how to use AMQP for instance refer to the ActiveMQ docs and for best results use the latest release of ActiveMQ.