Parent

OpenShift::ActiveMQPlugin

Public Class Methods

new() click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 9
def initialize
  Rails.logger.debug("Listening for routing events")
  @topic = Rails.application.config.routing_activemq[:topic]
  if Rails.application.config.routing_activemq[:debug]
    @conn = Class.new(Object) do
      def publish(topic, msg)
        Rails.logger.debug("Topic #{topic} gets message:\n#{msg}")
      end
    end.new
  else
    @conn = Stomp::Connection.open Rails.application.config.routing_activemq[:username],
                                   Rails.application.config.routing_activemq[:password],
                                   Rails.application.config.routing_activemq[:host],
                                   Rails.application.config.routing_activemq[:port],
                                   true
  end
end

Public Instance Methods

notify_add_alias(app, alias_str) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 54
def notify_add_alias(app, alias_str)
  msg = {
    :action => :add_alias,
    :app_name => app.name,
    :namespace => app.domain_namespace,
    :alias => alias_str
  }
  send_msg msg.to_yaml
end
notify_create_application(app) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 74
def notify_create_application(app)
  msg = {
    :action => :create_application,
    :app_name => app.name,
    :namespace => app.domain.namespace,
    :scalable => app.scalable,
    :ha => app.ha,
  }
  send_msg msg.to_yaml
end
notify_create_public_endpoint(app, gear, endpoint_name, public_ip, public_port, protocols, types, mappings) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 96
def notify_create_public_endpoint(app, gear, endpoint_name, public_ip, public_port, protocols, types, mappings)
  msg = {
    :action => :add_public_endpoint,
    :app_name => app.name,
    :namespace => app.domain.namespace,
    :gear_id => gear._id.to_s,
    :public_port_name => endpoint_name,
    :public_address => public_ip,
    :public_port => public_port.to_i,
    :protocols => protocols,
    :types => types,
    :mappings => mappings
  }
  send_msg msg.to_yaml
  # DEPRECATED, will be removed in OSE 2.2 / Origin 4
  msg[:action] = :add_gear
  msg[:deprecated] = "use add_public_endpoint"
  send_msg msg.to_yaml
end
notify_delete_application(app) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 85
def notify_delete_application(app)
  msg = {
    :action => :delete_application,
    :app_name => app.name,
    :namespace => app.domain.namespace,
    :scalable => app.scalable,
    :ha => app.ha,
  }
  send_msg msg.to_yaml
end
notify_delete_public_endpoint(app, gear, public_ip, public_port) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 116
def notify_delete_public_endpoint(app, gear, public_ip, public_port)
  msg = {
    :action => :remove_public_endpoint,
    :app_name => app.name,
    :namespace => app.domain.namespace,
    :gear_id => gear._id.to_s,
    :public_address => public_ip,
    :public_port => public_port.to_i
  }
  send_msg msg.to_yaml
  # DEPRECATED, will be removed in OSE 2.2 / Origin 4
  msg[:action] = :delete_gear
  msg[:deprecated] = "use remove_public_endpoint"
  send_msg msg.to_yaml
end
notify_remove_alias(app, alias_str) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 64
def notify_remove_alias(app, alias_str)
  msg = {
    :action => :remove_alias,
    :app_name => app.name,
    :namespace => app.domain_namespace,
    :alias => alias_str
  }
  send_msg msg.to_yaml
end
notify_ssl_cert_add(app, fqdn, ssl_cert, pvt_key, passphrase) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 31
def notify_ssl_cert_add(app, fqdn, ssl_cert, pvt_key, passphrase)
  msg = {
    :action => :add_ssl,
    :app_name => app.name,
    :namespace => app.domain_namespace,
    :alias => fqdn,
    :ssl => ssl_cert,
    :private_key => pvt_key,
    :pass_phrase => passphrase
  }
  send_msg msg.to_yaml
end
notify_ssl_cert_remove(app, fqdn) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 44
def notify_ssl_cert_remove(app, fqdn)
  msg = {
    :action => :remove_ssl,
    :app_name => app.name,
    :namespace => app.domain_namespace,
    :alias => fqdn
  }
  send_msg msg.to_yaml
end
publish(topic, msg) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 14
def publish(topic, msg)
  Rails.logger.debug("Topic #{topic} gets message:\n#{msg}")
end
send_msg(msg) click to toggle source
# File lib/openshift/activemq_routing_plugin.rb, line 27
def send_msg(msg)
  @conn.publish @topic, msg
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.