Run The Inbox Process

The command

php artisan inbox:work {topic} 
    --limit=10 
    --log=1|0 
    --wait=5 
    --stop-on-empty 
    --max-processing-time=3600
  • {topic}: The topic that you want to run

  • --limit=10: The number of msgs that will be pulled from DB to resolve.

    • Default: 10

    • Beware of memory leaks of the high number. Highly recommended: 50 or 100

  • --log=1|0: 1 to show up the processing logs, 0 to hide

    • Default: 1

  • --wait=5: the interval sleep time (in seconds) when there is no message.

    • Default: 5

  • --max-processing-time=3600: The inbox process will stop after X seconds.

    • Default: 3600 (1 hour).

    • This is useful because there are still many PHP packages that haven't been optimized for long-lived processes, so it is better to restart the process after a while.

  • --stop-on-empty: if there is no msg, the inbox process will stop if you include this flag.

Manage the process

Same as Laravel Queue Worker, you can set up the supervisor to manage the process.

Note: use numprocs=1 for each topic.

We also added the locking mechanism, so you won't be able to dispatch multiple processes for a single topic.

This will ensure there is only 1 worker for 1 topic, ensuring your msgs are handled sequentially and uniquely.

Last updated