Skip to content

Commit 4c69281

Browse files
update readme
1 parent a84b58c commit 4c69281

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

configure.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export async function configure(command: ConfigureCommand) {
1919
*/
2020
await codemods.updateRcFile((rcFile: any) => {
2121
rcFile.addProvider('rabbitmq-adonis-v6/rabbitmq_provider')
22-
rcFile.addPreloadFile('#start/rabbit', ['console'])
22+
rcFile.addPreloadFile('#start/rabbit', ['web'])
2323
})
2424

2525
/**
@@ -30,7 +30,7 @@ export async function configure(command: ConfigureCommand) {
3030
RABBITMQ_USER: '',
3131
RABBITMQ_PASSWORD: '',
3232
RABBITMQ_PORT: '',
33-
RABIITMQ_PROTOCOL: 'ampq',
33+
RABBITMQ_PROTOCOL: 'ampq',
3434
RABBITMQ_HEARTBEAT: 60,
3535
})
3636

@@ -43,7 +43,7 @@ export async function configure(command: ConfigureCommand) {
4343
RABBITMQ_USER: 'Env.schema.string()',
4444
RABBITMQ_PASSWORD: 'Env.schema.string()',
4545
RABBITMQ_PORT: 'Env.schema.number()',
46-
RABIITMQ_PROTOCOL: 'Env.schema.string()',
46+
RABBITMQ_PROTOCOL: 'Env.schema.string()',
4747
RABBITMQ_HEARTBEAT: 'Env.schema.number.optional()',
4848
},
4949
leadingComment: 'Variables for Rabbitmq',

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rabbitmq-adonis-v6",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "AdonisJS RabbitMQ provider",
55
"main": "build/index.js",
66
"engines": {

readme.md

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# adonis-rabbit
22

3-
`rabbitmq-adonis-v6` is a RabbitMQ provider for [Adonis](https://github.com/adonisjs/core).
3+
`rabbitmq-adonis-v6` is a RabbitMQ provider for [Adonis](https://adonisjs.com/).
44

55
## Getting Started
66

@@ -35,7 +35,7 @@ Make sure to set the correct values to the enviroment variables so `rabbitmq-ado
3535
### Sending messages to an queue
3636

3737
```ts
38-
import Rabbit from 'rabbitmq-adonis-v6'
38+
import { Rabbit } from 'rabbitmq-adonis-v6'
3939
import router from '@adonisjs/core/services/router'
4040

4141
Route.get('/', async () => {
@@ -56,7 +56,7 @@ Notice doesn't really makes sense to subscribe to an queue inside a controller,
5656
Inside `start/rabbit.ts`:
5757

5858
```ts
59-
import Rabbit from 'rabbitmq-adonis-v6'
59+
import { Rabbit } from 'rabbitmq-adonis-v6'
6060

6161
async function listen() {
6262
await Rabbit.assertQueue('my_queue')
@@ -78,7 +78,7 @@ This will log every message sent to my queue `my_queue`.
7878
#### Import
7979

8080
```ts
81-
import Rabbit from 'rabbitmq-adonis-v6'
81+
import { Rabbit } from 'rabbitmq-adonis-v6'
8282
```
8383

8484
#### `assertQueue()`
@@ -214,6 +214,14 @@ Retrieves the amqplib's Channel instance. If there's not a connection, it'll be
214214
await Rabbit.getChannel()
215215
```
216216

217+
#### `validateConnection()`
218+
219+
Indicate if has an active connection
220+
221+
```ts
222+
await Rabbit.validateConnection()
223+
```
224+
217225
#### `closeChannel()`
218226

219227
Closes the channel.
@@ -226,7 +234,7 @@ Closes the connection.
226234

227235
### Message
228236

229-
When consuming messages through [`consumeFrom`](https://github.com/jotaajunior/adonis-rabbit#consumefrom), you'll receive in the callback a Message instance.
237+
When consuming messages through [`consumeFrom`](https://github.com/mvargaslandolfi/rabbitmq-adonis-v6#consumefrom), you'll receive in the callback a Message instance.
230238

231239
This slightly different from amqplib approach. For example:
232240

@@ -318,3 +326,7 @@ Parameters:
318326
In your .env you have to put the service container name, for example:
319327

320328
`RABBITMQ_HOSTNAME={your_docker_container_service_name}`
329+
330+
## Credits
331+
332+
Part of the code for this package has been taken and adapted from the RabbitMQ package for Adonis v5. You can find the original package [here](https://github.com/jotaajunior/adonis-rabbit).

stubs/start/rabbit.stub

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
exports({ to: app.startPath('rabbit.ts') })
33
}}}
44

5-
import rabbitmq from 'rabbitmq-adonis-v6'
5+
import { Rabbit } from 'rabbitmq-adonis-v6'
66

77
async function listen() {
88
await Rabbit.assertQueue('my_queue')

0 commit comments

Comments
 (0)