Skip to content

Commit

Permalink
update readme with listener's class methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin91 committed May 11, 2015
1 parent 06b80c2 commit 8fd1353
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ publisher.subscribe(MyListener, async: true)
The listener must be a class (or module), not an object. This is because Sidekiq
can not reconstruct the state of an object. However a class is easily reconstructed.

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 publshing events the arguments must be simple as they need to be
serialized. For example instead of sending an `ActiveRecord` model as an argument
use its id instead.
Expand Down

0 comments on commit 8fd1353

Please sign in to comment.