Class: JettyRails::Adapters::RailsJmsAdapter

Inherits:
RailsAdapter show all
Defined in:
lib/jetty_rails/adapters/rails_jms_adapter.rb

Overview

This adapter extends the standard Rails adapter with an additional listener for JMS queues

Constant Summary collapse

@@defaults =

Defaults to expecting OpenMQ jars in lib_dir/jms_dir at startup

{
  :jms_dir    => "jms",
  :queue_name => "rails_queue",
  :mq_host    => "localhost",
  :mq_port    => 7676
}

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#config

Instance Method Summary collapse

Methods inherited from RailsAdapter

#init_params

Methods inherited from AbstractAdapter

#base_init_params

Constructor Details

#initialize(config) ⇒ RailsJmsAdapter

Returns a new instance of RailsJmsAdapter.



16
17
18
19
# File 'lib/jetty_rails/adapters/rails_jms_adapter.rb', line 16

def initialize(config)
  super @@defaults.merge(config)
  require_jms_jars()
end

Instance Method Details

#event_listenersObject



21
22
23
# File 'lib/jetty_rails/adapters/rails_jms_adapter.rb', line 21

def event_listeners
  super << Rack::JMS::QueueContextListener.new(queue_manager_factory())
end

#queue_manager_factoryObject



25
26
27
28
29
30
31
# File 'lib/jetty_rails/adapters/rails_jms_adapter.rb', line 25

def queue_manager_factory
  factory = jndiless_default_queue_manager_factory_class()
  factory.queue_name = config[:queue_name]
  factory.mq_host    = config[:mq_host]
  factory.mq_port    = config[:mq_port]
  factory.new
end