Class: TestSaf

Inherits:
Object show all
Includes:
Ap4r::StoreAndForward
Defined in:
lib/ap4r/store_and_forward.rb

Overview

:nodoc:

Constant Summary

Constants included from Ap4r::StoreAndForward

Ap4r::StoreAndForward::DRUBY_HOST, Ap4r::StoreAndForward::DRUBY_PORT, Ap4r::StoreAndForward::DRUBY_URI

Instance Method Summary collapse

Methods included from Ap4r::StoreAndForward

#__ap4r_forward_by_queue_info, #__ap4r_forward_by_stored_message_id, #__ap4r_queue_put

Instance Method Details

#async_dispatch_with_saf(queue_name, queue_message, rm_options = {}) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ap4r/store_and_forward.rb', line 105

def async_dispatch_with_saf(queue_name, queue_message, rm_options = {})

  connect()
  stored_message_id = ::Ap4r::StoredMessage.store(queue_name, queue_message, rm_options)
  forward_by_queue_info(
         stored_message_id, 
         {
           :queue_name => queue_name, 
           :queue_message => queue_message, 
           :queue_headers => rm_options
         }, 
         options = {} )   
end

#connectObject



95
96
97
98
99
100
101
102
103
# File 'lib/ap4r/store_and_forward.rb', line 95

def connect
  unless ActiveRecord::Base.connected?
    #TODO: Get parameters from config, 2006/10/12 kato-k
    ActiveRecord::Base.establish_connection(
                                            :adapter => 'sqlite3',
                                            :database => '../../samples/HelloWorld/db/hello_world_development.db'
                                            )
  end
end