Skip to content

Commit 1bf9676

Browse files
author
Rajesh
committed
Readme added.
1 parent d1eaa9a commit 1bf9676

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

README.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# RabbitMQ NodeJS - Basics, Direct and Topic based
2+
3+
---
4+
5+
## Table of contents
6+
- Prerequisites
7+
- Types
8+
- Running Application
9+
- References
10+
11+
### Prerequisites
12+
13+
| Tool | Version |
14+
| :--- | ------- |
15+
| **Node JS** | 12.13.0 (LTS) |
16+
| **rabbitmq_server** | 3.8.2 |
17+
18+
### Types
19+
20+
1. One to One (Direct)
21+
22+
> 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
23+
24+
> File path - "./rbmq_basic/rbmq.producer and ./rbmq_basic/rbmq.consumer"
25+
26+
> [Ref: One to One (direct)](https://robomq.readthedocs.io/en/latest/one-one/)
27+
28+
2. Routing - Filter Based (Topic)
29+
30+
> 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.
31+
32+
> <span>&ast;</span> (star) can substitute for exactly one word.
33+
> Example: 'topic.*' can be : topic1, topic2, topic3 etc.
34+
35+
> <span>#</span> (hash) can substitute for zero or more words.
36+
> Example: "#.topic" can be: topic, Ftopic, Secondtopic, 123topic etc.
37+
38+
> File path - "./topic"
39+
40+
> [Ref: Routing - Filter Based (Topic)](https://robomq.readthedocs.io/en/latest/topic/)
41+
42+
### Running Application
43+
44+
1. One to One (Direct)
45+
46+
> Under roor directory
47+
48+
> cd direct
49+
50+
> node index.js
51+
52+
> node consumer.js
53+
54+
2. Routing - Filter Based (Topic)
55+
56+
> Under roor directory
57+
58+
> cd topic
59+
60+
> node index.js
61+
62+
> node consumer.js
63+
64+
```console
65+
foo@bar: ~$ curl --location --request POST 'http://localhost:3343/api/v1/save' \
66+
--header 'Content-Type: application/json' \
67+
--data-raw '[
68+
{
69+
"postId": 1,
70+
"id": 1,
71+
"name": "id labore ex et quam laborum",
72+
"email": "[email protected]",
73+
"body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
74+
}
75+
]'
76+
```
77+
78+
### References
79+
80+
1. [Downloading and Installing RabbitMQ](https://www.rabbitmq.com/download.html)
81+
2. [AMQP 0-9-1 Model Explained](https://www.rabbitmq.com/tutorials/amqp-concepts.html)
82+
3. [AMQP](https://robomq.readthedocs.io/en/latest/AMQP/)
83+
4. [RabbitMQ Tutorials](https://www.rabbitmq.com/getstarted.html)
84+
5. [Enable Management Plugin](https://www.rabbitmq.com/management.html#getting-started)

0 commit comments

Comments
 (0)