RabitMQ with Django and angular 9

317 views
Skip to first unread message

Monika Gujar

unread,
Jan 14, 2021, 8:51:00 AM1/14/21
to rabbitmq-users
Hi,
Monika here, I am very new to RabbitMQ. 
1. Followed this tutorial for backend (send.js), which worked perfectly. It is storing data in a queue on the RabbitMQ server.
2. Now I am trying to connect it with angular. I am using angular 9, in that I have created one method, using the below tutorial (only receiver.js)

My problem is how am I going to call the Rabbitmq within my API & how will I get a response which I will bind to UI (HTML)

I have attached my file, which contains the API request.

Thanks in advance :)
optimized-layout.controller.ts

AyoDeji Olukowi

unread,
Jan 14, 2021, 11:35:21 AM1/14/21
to rabbitmq-users
To bind a recieved rabbitmq message to html, you need to create a variable in the controller, then assign the "msg.content.toString()" to the variable, then access the variable in the html template layout using {{ variable}}. If you are new to angular, I suggest you start with easier tutorials,

I have made some adjustments to your attached document
optimized-layout.controller.ts

Monika Gujar

unread,
Jan 15, 2021, 1:41:51 AM1/15/21
to rabbitmq-users
Thank you very much for your reply.

I am not new to angular, but I am new to Rabbitmq amqplib, and using your updated/mine previous code I am getting the below error. I think we can not use require in angular.

var amqp = require('amqplib/callback_api');





Capture.PNG

AyoDeji Olukowi

unread,
Jan 15, 2021, 3:53:07 PM1/15/21
to rabbitm...@googlegroups.com

Apparently RabbitMQ does not have an Angular/browser integration. A solution is to call RabbitMQ from expressjs (server), then integrate it to angular app via http calls.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/35fe7426-f9df-4b1b-b62b-3f89c6d03d78n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages