Sha256: 8a652f1636e0888b393815d88bf9c1fa203498abd46b734ef0d54405c85ca984
Contents?: true
Size: 811 Bytes
Versions: 4
Compression:
Stored size: 811 Bytes
Contents
$: << File.expand_path('../lib', File.dirname(__FILE__)) require 'sneakers' require 'sneakers/runner' class MiddlewareWorker include Sneakers::Worker from_queue 'middleware-demo', ack: false def work(message) puts "******** MiddlewareWorker -> #{message}" end end class DemoMiddleware def initialize(app, *args) @app = app @args = args end def call(deserialized_msg, delivery_info, metadata, handler) puts "******** DemoMiddleware - before; args #{@args}" res = @app.call(deserialized_msg, delivery_info, metadata, handler) puts "******** DemoMiddleware - after" res end end Sneakers.configure Sneakers.middleware.use(DemoMiddleware, foo: :bar) Sneakers.publish("{}", :to_queue => 'middleware-demo') r = Sneakers::Runner.new([MiddlewareWorker]) r.run
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
kicks-3.1.1 | examples/middleware_worker.rb |
kicks-3.1.0 | examples/middleware_worker.rb |
kicks-3.0.0 | examples/middleware_worker.rb |
kicks-3.0.0.pre | examples/middleware_worker.rb |