Skip to content

Profinda/wisper-activejob

 
 

Repository files navigation

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 publshing events the arguments must be simple types as they need to be serialized, or the object must include GlobalID such as ActiveRecord models.

Advanced options

You can also customize queue name, retry value and other queue options when registering the listener like the following:

publisher.subscribe(MyListener, async: { queue: 'custom', retry: false })

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

About

Provides asynchronous event publishing to Wisper using ActiveJob

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Ruby 100.0%