https://github.com/krisleech/wisper-activejob
Provides asynchronous event publishing to Wisper using ActiveJob
https://github.com/krisleech/wisper-activejob
Last synced: about 1 year ago
JSON representation
Provides asynchronous event publishing to Wisper using ActiveJob
- Host: GitHub
- URL: https://github.com/krisleech/wisper-activejob
- Owner: krisleech
- License: mit
- Created: 2014-10-07T13:13:45.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-11-01T04:19:13.000Z (over 2 years ago)
- Last Synced: 2025-04-02T11:49:24.562Z (about 1 year ago)
- Language: Ruby
- Size: 18.6 KB
- Stars: 36
- Watchers: 3
- Forks: 27
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Wisper::ActiveJob
Provides [Wisper](https://github.com/krisleech/wisper) with asynchronous event
publishing using
[ActiveJob](https://github.com/rails/rails/tree/master/activejob).
[](http://badge.fury.io/rb/wisper-activejob)
[](https://codeclimate.com/github/krisleech/wisper-activejob)
[](https://travis-ci.org/krisleech/wisper-activejob)
[](https://coveralls.io/r/krisleech/wisper-activejob?branch=master)
## Installation
```ruby
gem 'wisper-activejob'
```
## Usage
```ruby
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:
```ruby
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.
* [ActiveJob guide](http://edgeguides.rubyonrails.org/active_job_basics.html)
* [GlobalID](https://github.com/rails/globalid)
## Compatibility
1.9.3+ including JRuby and Rubinius.
See the [build status](https://travis-ci.org/krisleech/wisper-activejob) for details.
## Contributing
Please send a [Pull Request](https://github.com/krisleech/wisper-activejob/pulls)
or an [Issue](https://github.com/krisleech/wisper-activejob/issues) to discuss
your idea first.
## Releasing
* Bump VERSION
* Push to master
* rake build
* rake release