README.md in songkick_queue-0.5.0 vs README.md in songkick_queue-0.6.0

- old
+ new

@@ -69,12 +69,10 @@ logger.info "Received message: #{message.inspect}" TwitterClient.send_tweet(message[:text], message[:user_id]) rescue TwitterClient::HttpError => e logger.warn(e) - rescue StandardError => e - logger.error(e) end end ``` Consumers have the logger you declared in the configuration available to them. @@ -121,9 +119,30 @@ serialized whilst enqueued and deserialized before being passed to the `#process` method in your consumer. ```ruby SongkickQueue.publish('notifications-service.tweets', { text: 'Hello world', user_id: 57237722 }) +``` + +## Instrumentation + +Hooks are provided to instrument producing and consuming of messages using [ActiveSupport's Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) API. + +You can subscribe to the following events: + +``` +consume_message.songkick_queue +produce_message.songkick_queue +``` + +For both events, the payload includes the message id, produced at timestamp and queue name. The `consume_message` event also includes the consumer class. + +For example: + +```ruby +ActiveSupport::Notifications.subscribe('consume_message.songkick_queue') do |name, start, finish, id, payload| + # Log info to statsd or something similar +end ``` ## Tests See the current build status on Travis CI: https://travis-ci.org/songkick/queue