README.md in dispatch-rider-0.0.3 vs README.md in dispatch-rider-0.0.4

- old
+ new

@@ -27,10 +27,40 @@ ### Publisher Setting up a publisher is simple. +### Hash Based Configuration + +All configuration can be loaded from a hash instead of being done like the examples below. +(currently only implemented for the publisher) + +eg: + +```ruby + publisher = DispatchRider::Publisher.new + publisher.configure({ + notification_services: { + file_system: {} + }, + destinations: { + file_foo: { + service: :file_system, + channel: :foo, + options: { + path: "test/channel", + } + } + } + }) +``` + +You can load this configuration hash from a YAML file or something, whatever works +well for your environment. + +#### The old way ... + To publish using the filesystem register the path where to publish the message files. ```ruby publisher = DispatchRider::Publisher.new @@ -172,9 +202,34 @@ subscriber.setup_demultiplexer(:aws_sqs) subscriber.process ``` + +Sample subscriber dispatch error handling (optional): + +```ruby + + # using blocks + + subscriber.on_dispatch_error do |message, exception| + # put your error handling code here + + return false # or return true to permanently remove the message + end + + # using methods + + def handle_dispatch_error(message, exception) + # put your error handling code here + + return false # or return true to permanently remove the message + end + + subscriber.on_dispatch_error &method(:handle_dispatch_error) + +``` + Sample Rails application rake task: ```ruby