Is there any working source code example of Spring AMQP + ActiveMQ (sender + receiver) without any reliance on the JMS API?
Note: The reason for this question is because Spring already lists JMS as a deprecated transport protocol for remoting (only AMQP and web-service calls are still actively supported).
As noted on the Spring AMQP GitHub project page:
This project provides support for using Spring and Java with AMQP 0.9.1, and in particular RabbitMQ.
ActiveMQ (both classic and Artemis) supports AMQP 1.0 (standardized by ISO) and not 0.9.1 (not standardized). Therefore you can't use Spring AMQP with ActiveMQ. The Spring AMQP project is really only useful for integrating with RabbitMQ.
Related
Is there any way to check the version (1.0 or 0.9.1) of AMQP that is being used by ActiveMQ. I'm using ActiveMQ 5.16.3.
In the RabbitMQ console there is a way to view the version of AMQP protocol that is being connected. I want to check if there are any ways to verify the version of AMQP protocol that is being connected in the ActiveMQ web console.
ActiveMQ "Classic" (i.e. 5.x) only supports AMQP 1.0. See the documentation for more details.
There is no way to see the protocol version in the web console and really no need since only AMQP 1.0 is supported.
I use rabbitmq in production and QPid in integration tests. I need to write integration test which verify that return channel is called for unroutable messages. I set mandatory=true and unbind queue and exchange, however nack channel is called (NackedAmqpMessageException is thrown) instead of return channel. Return channel is never called.
I use Spring AMQP with Spring Boot + Spring Integration. How can I produce return channel case in tests?
I use the versions:
Qpid 7.1.4
Amqp client 5.4.3
Spring Integration 5.1.9
Spring Boot 2.1.2
Thank you.
Is there a confirmation that QPid supports Publisher Confirms: https://www.rabbitmq.com/confirms.html#publisher-confirms ? To be honest we recommend to use RabbitMQ even for tests. See our recent sample how to do that with Testcontaniers: https://github.com/spring-projects/spring-integration-samples/tree/master/intermediate/testcontainers-rabbitmq
I successfully completed a POC using Spring Reactor Netty Stomp client (Spring messaging framework) to connect to RabbitMQ on port 61613 (port dedicated for STOMP). That was just a POC. Now I have to build something concrete to be able to deploy in prod environments. I was Googling Spring Messaging vs Spring Integration and stumbled upon Apache Camel.
RabbitMQ component page in the Camel documentation talks about port 5672 and that is AMQP. The STOMP component page talks about ActiveMQ.
I did not see any examples or documentation regarding Camel in conjunction with RabbitMQ and STOMP.
Can Apache Camel be used to connect to RabbitMQ on port 61613?
The Camel documentation for the STOMP component states:
The Stomp component is used for communicating with Stomp compliant message brokers, like Apache ActiveMQ or ActiveMQ Apollo.
Notice that it says like Apache ActiveMQ. It doesn't say it has to be Apache ActiveMQ. It just uses ActiveMQ as an example of a "Stomp compliant" message broker. If RabbitMQ supports STOMP then Camel's STOMP component should work without issue.
Looking at Camel's StompEndpoint it clearly uses the brokerURL from the configuration to make the connection to the Stomp broker. It uses the Fusesource Stomp client implementation which should work with any Stomp compliant broker.
It's also worth noting that Camel is an integration framework and Stomp is a simple, open messaging protocol so it doesn't make much sense for the Stomp component within Camel to only work with a couple of ActiveMQ brokers. It can (and will) work with any Stomp compliant broker (just as the documentation states).
I am new to the MOM.
I want to connect to ActiveMQ using AMQP from my application.
Also I want to use Spring Integration for connecting to the ActiveMq.
I see example of AMQP for rabbitMQ but I am not able to find any example for ActiveMq.
Is it not possible to do with Spring Integration ?
No, it isn't possible.
ActiveMQ supports the AMQP 1.0 protocol which is an OASIS standard.
Where RabbitMQ and hence Spring Integration AMQP adapters support 0.9.1.
Those Spec versions are very different.
You should try tu use ActiveMQ JMS API over its AMQP. And finally Spring Integration JMS adapters.
RabbitMQ supports multiple protocols, AMQP, MQTT, STOMP, ....
When using PHP for example, it's easier to publish using the STOMP library since the PHP AMQP libraries requires compiled C code and is somewhat of a mission to setup if you don't have to.
On the JAVA side, apache camel with AMQP on spring is pretty straight forward.
Is it possible to setup a queue, publish to it via STOMP and then consume via AMQP and then again publish via AMQP and consume via STOMP if the message broker is RabbitMQ?
Yes, this should work, given that you have installed RabbitMQ's STOMP plugin on your RabbitMQ node(s).
The protocol only defines the communication between client and server and has no impact on a message itself.
You should note that using protocols other than AMQP will most likely come along with limitations and/or worse performance.
There also exist native PHP libraries for RabbitMQ that don't require compiling C code. Unfortunately, I cannot tell you which one is the best, because I am a Java guy ;-).