README.md in dispatch-rider-0.2.6 vs README.md in dispatch-rider-0.2.7
- old
+ new
@@ -206,19 +206,26 @@
some_block_around do
job.call
end
end
+ config.logger = Rails.logger
+
config.error_handler = DispatchRider::DefaultErrorHandler # an object that responds to .call(message, exception)
config.queue_kind = :sqs
config.queue_info = { name: "queue-production" }
config.handler_path = Rails.root + "app/handlers" # path to handler files to be autoloaded
end
```
+Options:
+
+ * `logger` : what logger to use to send messages to (responds to the standard ruby Logger protocol), defaults to a new Logger sending messages to STDERR
+
+
### Callbacks
Dispatch rider supports injecting callbacks in a few parts of the
lifecycle of the process.
@@ -235,15 +242,13 @@
To setup a subscriber you'll need message handlers. The handlers are named the same as the message subjects.
Sample message handler:
```ruby
# app/handlers/bar_handler
-module ReadNews
- class << self
- def process(message_body)
- message_body["headlines"].each do |headline|
- puts headline
- end
+class ReadNews < DispatchRider::Handlers::Base
+ def process(message_body)
+ message_body["headlines"].each do |headline|
+ puts headline
end
end
end
```