You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`amqpOptions`|`false`|`Object`| Connection options. See [amqplib documentation](http://www.squaremobius.net/amqp.node/channel_api.html#connect). |
85
-
|`reconnectDelaySecond`|`false`|`number`| <i>Default: `30`.</i><br>Time in second to wait between two reconnection tries. |
86
-
|`keepRequestsInMemoryWhileConnecting`|`false`|`boolean`| <i>Default: `false`.</i><br>Should the requests be kept in memory while queue is (re)connecting? If set to `true`, may cause memory overflow. |
64
+
```
87
65
88
-
See also [Notif.me documentation](https://github.com/notifme/notifme-sdk).
66
+
See a [complete working example](https://github.com/notifme/notifme-sdk-queue-rabbitmq/tree/master/example) for more details.
89
67
90
-
### Use workers to send notifications
68
+
##How to use
91
69
92
-
Use `runWorker: false` in the configuration of Notif.me SDK.
70
+
### Producer options
93
71
94
72
```javascript
95
-
// Producer
96
-
constnotifmeSdk=newNotifmeSdk({
97
-
requestQueue:rabbitMq('amqp://localhost'),
98
-
runWorker:false
73
+
newNotifmeRabbitMqProducer({
74
+
keepRequestsInMemoryWhileConnecting:...,
75
+
url:...,
76
+
amqpOptions:...,
77
+
queueName:...,
78
+
isPersistent:...,
79
+
reconnectDelaySecond:...
99
80
})
100
-
101
-
notifmeSdk.send(...)
102
81
```
103
82
83
+
| Option name | Type | Default | Description |
84
+
| --- | --- | --- | --- |
85
+
|`keepRequestsInMemoryWhileConnecting`|`boolean`|`false`| Should the requests be kept in memory while queue is (re)connecting? If set to `true`, may cause memory overflow. |
86
+
|`url`|`string`|`'amqp://localhost'`| RabbitMQ URL. See [amqplib documentation](http://www.squaremobius.net/amqp.node/channel_api.html#connect). |
87
+
|`amqpOptions`|`Object`|`{}`| Connection options. See [amqplib documentation](http://www.squaremobius.net/amqp.node/channel_api.html#connect). |
88
+
|`queueName`|`string`|`'notifme:request'`| Name of the queue to use. |
89
+
|`isPersistent`|`boolean`|`true`| Is the queue persistent? |
90
+
|`reconnectDelaySecond`|`number`|`30`| Time in second to wait between two reconnection tries. |
91
+
92
+
### Consumer options
93
+
104
94
```javascript
105
-
// Consumer
106
-
importNotifmeWorkerfrom'notifme-sdk/lib/worker'
107
-
108
-
constnotifmeWorker=newNotifmeWorker({
109
-
requestQueue:rabbitMq('amqp://localhost'),
110
-
channels: {
111
-
email: {
112
-
providers: [{type:'logger'}]
113
-
}
114
-
}
95
+
newNotifmeRabbitMqConsumer({
96
+
url:...,
97
+
amqpOptions:...,
98
+
queueName:...,
99
+
isPersistent:...,
100
+
reconnectDelaySecond:...
115
101
})
116
-
notifmeWorker.run()
117
102
```
118
103
119
-
See a [working example](https://github.com/notifme/notifme-sdk-queue-rabbitmq/tree/master/example) for more details.
104
+
| Option name | Type | Default | Description |
105
+
| --- | --- | --- | --- |
106
+
|`url`|`string`|`'amqp://localhost'`| RabbitMQ URL. See [amqplib documentation](http://www.squaremobius.net/amqp.node/channel_api.html#connect). |
107
+
|`amqpOptions`|`Object`|`{}`| Connection options. See [amqplib documentation](http://www.squaremobius.net/amqp.node/channel_api.html#connect). |
108
+
|`queueName`|`string`|`'notifme:request'`| Name of the queue to use. |
109
+
|`isPersistent`|`boolean`|`true`| Is the queue persistent? |
110
+
|`reconnectDelaySecond`|`number`|`30`| Time in second to wait between two reconnection tries. |
0 commit comments