/wisper-activejob

Provides asynchronous event publishing to Wisper using ActiveJob

Primary LanguageRubyMIT LicenseMIT

Wisper::ActiveJob

Provides Wisper with asynchronous event publishing using ActiveJob.

Gem Version Code Climate Build Status Coverage Status

Installation

gem 'wisper-activejob'

Usage

publisher.subscribe(MyListener, async: true)

The listener must be a class (or module), not an object. This is because ActiveJob can not reconstruct the state of an object. Whereas a class has no state.

Additionally, you should also ensure that your methods used to handle events under MyListener are all declared as class methods:

class MyListener
  def self.event_name
  end
end

When publishing events the arguments must be simple types as they need to be serialized, or the object must include GlobalID such as ActiveRecord models.

Compatibility

1.9.3+ including JRuby and Rubinius.

See the build status for details.

Contributing

Please send a Pull Request or an Issue to discuss your idea first.

Releasing

  • Bump VERSION
  • Push to master
  • rake build
  • rake release