README.md in salesforce_streamer-2.0.0 vs README.md in salesforce_streamer-2.1.0
- old
+ new
@@ -87,13 +87,11 @@
# config/initializers/salesforce_streamer.rb
SalesforceStreamer.configure do |config|
config.logger = Logger.new(STDERR, level: 'INFO')
config.exception_adapter = proc { |e| puts e }
- config.replay_adapter = proc { |topic|
- (ReplayStore.get(topic.name) || topic.replay).to_i
- }
+ config.replay_adapter = MyReplayAdapter
config.use_middleware AfterMessageReceived
config.manage_topics = true
end
```
@@ -151,9 +149,31 @@
end
end
SalesforceStreamer.config.use_middleware MySimpleMiddleware
```
+
+### ReplayAdapter
+
+The `config.replay_adapter` should be an object that has an interface like Hash.
+It must respond to `[]` and `[]=`. By default the adapter is an empty hash. If
+you want your push topic replayId to persist between restarts, then you should
+implement a class with an appropriate interface.
+
+```ruby
+class MyReplayAdapter
+ def [](channel)
+ Persistence.get(channel)
+ end
+
+ def []=(channel, replay_id)
+ Persistence.set(channel, replay_id)
+ end
+end
+```
+
+This adapter will be used directly by `Restforce::ReplayExtension`.
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).