ActiveMQ Network of Brokers pull message from broker 1 - activemq

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

Related

ActiveMQ cosumer connection differ from producer

The following is my ActiveMQ setup:
I have two AMQ broker which are configured with failover.
I have 40 producer but only on consumer.
Now the problem:
From time to time, one of the producer lost the connection to the master broker. The failover reacts and the producer gets a new connection to the slave which gets the messages. So far so good. But the consumer does not have the problem, he consumes still the messages from the master. He does not know, that the slave has also some messages.
How can i now solve the problem woth losing those messages thay are sent to the slave?
Thank in advance
I would recommend you configure a network of brokers. That way, your brokers will be connected as well, and it no longer matters which broker your producers and consumers connect to - the messages will get propagated across the network.

Message sent to Topic not forwarded by ActiveMQ

Just wondering if anyone has come across this problem with ActiveMQ.
I am using network of brokers to forward messages using AMQ 5.11.0
<networkConnectors>
<networkConnector name="linkToBrokerB" uri="static (tcp://(brokerAddress):61616)">
<dynamicallyIncludedDestinations>
<queue physicalName="QueueName"/>
<topic physicalName="VirtualTopic.Message.Event.EventName"/>
</dynamicallyIncludedDestinations>
</networkConnector>
when I queue a message on broker A it gets forwarded to broker B respective queue using the configuration above. However, it does not work for topics. When I send a topic to broker A it does not get forwarded to broker B Topic. I have a consumer on both brokers listening to that respective topic. If I try to forward messages using one or more queues it works without any issues, but I cannot figure out why it does not work for topics.
I tried using the ">" but it does not forward anything. I can see that the topic has a consumer and that broker B is connected to broker A in the "network" tab but it does not forward my topic as it does with my queues. I have also checked that the physical name used in the configuration is the same one as it appears under "topics" category
Any help would be appreciated

Replicate Activemq Message to once server to another server activemq

Q: we want publish same message in different Activemq servers. can we have any approach. like we will publish once and activemq changes will give a forward that message to another instance.
or is there any way we can do it by the activemq config changes?
There is not much context in the question but a simple Topic together with Network of brokers should do that.
The idea is that you connect multiple brokers using "network of brokers", then messages sent to a topic will be available to all clients on all brokers throughout the network.
There are a lot of corner cases when it comes to network of brokers and topics, but it should do the work.

How to expose ActiveMQ Multicast network to public and access using remote machines?

Hi I'm evaluating different discovery protocols in ActiveMQ and I have a problem with the Multicast Discovery in network of brokers.
I've setup a network of brokers with 3 activeMQ broker connected to a multicast group
<transportConnectors>
<transportConnector name="default" uri="tcp://192.168.11.1:61616" discoveryUri="multicast://default?group=Bus"/>
</transportConnectors>
I have a producer in different network - 192.168.5.10 and when I try to create a connection to the network my producer was not able to discover it
...
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("discovery:(multicast://default?group=Bus)");
...
but when I try to connect using the failover, I was able to create connection and produce message successfully
...
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:(tcp://192.168.11.1:61616,tcp://192.168.11.2:61616,tcp://192.168.11.3:61616)");
...
Now my question is how to make the multicast uri to be accessed globally? I've referred the following document here. But was not sufficient for me to understand.
If someone could shed some light on this, it would be really helpful. Thanks in advance!
Making multicast accessible within your environment is a question for your Network Administrators. They will need to enable IGMP routing for multicast to work.
For an overview of how multicast works see: http://www.enterprisenetworkingplanet.com/netsp/article.php/3623181/Networking-101--Understanding-Multicast-Routing.htm
For details on configuring IGMP on a cisco device, see http://www.cisco.com/c/en/us/td/docs/ios/12_2/ip/configuration/guide/fipr_c/1cfmulti.html
I am pretty sure it's not enabled by default on most routers.

ActiveMQ network of brokers with durable subscription topics

I have a little problem here with my sample JMS layout.
I have two brokers (A, B) on two machines, which are linked via network connector. The idea is that the producer can send to any broker and the consumer can listen to any broker and the topic to send to/receive from is available globally.
The topic has two durable subscriber clients (one on each machine) that both will process all the messages in the topic. I want it to be a durable subscription so that the processes won't loose any workload if a process has to be restarted. Both subscriber clients are configured to have a failover broker url, so that they first try to connect to their localhost broker and if not available to the other. Failover of the clients seems to work, but I found a problem in the following situation:
Each broker 'A' and 'B' have a subscriber client connected The producer is sending to 'A'. Broker 'B' gets restarted. Client of 'B' registers connection loss and switches to 'A'. 'B' comes up again, and because it had itself registered as a durable subscriber to 'A' it gets the message feed. It has no active durable subscriber now ('A' has now three, including 'B') and piles up until it reaches its connection limits.
Is my configuration wrong? Is it possible what I've intended?
Cheers,
Kai
Are you running master-slave configuration?
Why do you want both brokers to have connected clients at the same time?
If you user failover connection string (identifying both brokers in it) your consumers/producers will use ActiveMQ failover implementation and will connect/reconnect to the active node when needed. I don't think having two active instances with active clients is a good idea - unless you are trying to duplicate your processes (in this case there will be no synchronization)
To make both nodes (master and slave) to always have the same durable data you need
to persist your messages to the same place accessible to both nodes. It can be JDBC adapter connected to a single instance of database (probably behind the cluster) or it can be NAS with shared network folder for KahaDB.