Using ActiveMQ and RabbitMQ at the same time

According to my experience with message brokers, RabbitMq has the best performance under heavy loads. However, for simplicity, it is better to use AtiveMQ in the browser. I want to know if both of them can be used at the same time?
Moreover, is there a way to send a message using ActiveMQ in a browser and receive the same message using RabbitMQ on the server side? I would appreciate it if anyone would suggest me a useful sample code.

+5
source share
2 answers

ActiveMQ can talk AMQP 1.0, RabbitMQ can talk AMQP 1.0 using this plugin . You can create a bridge using this protocol.

But , reading your question, I think you do not need ActiveMQ. To send a message to the browser, you can use the webstomp plugin .

+1
source

What you are trying to do is implement a bridge pattern. Now, although JMS bridges are typically designed to provide a mechanism between JMS message providers, an integration pattern can also be used for wired protocols.

So, if you are trying to send messages between ActiveMQ - RabbitMQ here, then there are potential options:

1) ActiveMQ support - Defacto JMS, AMQP, STOMP 2) RabbitMQ support - Defacto STOMP, AMQP is also supported along with other popular wired protocols such as MQTT

So, when it comes to bridges:

a) [1] JMS - [2] STOMP (or) AMQP b) [1] AMQP (or) STOMP - [2] AMQP (or) STOMP

In the case of the 1st and 2nd bridge options, the easiest way to implement this is to use the Apache QPID client.

Alternatively, for most reliable configurations, it is better to use it as a Spring Integration Channel or a camel route.

Here's a snippet of how to do this using Spring Integration:

<beans:bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> <beans:property name="environment"> <beans:props> <beans:prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</beans:prop> <beans:prop key="java.naming.provider.url">jnp://localhost:1099</beans:prop> <beans:prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</beans:prop> </beans:props> </beans:property> </beans:bean> <beans:bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <beans:property name="jndiTemplate"> <beans:ref bean="jndiTemplate"/> </beans:property> <beans:property name="jndiName"> <beans:value>ConnectionFactory</beans:value> </beans:property> </beans:bean> <!-- Channels and adapters for SI --> <int-jms:message-driven-channel-adapter connection-factory="jmsQueueConnectionFactory" destination-name="myJmsQueue" channel="rabbitChannel"/> <channel id="rabbitChannel"/> <int-amqp:outbound-channel-adapter channel="rabbitChannel" exchange-name="fromJmsExchange" amqp-template="rabbitTemplate"/> <!-- Connectivity to Rabbit --> <rabbit:template id="rabbitTemplate" connection-factory="cf"/> <rabbit:connection-factory id="cf" host="localhost"/> <!-- Rabbit entities, to be created at context startup --> <rabbit:admin connection-factory="cf"/> <rabbit:queue name="fromJMS"/> <rabbit:direct-exchange name="fromJmsExchange"> <rabbit:bindings> <rabbit:binding queue="fromJMS"/> </rabbit:bindings> </rabbit:direct-exchange> 

Article source: http://integrationsphere.blogspot.co.uk/2012/03/bridging-between-jms-and-rabbitmq-amqp.html

+1
source

Source: https://habr.com/ru/post/1238125/


All Articles