activemq embedded broker - activemq

In ActiveMQ, there is a concept called BrokerService. Normally for learning purposes, I am starting the broker from the command line using 'activemq' which starts the Broker.
What is the difference between starting the broker this way and using the BrokerService.start();
My guess is that when you use 'activemq' , the broker starts in its own jvm, when you use BrokerService.start(), the broker is using the existing JVM.
Is this correct?
Also, if someone can point to a resource that explains how the broker architecture is implemented in a traditional j2ee server like weblogic, that would be much appreciated.
I am mostly seeking clarification of how a broker can be deployed on a cluster?

Check out the ActiveMQ in action book. That is awesome and explains everything
My blog

Related

Rabbit MQ fault tolerance

I have a project where we are using Rabbit MQ has message broker, I have below concern, please help on the same.
If Rabbit MQ goes down, how we can retrieve the queued message.is there any configuration in rabbit MQ?
Can we implement same in java thread and collection combination, that can be used as alternative to rabbit MQ? if yes help with an example.
'You should listen to ShutdownListenercallback on both Connection and Channelclasses'. By this way, you know if the queue is down. After that, you need to re-transmit your queued messages. This is what official documentations says. https://www.rabbitmq.com/reliability.html
Of course you can implement your own library, but you have to think if this would be better for you. I suggest you not to do that. RabbitMQ is a well-known open source library that many people use and trust for years. I think there is no side-effect using that in any project.
Deploy RabbitMQ on Kubernetes with stateful sets. This will replicate state in multiple instances. One of them will be primary. Failover will be handled by Kubernetes.
See https://kublr.com/blog/reliable-fault-tolerant-messaging-rabbitmq-kublr/

Embedded BrokerService vs installed ActiveMQ broker

I would like to know are there feature wise same or different? Could you also mention any pros and cons about both of these? Also please mention real-world use case for both Embedded BrokerService vs installed ActiveMQ broker. Thanks in advance!
ActiveMQ is just a Java application, and the embedded version offers essentially the same features as the stand-alone version. In fact, you can configure an embedded broker to take its configuration from an XML file, in which case it will look very similar to the stand-alone broker.
Embedding a broker is a reasonable thing to do if you need the benefit of programmatic configuration; that is, you want to configure things according to rules which are hard to implement in an XML file. It also makes sense if you want close-coupled operation between the broker and the application components, with message data being passed in memory. This might be the situation if you're using JMS as an inter-module communication mechanism within the application.
Embedding a broker has the disadvantage -- and it can be a profound one -- of making it difficult to disentangle problems in the broker from problems in your application. Figuring out the cause of, say, runaway memory consumption could be very difficult. You can get commercial support for ActiveMQ, should you need it, but it will be hard for any commercial organization to support a hybrid broker+application installation.

Conversion from MQTT to AMQP/STOMP

I'm kind of new to these protocols, and just started exploring Message brokers like Apache Apollo and RabbitMQ.
So my broker receives MQTT messages from a publisher. And I would like to convert it into AMQP (preferably) or STOMP protocol to send to a web server. But I've so far been unable to do so.
I looked into RabbitMQ, and tried enabling the MQTT plugin, but when I do load it, I'm unable to start the server.
I was wondering if anyone can guide me here? Is there an API that can help me? And I'm very confused about RabbitMQ. I've been able to load other plugins easily,like stomp, management utilities etc.
I'm 100% sure it is doable. I am doing it right now with robomq.io broker. One cause could be sometimes bugs in your client library restrict you doing so.
Another thing you should be aware of is that internally, RabbitMQ MQTT adapter is mapped into amq.topic exchange by default, so on your STOMP peer, you should subscribe or send to /topic/yourTopic; on your AMQP peer, bind your queue to amq.topic exchange or publish to that exchange.
Follow this example code and documentation to build your client.
If you can't figure out your server, just get a free trial from robomq.io. It saves you time and money.
The development tool I am using is robomq.io broker, producers in Python (AMQP library: pika, MQTT library: paho, STOMP library: stompest), consumer in Node.js (library: amqplib).
Hope it helps!
Well, I'm not sure if this question should be taken down. But if it has to be I leave it to the discretion of the moderators and the stackOverflow community in general.
btw, I use Ubuntu 14.04.
About the RabbitMQ broker
So Mosquitto was running un the background occupying the port 1883 normally used for MQTT. I could have changed the port for RabbitMQ, but decided against it and tried to kill the Mosquitto process. But for some reason, I could NOT.
For now, my quick fix was removing Mosquitto completely and this freed the port, enabling RabbitMQ to use it.
About the protocols
I've used Paho and the RabbitMQ libraries provided to code out simple programs that can publish and receive messages in AMQP/MQTT via the RabbitMQ broker.
(My Googling needs to be better!)
Still haven't converted one to the other. But that shouldn't be too big a step to achieve.
Still would be nice to know if there's an API or something that can help me achieve the conversion in a very simple manner. Of course, if there's not, I'll figure it out ASAP
Any suggestions/comments are heartily welcome. I'm brand new to all this and could really use advice from all you seasoned pros :)

Using Camel to transparently log messages from queue

I have a legacy application running on Glassfish which I have just recently configured to use activemq rather than openMQ. My activemq broker is running in a separate process outside of glassfish. I was thinking it would be nice to configure a camel route that logs messages as they are sent to the queue. I want to do something like this
from("activemq:myqueue")
.to("activemq:myqueue")
.wireTap("direct:tap")
.to("log:myqueue");
I don't think that makes sense though. What I want to happen is for camel to log the message transparently to the consumer. I don't want to have to change code so that the producer sends to an "inbound" queue and the consumer receives from an "outbound" queue and camel hooks them up, since that would require changes to the legacy app. I don't think this is possible, but just wondering.
Yeah I was about to suggest looking for a broker solution as it would be the most optimized and performant. Obvious monitoring the message flow in the broker is a common requirement and thus ActiveMQ has features for that:
http://activemq.apache.org/mirrored-queues.html
I think I just found out how I can do what I want with mirrored Queues:
http://activemq.apache.org/mirrored-queues.html
This is a change to the broker, and not purely done in camel.

How to use RabbitMQ broker in Java application

How to use RabbitMQ message broker in Java application? I have not found any document or link to understand how to do it.
There's plenty or RabbitMQ documentation.
In particular, you may be interested in the Java client API guide and the javadocs.