README.md in sidekiq-apriori-0.0.2 vs README.md in sidekiq-apriori-0.0.3

- old
+ new

@@ -40,13 +40,15 @@ want to disallow unset priorities, leave the nil in. sidekiq-apriori is inspired by (a response to?) [sidekiq-priority](https://github.com/socialpandas/sidekiq-priority), in which the order of the priorities is important. Contrary to the approach taken by sidekiq-priority, sidekiq-apriori uses sidekiq's built in mechanism for -configuring the order of processing. So, for example, if your sidekiq.yml -currently looks like this: +configuring the order of processing. As such, the ordering of priorities is +accomplished in the sidekiq.yml. +So, for example, if your sidekiq.yml currently looks like this: + ```yaml ## sidekiq.yml verbose: false :pidfile: /tmp/sidekiq.pid @@ -54,11 +56,11 @@ :queues: - postback - background ``` -you might want to change the 'queues' entry to look more like this: +You might want to change the 'queues' entry to look more like this: ```yaml :queues: - postback_wut - postback_huh @@ -66,13 +68,19 @@ - postback - postback_not_even_a_little - background ``` -Use ---- +To route an item to a prioritized queue, append an options hash of the form +```{ :priority => 'wut' }``` to the end of the arguments. If you're using ruby 2 +& have included ```Sidekiq::Apriori::Worker``` in your worker class then this +should be enough. Otherwise, you'll need to update that method to optionally +take an additional argument +Additional Utility +------------------ + In addition to the use described in the PRIORITIES section, some tooling is provided for active record classes with priority as an attribute: ```ruby ## app/models/prioritized.rb @@ -105,13 +113,16 @@ end ``` If you're lucky enough to be using ruby 2, you can save yourself some work by including ```Sidekiq::Apriori::Worker``` instead of ```Sidekiq::Worker``` in your -worker classes. This will have the nifty side effect of saving you the effort of -changing the definition of the classes' perform method & its invocation. -```Sidekiq::Apriori::Worker``` uses ```prepend``` to define a perform which will -take an optional hash containing a priority designation. +worker classes. This will save you the effort of changing the definition of the +classes' perform method & all of its invocations. ```Sidekiq::Apriori::Worker``` +uses ```prepend``` to define a perform which will take an optional hash containing +a priority designation. + +If you're not using ruby 2, you'll need to redefine your perform method to take an +additional, optional argument License ------- sidekiq-apriori is released under the MIT License. Please see the [LICENSE](LICENSE)