RabbitMQ - connect using AMQP and STOMP to same exchange - rabbitmq

We are using RabbitMQ as message broker. Producer1 connects using AMQP, Producer2 connects using STOMP protocol, Consumer1 connects using AMQP, Consumer2 (using javascript) connects using STOMP via websocket.
(Producer1 and consumer1 uses spring cloud stream)
Test1: When producer1 using AMQP sends messages, it is received in consumer1(AMQP) and failed to receive in consumer2(STOMP). Consumer2 javascript client is getting disconnected immediately when producer1(AMQP) send message and queue is getting deleted.
Test2: When producer2 using STOMP sends message, it is received in consumer1(AMQP) and consumer 2 (STOMP) with out any issue.
Test1 - is it possible scenario? We are trying to connect to same exchange in RabbitMQ using AMQP and STOMP protocol by consumers. STOMP consumer is being disconnected when AMQP producer sends message. Verified both rabbitmq and consumer logs. it didn't give much information in logs.

As STOMP only supports text. Changing the message content type worked.

Related

Subscribe to MQTT messages from an AMQP client on RabbitMQ?

I run a RabbitMQ node with the MQTT/WebMQTT plugins enabled.
All MQTT plugin settings use the default configuration.
Various MQTT clients are sending messages to MQTT channels.
The MQTT channel names follow the format of devices/{device_id_here}/{special_name_here}
I wish to subscribe to all MQTT messages that would match devices/#/logs in MQTT. How can I accomplish this using an AMQP client on the same broker as the MQTT users?
I am using Bunny as my (Ruby) AMQP client.
You can not use the # wildcard in the middle of a MQTT topic subscription as it is capable of matching multiple levels.
The correct wildcard is + as this only matches a single level in the topic hierarchy. E.g.
device/+/logs

ActiveMQ MQTT (QoS 1) doesn't republish messages when client not acknowledged the messages

I'm using ActiveMQ 5.10 as the MQTT Broker with one Java client to send messages in JMS and one C client to receive the messages.
Here's the Java code snippet:
MessageProducer producer = session.createProducer(new ActiveMQTopic("topic1"));
TextMessage text = session.createTextMessage("test msg");
text.setIntProperty("ActiveMQ.MQTT.QoS",1);
producer.send(text);
After capturing the TCP packages, I confirmed the problem: If ActiveMQ sent out a message but didn't receive a PUBACK from the C client, ActiveMQ didn't resend the message. So the C client would never receive the message any more, event the message was under QoS 1 (at-least-once).
How can I send the message with JMS (and/or configure ActiveMQ) to make QoS 1 truely work? Thanks a lot!

Spring+RabbitMQ make queues non durable

I am using RabbitMQ as a Stomp broker for Spring Websocket application. The client uses SockJS library to connect to the websocket interface.
Every queue created on the RabbitMQ by the Spring is durable while topics are non durable. Is there any way to make the queues non durable as well?
I do not think I can configure on the application side. I played a bit with RabbitMQ configuration but could not set it up either.
Example destination on RabbitMQ used for SUBSCRIBE and SEND:
services-user-_385b304f-7a8f-4cf4-a0f1-d6ceed6b8c92
It will be possible to specify properties for endpoints as of RabbitMQ 3.6.0 according to comment in RabbitMQ issues - https://github.com/rabbitmq/rabbitmq-stomp/issues/24#issuecomment-137896165:
as of 3.6.0, it will be possible to explicitly define properties for endpoints such as /topic/ and /queue using subscription headers: durable, auto-delete, and exclusive, respectively.
As a workaround you can try to create queues by your own using AMQP protocol and then refer to that queues from STOMP protocol.

MQTT in Producer /consumer context

we are using ActiveMQ for message Queuing with openwire transport.In this context there will be one producer and one consumer with a message listener registered. We heard about MQTT protocol and its support in activeMQ. But i saw examples only for Publisher/subscriber semantics , where subscriber need to call receive method explicitly to get the published message. Can I use mqtt with Producer/Consumer envirnment. Please give a sample..
The MQTT protocol is based a publish / subscribe based model, it has no queuing semantics built into the protocol. If you need Queue's then you need to stick to openwire clients or use a STOMP based client which supports both Topics and Queues.

Stomp ActiveMQ questions

I am new to Stomp ActiveMQ. I want to create a login from an android client and I don't know how to use ActiveMq. I\ve installed active mq, configured stomp and run the stompexample.
1. I have an error when running activemq from command line if I add in in the activemq.xml the following line:
<transportConnector name="stomp+nio" uri="stomp+nio://localhost:61612"/>
<transportConnector name="stomp+ssl" uri="stomp+ssl://localhost:61612"/>
Can someone please explain what is with tx1 and tx2? Is there a way to send on the queue a message to a specific client? how?
connection.connect("system", "manager");
connection.begin("tx1");
connection.send("/queue/test", "message1");
connection.send("/queue/test", "message2");
connection.commit("tx1");
connection.subscribe("/queue/test", Subscribe.AckModeValues.CLIENT);
connection.begin("tx2");
StompFrame message = connection.receive();
System.out.println(message.getBody());
connection.ack(message, "tx2");
message = connection.receive();
System.out.println(message.getBody());
connection.ack(message, "tx2");
connection.commit("tx2");
connection.disconnect();
Can someone please tell me how to create an application that sends on a queue a text containing username, password and receives an answer if the register was successful?
You need to configure the transport connectors with different port numbers, they can't both share port 61612. Your configure is create a Stomp NIO connector and a different Stomp SSL Connector.
You can't send messages to a distinct client, you just place them on a Queue and if there is a client subscribed it will get the message, that's the nature of Queue based messaging. The TX1 TX2 stuff is sending the messages within a transaction.
Recommend you take some time to read up of JMS Messaging, the Stomp spec and some other messaging based tutorials.