How do I connect multiple broker in mosquitto MQTT iOS? - objective-c

I am using mosquito MQTT. I can connect to a single broker from my code and subscribe/publish for the same. I need to achieve a multiple broker connection from the code dynamically. How do I do that?

Related

ActiveMQ Network of Brokers pull message from broker 1

I am very new to ActiveMQ and I try to understand if I can achieve the following:
I have a producer which publishes messages to broker 1. In a secure network there is a broker 2 and the receiver. The connection between broker 1 and broker 2 can only be in the direction from broker 2 towards broker 1, because I can only communicate out of the secure network, but not in it.
All the documentation about network of brokers just show the way depicted in the following picture (found on https://dzone.com/articles/active-mq-network-brokers)
I need something similar, but the connection should be from broker-2 to broker-1.
Is something like this possible? Maybe with a polling from broker-2 to broker-1
Yes. Have Broker2 connect to Broker1 and establish a duplex connection
<networkConnector uri="static:(tcp://broker1:61616)" duplex="true" ... >
see: Network of Brokers

Apache NiFi TCP Client/Server

Can I simulate a TCP client/server interaction using Apache NiFi processors alone or do I have to write code for this? The processors to be considered here are ListenTCP, PutTCP, and GetTCP. In particular, I want to simulate and show a POC for sending HL7 messages from a TCP client to a TCP server. Anyone done this before using NiFi? Any help would be appreciated. Thanks.
ListenTCP starts a server socket waiting for incoming TCP connections. Your client can make connections to the hostname where NiFi is running and the port specified in ListenTCP. If your client needs to send multiple pieces of data over a single connection, then it must send new-lines in between each message. You can simulate a client in NiFi by using PutTCP and pointing it at the same host/port where ListenTCP is running.
UPDATE - Here is an example of the flow:

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

Spring STOMP Broker Relay + RabbitMQ Cluster with HA Proxy fronting each for load balancing

I am designing a system where a huge number of real-time data generated from devices is to be transferred to subscribers preferably over websockets. I have decided to use Spring STOMP Websockets as it was quicker to set-up, understand and had a few things supported out of the box like RabbitMQ and Security. And also because the plan is to use Spring for another REST API so Spring as a choice of tech stack. RabbitMQ is the message broker that I have decided on. However I can not find good amount of guidance on how to scale such a system.
The possible solution I am thinking of is:
To add HAProxy in front of STOMP broker instances and also between
STOMP Brokers and a RabbitMQ cluster, HAProxy will act as a
load-balancer in both cases. Spring STOMP broker will then be pointing to the HAProxy as broker relay host. The requirement is to have high availability and no data loss.
As I do not have prior experience with Websockets, I would like to get guidance on if this solution sounds correct or if there is anything that I am missing here?
Note: In this system, both the message producers and consumers are actually websocket Java clients. I took the sample code from https://github.com/nickebbutt/stomp-websockets-java-client and created two separate clients - One that only sends the messages i.e. device data(Producers) and other that subscribes to these messages(Consumer). Thus both connect using same websocket URL to same STOMP broker. With above system implementation the clients will point to HAProxy for websocket connection.
Just an updated on this, I did experimentation by creating the above set-up and it worked i.e. I was able to connect to websocket stomp server/send/receive data with RabbitMQ broker and use of HAProxy load balancing as described. The broker host/port configured in Spring was pointing to HAProxy which in turn was forwarding requests to RabbitMQ backend. Similarly, the websocket clients were connecting to Spring STOMP websocket server application via HAProxy.

ActiveMQ embedded with MQTT and Default MQ enabled, Possible to publish to both in one call?

I am using ActiveMQ embedded in Glassfish with both the default 61616 communication port and a port with MQTT enabled.
Is there a way to publish to both of these MQs in one call if ActiveMQ is configured a certain way?
If not, is the only way to connect to the MQTT server from the J2EE server through a 3rd party MQTT client?
If so, is there a MQTT lib that can take advantage of J2EE container's connection pools?
All protocols in ActiveMQ will share the same topics and queues.
You can subscribe and publish as you wish from java/JMS and the data will be accessible on the same topic using MQTT.
Of course, there will be some issues if you use JMS-only features, such as ObjectMessage and whatnot, but that is pretty obvious. Stick to text messages on topics and you should be fine.