smsc_manager 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
data/bin/send_sms_load_test.rb
CHANGED
@@ -66,7 +66,7 @@ require 'smsc_manager'
|
|
66
66
|
sms_sender.send_sms(final_text,destination,source)
|
67
67
|
}
|
68
68
|
diff = Time.now - start
|
69
|
-
|
69
|
+
sms_sender.close_topic
|
70
70
|
puts "#{Time.now} Sent #{count} in #{diff} seconds";
|
71
71
|
# puts "Sending user: #{user} destination: #{destination} text: #{text}"
|
72
72
|
# res= smsc.send(sms)
|
@@ -45,18 +45,20 @@ class BroadcastTopic
|
|
45
45
|
# puts " dst is #{dst}"
|
46
46
|
}
|
47
47
|
puts "populate topic sent #{self.sent}"
|
48
|
+
self.sms_sender.close_topic
|
48
49
|
end
|
49
50
|
def send_it(txt,dst)
|
50
51
|
# puts "hello from send it"
|
51
52
|
begin
|
52
53
|
sms=SmscManager::Sms.new(txt,dst,self.source)
|
53
|
-
self.sms_sender.
|
54
|
+
self.sms_sender.send_topic_sms(sms)
|
54
55
|
self.attempts+=1
|
55
56
|
self.sent+=1
|
56
57
|
rescue Exception => e
|
57
58
|
self.sent-=1
|
58
|
-
puts "bad values dst: #{dst} txt: #{
|
59
|
+
puts "bad values dst: #{dst} txt: #{txt} msg: #{e.message}"
|
59
60
|
end
|
61
|
+
self.sms_sender.close_topic
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
@@ -6,7 +6,7 @@ gem 'stomp_message'
|
|
6
6
|
require 'stomp_message'
|
7
7
|
# This sends the sms to a activemq topic
|
8
8
|
module SmscManager
|
9
|
-
class SmsSendTopic
|
9
|
+
class SmsSendTopic < StompMessage::StompSendTopic
|
10
10
|
attr_accessor :conn
|
11
11
|
#need to define topic, host properly
|
12
12
|
@@TOPIC='/topic/sms'
|
@@ -14,11 +14,9 @@ class SmsSendTopic
|
|
14
14
|
@@STOMP_SMS_MESSAGE='stomp_SMS'
|
15
15
|
def initialize(options={})
|
16
16
|
# set up variables using hash
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
self.conn = Stomp::Connection.open '', '', host, port, false
|
21
|
-
# self.conn.subscribe @@TOPIC, { :ack =>"auto" }
|
17
|
+
options[:topic] = options[:topic]==nil ? @@TOPIC : options[:topic]
|
18
|
+
puts "#{self.class}: host is: #{host} port is #{port} topic is #{options[:topic]}"
|
19
|
+
super(options)
|
22
20
|
puts "finished initializing"
|
23
21
|
end
|
24
22
|
# def initialize()
|
@@ -28,14 +26,15 @@ class SmsSendTopic
|
|
28
26
|
# end
|
29
27
|
def send_sms(text,destination,source)
|
30
28
|
sms=SmscManager::Sms.new(text,destination,source)
|
31
|
-
self.
|
29
|
+
self.send_topic_sms(sms)
|
32
30
|
end #send_sms
|
33
|
-
def
|
31
|
+
def send_topic_sms(sms)
|
34
32
|
#sms=SmscManager::Sms.new(text,destination,source)
|
35
33
|
# msgbody=sms.to_xml
|
36
34
|
m=StompMessage::Message.new(@@STOMP_SMS_MESSAGE, sms.to_xml)
|
37
35
|
# puts "message body is #{msgbody}"
|
38
|
-
|
36
|
+
headers = {:msisdn =>"#{sms.destination}"}
|
37
|
+
send_topic(m, headers)
|
39
38
|
end #send_sms
|
40
39
|
# simple script to show xml message
|
41
40
|
def self.create_stomp_message(txt,dest,src)
|
data/lib/smsc_manager/version.rb
CHANGED
data/test/smsc_manager_test.rb
CHANGED
@@ -37,11 +37,11 @@ class SmscManagerTest < Test::Unit::TestCase
|
|
37
37
|
sms=SmscManager::Sms.new('hello scott','09996557890','websource')
|
38
38
|
begin
|
39
39
|
smsc=SmscManager::SmsSendTopic.new()
|
40
|
-
r=smsc.
|
40
|
+
r=smsc.send_topic_sms(sms)
|
41
41
|
end
|
42
42
|
puts "test send topic"
|
43
43
|
smsc=SmscManager::SmsSendTopic.new({:host => '127.0.0.1'})
|
44
|
-
r=smsc.
|
44
|
+
r=smsc.send_topic_sms(sms)
|
45
45
|
puts "test send topic after host"
|
46
46
|
end
|
47
47
|
def test_smsc_db
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: smsc_manager
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 0.4.8
|
7
|
+
date: 2007-10-03 00:00:00 +08:00
|
8
8
|
summary: connection to smsc via http using kannel
|
9
9
|
require_paths:
|
10
10
|
- lib
|