Class: SmscManager::SmscListener

Inherits:
StompMessage::StompServer
  • Object
show all
Defined in:
lib/smsc_manager/smsc_listener.rb

Constant Summary collapse

SLEEP_TIME =

sleep x seconds to slow down system

1/@@MAX_THROUGHPUT
@@MAX_THROUGHPUT =

in messages per second

5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SmscListener

need to define topic, host properly @@TOPIC=‘/topic/sms’



15
16
17
18
19
# File 'lib/smsc_manager/smsc_listener.rb', line 15

def initialize(options={})
  super(options)
  self.smsc=SmscManager::SmscConnection.factory
  puts "finished initializing"
end

Instance Attribute Details

#smscObject

Returns the value of attribute smsc.



12
13
14
# File 'lib/smsc_manager/smsc_listener.rb', line 12

def smsc
  @smsc
end

Instance Method Details

#stomp_SMS(msg, stomp_msg) ⇒ Object

name is message command



31
32
33
34
35
36
37
# File 'lib/smsc_manager/smsc_listener.rb', line 31

def stomp_SMS(msg, stomp_msg)
   sms=SmscManager::Sms.load_xml(msg.body)
    puts "sending sms #{msg.body}" if @debug
   res= self.smsc.send(sms)
   
 #  sleep(SLEEP_TIME)  #only 5 messages per second max
end