- Prerequisites
- Types
- Running Application
- References
Tool | Version |
---|---|
Node JS | 12.13.0 (LTS) |
rabbitmq_server | 3.8.2 |
-
One to One (Direct)
For one to one messaging, a producer sends messages to specified queue. A consumer receives messages from that queue.To ensure message is not lost, message acknowledgments can be sent back to producer to confirm a particular message has been received
File path - "./rbmq_basic/rbmq.producer and ./rbmq_basic/rbmq.consumer"
-
Routing - Filter Based (Topic)
For filter based routing, a producer declares the topic exchange when publishing a message. Messages sent with a particular routing key will be delivered to all the queues that are bound with a matching binding key. Filter based routing provides a method to use filter policies on routing key for choosing the recipients of messages.
* (star) can substitute for exactly one word. Example: 'topic.*' can be : topic1, topic2, topic3 etc.
# (hash) can substitute for zero or more words. Example: "#.topic" can be: topic, Ftopic, Secondtopic, 123topic etc.
File path - "./topic"
-
One to One (Direct)
Under roor directory
cd direct
node index.js
node consumer.js
-
Routing - Filter Based (Topic)
Under roor directory
cd topic
node index.js
node consumer.js
foo@bar: ~$ curl --location --request POST 'http://localhost:3343/api/v1/save' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"postId": 1,
"id": 1,
"name": "id labore ex et quam laborum",
"email": "[email protected]",
"body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
}
]'