Introducing `Rocketman`, a gem to help you do Pub/Sub code in Pure Ruby. No Rails needed!

twitter logo github logo ・1 min read

Publishing my second Ruby gem here with the community, introducing Rocketman!

Description

Rocketman is a gem that introduces Pub-Sub mechanism within Ruby code.

As with all Pub-Sub mechanism, this greatly decouples your upstream producer and downstream consumer, allowing for scalability, and easier refactor when you decide to move Pub-Sub to a separate service.

Rocketman also works without Rails.

GitHub logo edisonywh / rocketman

Rocketman help build event-based/pub-sub code in Ruby

Rocketman

rocketman yes, I know it says Starman on the image

🎢 And I think it's gonna be a long long time 'Till touch down brings me round again to find 🎢

Rocketman is a gem that introduces Pub-Sub mechanism within your Ruby code.

The main goal of Rocketman is not to replace proper message buses like Redis PubSub/Kafka, but rather be a stepping stone. You can read more about the rationale behind the project down below.

As with all Pub-Sub mechanism, this greatly decouples your upstream producer and downstream consumer, allowing for scalability, and easier refactor when you decide to move Pub-Sub to a separate service.

Rocketman also works without Rails.

Installation

Add this line to your application's Gemfile:

gem 'rocketman'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rocketman

Usage

Rocketman exposes two module, Rocketman::Producer and Rocketman::Consumer. They do exactly as…

Usage

emitting events look as easy as this:

emit :hello, payload: {"one" => 1, "two" => 2}

and listening for events look like this:

on_event :hello do |payload|
  puts payload
end

There’s more information on the Usage section and Roadmap if you’re interested in the project, otherwise, feel free to comment here too!

twitter logo DISCUSS
Classic DEV Post from Apr 1

How I Write Online Articles

How you can write online articles

Edison Yap profile image
An aspiring software engineer from the tiny city of Kuala Lumpur.

dev.to now has dark theme. 🌝

Go to the "misc" section of your settings and select night theme

P.S. It's also the best place to talk code amongst thoughtful developers, and it's totally open source.