Class: MicroQ::Middleware::Chain

Inherits:
Object
  • Object
show all
Defined in:
lib/micro_q/middleware/chain.rb

Overview

An Array wrapper that holds the class name of middlewares to call around the execution of messages. The most basic middleware must yield to the given block to allow the message to be invoked. Not yielding causes the message to be dropped and not invoked.

A minimal middleware: class MyFunMiddleware

def call(worker, message)
  # Do something fun here ...
  yield
  # More fun goes here ...
end

end

Defined Under Namespace

Classes: Base, Client, Server

Instance Method Summary collapse

Instance Method Details

#clientObject

Middleware chain that is run around message push.

-- If halted, the message will not enter the queue.


38
39
40
# File 'lib/micro_q/middleware/chain.rb', line 38

def client
  @client ||= Client.new
end

#serverObject

Middleware chain that is run around execution of messages.

-- If halted, the message will not be invoked.


30
31
32
# File 'lib/micro_q/middleware/chain.rb', line 30

def server
  @server ||= Server.new
end