Skip to content

Commit

Permalink
Documentation Improvement (#110)
Browse files Browse the repository at this point in the history
Co-authored-by: Eugene Kirdzei <e.ki@nuwber.com>
  • Loading branch information
masterjus and eugene-nuwber authored Apr 28, 2023
1 parent 69d4bba commit 024be25
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
32 changes: 0 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,38 +104,6 @@ The RabbitEvents Publisher component provides an API to publish events across th

The RabbitEvents Listener component provides an API to handle events that were published across the application structure. More information about how it works you could find on the RabbitEvents [Listener page](https://github.com/rabbitevents/listener).

## Console commands <a name='commands'></a>
### Command `rabbitevents:listen` <a name='command-listen'></a>

There is the command which is registers events in RabbitMQ:

```bash
php artisan rabbitevents:listen event.name --memory=512 --tries=3 --sleep=5
```

This command registers a separate queue in RabbitMQ bound to an event. As the only `rabbitevents:listen` registers a queue, you should run this command before you start to publish your events. Nothing will happen if you publish an event first, but it will not be handled by a Listener without the first run.

You could start listening to an event only by using `rabbitevents:listen` command, so you have to use some system such as [Supervisor](http://supervisord.org/) or [pm2](http://pm2.keymetrics.io/) to control your listeners.

If your listener crashes, then managers will rerun your listener and all messages sent to a queue will be handled in the same order as they were sent. There is the known problem: as queues are separated and you have messages that affect the same entity there's no guarantee that all actions will be done in an expected order. To avoid such problems you can send message time as a part of the payload and handle it internally in your listeners.


#### Options<a name="listen-options"></a>
- **--service=**. When a queue starts the name of the service becomes a part of a queue name: `service:event.name`. By default, service is the APP_NAME from your `.env`. You could override the first part of a queue name by this option.
- **--memory=128**. The memory limit in megabytes. The RabbitEvents have restarting a worker if limit exceeded.
- **--timeout=60**. The number of seconds a massage could be handled.
- **--tries=1**. Number of times to attempt to handle a Message before logging it failed.
- **--sleep=5**. Sleep time in seconds before handling failed message next time.
- **--quiet**. No console output

### Command `rabbitevents:list` <a name='command-list'></a>

To get the list of all registered events please use the command `rabbitevents:list`.

```bash
php artisan rabbitevents:list
```

## Non-standard use <a name="#non-standard-use"></a>

If you're using only one of parts of RabbitEvents, you should know a few things:
Expand Down
1 change: 0 additions & 1 deletion src/RabbitEvents/Listener/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ If your listener crashes, then managers will rerun your listener and all message

### Options<a name="listen-options"></a>
- **--service=**. When a queue starts the name of the service becomes a part of a queue name: `service:event.name`. By default, service is the APP_NAME from your `.env`. You could override the first part of a queue name by this option.
- **--connection=**. The name of connection specified in the `config/rabbitevents.php` config file. Default: `rabbitmq`.
- **--memory=128**. The memory limit in megabytes. The RabbitEvents have restarting a worker if limit exceeded.
- **--timeout=60**. The length of time (in seconds) each Message should be allowed to be handled.
- **--tries=1**. Number of times to attempt to handle a Message before logging it failed.
Expand Down

0 comments on commit 024be25

Please sign in to comment.