UNPKG

1.66 kBMarkdownView Raw
1# loopback-component-mq
2Loopback Component for working with a Message Queue
3
4[![Circle CI](https://circleci.com/gh/fullcube/loopback-component-mq.svg?style=svg)](https://circleci.com/gh/fullcube/loopback-component-mq) [![Dependencies](http://img.shields.io/david/fullcube/loopback-component-mq.svg?style=flat)](https://david-dm.org/fullcube/loopback-component-mq) [![Coverage Status](https://coveralls.io/repos/github/fullcube/loopback-component-mq/badge.svg?branch=master)](https://coveralls.io/github/fullcube/loopback-component-mq?branch=master)
5
6## Installation
7
81. Install in you loopback project:
9
10 `npm install --save loopback-component-mq`
11
122. Create a `component-config.json` file in your server folder (if you don't already have one)
13
143. Configure options inside `component-config.json`. *(see configuration section)*
15
16 ```json
17 {
18 "loopback-component-mq": {
19 "options": {
20 "dataSource": "rabbit"
21 },
22 "topology": {
23 "my-event-queue": {
24 "consumer": {
25 "model": "Event",
26 "method": "consumeEventMessage"
27 },
28 "producer": {
29 "model": "Event",
30 "method": "produceEventMessage"
31 }
32 }
33 }
34 }
35 }
36 ```
37
384. Configure the Rabbit Data Source inside `datasources.json`:
39
40 ```json
41 {
42 "rabbit": {
43 "name": "rabbit",
44 "connector": "transient",
45 "options": {
46 "protocol": "amqp",
47 "username": "guest",
48 "password": "guest",
49 "hostname": "localhost",
50 "port": "5672",
51 "restPort": "15672",
52 "vhost": "/",
53 "sslKey": ""
54 }
55 }
56 }
57 ```
58
59## License
60
61MIT
62
\No newline at end of file