How to produce basic.return with QPid - rabbitmq

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

Related

Code example of Spring AMQP + ActiveMQ without reliance on JMS API

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.

ActiveMQ Artemis read messages without consuming it in JMeter

I want to know if it is possible to read queue messages in ActiveMQ Artemis without consuming or removing it using JMeter.
I have find similar question Here. But I really don't know how to configure it in JMeter. I'm new in it.
In a normal JMS client you'd do this using a QueueBrowser. However, JMeter doesn't support this. It only supports:
JMS Publisher
JMS Subscriber
JMS Point-to-Point

Does spring integration support AMQP with ActiveMq

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.

ActiveMQ, STOMP, Java example

Can anyone point me to decent example where Java stomp client is used to connect to ActiveMQ.
Also I am interested in following:
Is failover supported over stomp?
How to create durable subscription?
Does stomp support asynchronous messaging? Examples? I think I have to implement MessageListener interface for it, but I wasn't able to find example for this.
If you really want to use STOMP from Java then you could look at StompJMS which maps quite a bit of the JMS API to STOMP. It doesn't support failover but there aren't a lot of stomp client's that do. When using Java you are better off to use the native JMS client from the ActiveMQ broker as it is going to be the most robust and feature complete client library you will find.

RabbitMQ, is it possible to publish via one protocol and consume via another?

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 ;-).