RubyFlow The Ruby and Rails community linklog


The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

[ANN] tobox 0.4.0 released

tobox (v0.4.0) has been released.

tobox implements the consumer side of the transactional outbox pattern, providing a simple way to configure your event handlers.

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).

on_stats(5) do |stats_collector| # every 5 seconds
  stats = stats_collector.collect
  StatsD.gauge('outbox_pending_backlog', stats[:pending_count])

Read more about it in the project README.

on_start/on_stop callbacks

The on_start and on_stop callbacks can now be defined in tobox configuration:

# tobox.rb
on_start do
  puts "tobox is starting..."
on_stop do
  puts "tobox is stopping..."
  • 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).

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in