Module: ActiveMessaging::MessageSender
- Included in:
- Filter, Processor, TraceFilter
- Defined in:
- lib/activemessaging/message_sender.rb,
lib/activemessaging/test_helper.rb
Overview
This is a module so that we can send messages from (for example) web page controllers, or can receive a single message
Constant Summary collapse
- @@__a13g_initialized__ =
false
Class Method Summary collapse
Instance Method Summary collapse
- #publish(destination_name, message, headers = {}, timeout = 10) ⇒ Object
- #publish_with_reset(destination_name, message, headers = {}, timeout = 10) ⇒ Object
- #receive(destination_name, headers = {}, timeout = 10) ⇒ Object
Class Method Details
.included(included_by) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/activemessaging/message_sender.rb', line 8 def self.included(included_by) class << included_by def publishes_to destination_name Gateway.find_destination destination_name end def receives_from destination_name Gateway.find_destination destination_name end end end |
Instance Method Details
#publish(destination_name, message, headers = {}, timeout = 10) ⇒ Object
20 21 22 |
# File 'lib/activemessaging/message_sender.rb', line 20 def publish destination_name, , headers={}, timeout=10 Gateway.publish(destination_name, , self.class, headers, timeout) end |
#publish_with_reset(destination_name, message, headers = {}, timeout = 10) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/activemessaging/test_helper.rb', line 39 def publish_with_reset(destination_name, , headers={}, timeout=10) unless @@__a13g_initialized__ ActiveMessaging.reload_activemessaging @@__a13g_initialized__ = true end publish_without_reset(destination_name, , headers, timeout) end |