module ActiveMessaging::MessageSender

This is a module so that we can send messages from (for example) web page controllers, or can receive a single message

Public Class Methods

included(included_by) click to toggle source
# File lib/activemessaging/message_sender.rb, line 8
def self.included(included_by)
  class << included_by
    def publishes_to destination_name
      ActiveMessaging::Gateway.find_destination(destination_name)
    end

    def receives_from destination_name
      ActiveMessaging::Gateway.find_destination(destination_name)
    end
  end
end

Public Instance Methods

publish(destination_name, message, headers={}) click to toggle source
# File lib/activemessaging/message_sender.rb, line 20
def publish destination_name, message, headers={}, timeout=10
  ActiveMessaging::Gateway.publish(destination_name, message, self.class, headers, timeout)
end
publish_with_reset(destination_name, message, headers={}, timeout=10) click to toggle source
# File lib/activemessaging/test_helper.rb, line 39
def publish_with_reset(destination_name, message, headers={}, timeout=10)
  unless @@__a13g_initialized__
    ActiveMessaging.reload_activemessaging 
    @@__a13g_initialized__ = true
  end
  publish_without_reset(destination_name, message, headers, timeout)
end
receive(destination_name, headers={}) click to toggle source
# File lib/activemessaging/message_sender.rb, line 24
def receive destination_name, headers={}, timeout=10
  ActiveMessaging::Gateway.receive(destination_name, self.class, headers, timeout)
end