Class: TraceFilter
- Inherits:
-
ActiveMessaging::Filter
- Object
- ActiveMessaging::Filter
- TraceFilter
- Includes:
- ActiveMessaging::MessageSender
- Defined in:
- lib/activemessaging/trace_filter.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ TraceFilter
constructor
A new instance of TraceFilter.
- #process(message, routing) ⇒ Object
Methods included from ActiveMessaging::MessageSender
included, #publish, #publish_with_reset, #receive
Methods inherited from ActiveMessaging::Filter
Constructor Details
#initialize(options) ⇒ TraceFilter
Returns a new instance of TraceFilter.
4 5 6 7 |
# File 'lib/activemessaging/trace_filter.rb', line 4 def initialize() @queue = [:queue] TraceFilter.publishes_to @queue end |
Instance Method Details
#process(message, routing) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/activemessaging/trace_filter.rb', line 9 def process , routing unless ( routing[:destination].name == @queue ) then ActiveMessaging.logger.debug "Trace: direction = #{routing[:direction]} publisher=#{routing[:publisher]} queue=#{routing[:destination].name} @queue=#{@queue}" if routing[:direction].to_sym==:outgoing then "trace from outgoing" publish @queue, "<sent>"+ "<from>#{routing[:publisher]}</from>" + "<queue>#{routing[:destination].name}</queue>" + "<message>#{.body}</message>" + "</sent>" end if routing[:direction].to_sym==:incoming then "trace from incoming" publish @queue, "<received>"+ "<by>#{routing[:receiver]}</by>" + "<queue>#{routing[:destination].name}</queue>" + "<message>#{.body}</message>" + "</received>" end end end |