2

I'm building a web application using VueJS. The application should act as a message producer and should send messages to a RabbitMQ. Is there a best practice on how to implement the components for this?

Edit: I believe that this is not solved and RabbitMQ allows websocket connections for protocols other than AMQP, namely MQTT and STOMP are supported using plugins written by RabbitMQ team.
These plugins enable websocket transfer protocol and enable operation with these messaging protocols.
Source: https://www.rabbitmq.com/web-mqtt.html

nlhnt
  • 173
  • 2
  • 11
offsec1
  • 31
  • 1
  • 4

1 Answers1

5

Rabbitmq is based on the amqp protocol, which is not designed to be accessible directly from a browser/webapp.

A browser can talk to a server using http or websockets.

Then, your server can talk to rabbitmq using an amqp client.

This is an example of stack achieving this:

-your vue app send http request to a node/express server -your node/express server translate the request from http call (express route) to rabbit queue using the node amqp client library.

-rabbit mq process the messages note serveur can wait for the rabbit response, or not.

Note that here, your webapp manage the server connection (address etc) and your server manage the configuration of the rabbitmq connection.

Slim
  • 1,256
  • 1
  • 13
  • 25
  • And what if at some point my vue app wants to consume messages? Would it then make more sense to use MQTT with web sockets? – offsec1 Jul 24 '20 at 20:49
  • Yes, websocket are good for receiving messages (but not rabbit messages, websocket messages) when server décidés it. – Slim Jul 24 '20 at 23:58
  • RabbitMQ can and does work with other protocols than AMQP, i.e. STOMP OR MQTT and it has plugins that allow the app to connect to the broker using Websockets as a transfer protocol to operate with these messaging protocols. Source: rabbitmq.com/web-mqtt.htm – nlhnt Nov 07 '22 at 20:24