admin管理员组

文章数量:1191359

Does React work with Rabbit-MQ? I've been googling myself to death the past few days and I could only find results regarding React Native.

Can I just follow a Javascript-RabbitMQ-Tutorial or is there something specific?

I'm thankful for any hint.

Does React work with Rabbit-MQ? I've been googling myself to death the past few days and I could only find results regarding React Native.

Can I just follow a Javascript-RabbitMQ-Tutorial or is there something specific?

I'm thankful for any hint.

Share Improve this question asked Feb 12, 2018 at 7:51 ClaimClaim 9214 gold badges15 silver badges36 bronze badges 4
  • Isn't RabbitMQ a message queuing system? I know not much about it, but sounds very backend to me; When it's coupled with Javascript in a tutorial, I'd guess they mean Node.js. – cbll Commented Feb 12, 2018 at 7:57
  • Yes, you're right, it is a message queueing system. I actually found this on their homepage. Not sure if there's a better convention, so that's why I asked. – Claim Commented Feb 12, 2018 at 8:09
  • It depends on what are you trying to achieve. Basically you can make work React with RabbitMQ client, but in most cases it isn't the right solution. If you want to add real-time features to your app you better look at websocket solutions like github.com/socketio/engine.io – Mikhail Zhuravlev Commented Feb 12, 2018 at 9:03
  • @MikhailZhuravlev - I am trying to implement a GUI that updates based on certain inventory changes through a service in the backend. – Claim Commented Feb 14, 2018 at 8:21
Add a comment  | 

4 Answers 4

Reset to default 12
  • Here is an example of RPC support for RabbitMQ http://www.rabbitmq.com/tutorials/tutorial-six-javascript.html

  • RabbitMQ provides has plugins which enables to connect to the server via websockets. http://www.rabbitmq.com/web-stomp.html
    Samples are here https://www.rabbitmq.com/devtools.html#web-messaging

  • There are couple of nodejs client libraries too. It is worth to take a look at them if you are using webpack. May be they will just work in the browser.

I also had difficulties in implementing Rabbit MQ in React js.

But one of my friends enabled/install mqtt and websocket plugins in our Rabbit Mq server.

So now I can communicate our React js app with Rabbit MQ using simple mqtt or websocket.

I required this for one of my projects and ended up going with this approach

FE -> BACKEND SERVICE -> RABBITMQ

Basically, the backend service is responsible for listening to the rabbitmq, and has the responsibility of receiving and publishing messages to the Queue cluster. I used the library; https://www.npmjs.com/package/amqplib I believe this is the most used library for RabbitMq Connectivity (via amqp) considering the weekly downloads on the npmjs website. I strongly recommend you to use a stable library especially if you are new to rabbitmq and this nature of work. This is in addition to the answer given by @Arun Karunagath above. Good luck!

https://www.npmjs.com/package/rabbitode you can try this library provides a nice abstraction of the amqplib package from nodejs

本文标签: javascriptRabbitMQ with ReactStack Overflow