tobox executes your handlers in a worker pool. The worker pool can be thread-based (default) or fiber-based.
It uses the “SKIP LOCKED” SQL dialect
to support concurrent polling for events from the database outbox table.
It
ships with plugins for sentry, datadog and zeitwerk. The plugin system
is itself very simple, so you can add your own custom logic around event
processing.
It can be used as a background job processor, although it’s best used in tandem with an existing framework.
Here are the updates since the last release:
## [0.4.0] - 2023-05-19
### Features
#### `:stats` plugin
The `:stats` plugin collects statistics related with the outbox table periodically, and exposes them to app code (which can then relay them to a statsD collector, or similar tool).
```ruby
plugin(:stats)
on_stats(5) do |stats_collector| # every 5 seconds
stats = stats_collector.collect
StatsD.gauge('outbox_pending_backlog', stats[:pending_count])
end
```
Read more about it in [the project README](
https://gitlab.com/os85/tobox#stats).
#### on_start/on_stop callbacks
The `on_start` and `on_stop` callbacks can now be defined in `tobox` configuration:
```ruby
# tobox.rb
on_start do
puts "tobox is starting..."
end
on_stop do
puts "tobox is stopping..."
end
```
### Bugfixes
* tobox configuration file is now only loaded after everything else, so access to application code is guaranteed.
## [0.3.2] - 2023-03-06
### Bugfixes
* allow sentry error capture if `report_after_retries` option is turned off.
## [0.3.1] - 2023-03-03
### Bugfixes
In Sentry plugin, exception capturing is no longer dependent on transaction monitoring being enabled (if `traces_sampling_rate` would be set to 0, exceptions wouldn't be capture; now they are).