rservicebus 0.0.40 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/SendEmptyMessage +21 -0
- data/lib/rservicebus/Host.rb +23 -1
- metadata +4 -2
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rservicebus"
|
4
|
+
require "rservicebus/Agent"
|
5
|
+
|
6
|
+
def CreateAnonymousClass( name_for_class )
|
7
|
+
newAnonymousClass = Class.new(Object)
|
8
|
+
Object.const_set( name_for_class, newAnonymousClass )
|
9
|
+
return Object.const_get( name_for_class ).new
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
abort( "Usage: #{__FILE__} <Msg Name> <Queue Name> [Response Queue Name] [Beanstalk Host]" ) unless ARGV.length >=2 && ARGV.length <=4
|
14
|
+
msg_name = ARGV[0]
|
15
|
+
queue_name = ARGV[1]
|
16
|
+
response_queue_name = "#{queue_name}Response" if ARGV.length >= 3
|
17
|
+
beanstalkHost = "beanstalk://localhost" if ARGV.length == 4
|
18
|
+
|
19
|
+
agent = RServiceBus::Agent.new.getAgent( URI.parse( "beanstalk://localhost" ) )
|
20
|
+
msg = CreateAnonymousClass( msg_name )
|
21
|
+
agent.sendMsg(msg, queue_name, response_queue_name)
|
data/lib/rservicebus/Host.rb
CHANGED
@@ -22,6 +22,10 @@ module RServiceBus
|
|
22
22
|
|
23
23
|
@stats
|
24
24
|
|
25
|
+
#Provides a thin logging veneer
|
26
|
+
#
|
27
|
+
# @param [String] string Log entry
|
28
|
+
# @param [Boolean] ver Indicator for a verbose log entry
|
25
29
|
def log(string, ver=false)
|
26
30
|
type = ver ? "VERB" : "INFO"
|
27
31
|
if @config.verbose || !ver then
|
@@ -30,11 +34,15 @@ module RServiceBus
|
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
37
|
+
#Thin veneer for Configuring external resources
|
38
|
+
#
|
33
39
|
def configureAppResource
|
34
40
|
@appResources = ConfigureAppResource.new.getResources( ENV )
|
35
41
|
return self;
|
36
42
|
end
|
37
43
|
|
44
|
+
#Thin veneer for Configuring the Message Queue
|
45
|
+
#
|
38
46
|
def connectToMq
|
39
47
|
@mq = ConfigureMQ.new.get( @config.mqHost + "/" + @config.localQueueName, @config.queueTimeout )
|
40
48
|
|
@@ -57,6 +65,8 @@ module RServiceBus
|
|
57
65
|
return self
|
58
66
|
end
|
59
67
|
|
68
|
+
#Load and configure Message Handlers
|
69
|
+
#
|
60
70
|
def loadHandlers()
|
61
71
|
log "Load Message Handlers"
|
62
72
|
@handlerLoader = HandlerLoader.new( self, @appResources )
|
@@ -71,6 +81,8 @@ module RServiceBus
|
|
71
81
|
return self
|
72
82
|
end
|
73
83
|
|
84
|
+
#Load Contracts
|
85
|
+
#
|
74
86
|
def loadContracts()
|
75
87
|
log "Load Contracts"
|
76
88
|
|
@@ -81,6 +93,8 @@ module RServiceBus
|
|
81
93
|
return self
|
82
94
|
end
|
83
95
|
|
96
|
+
#For each directory given, find and load all librarys
|
97
|
+
#
|
84
98
|
def loadLibs()
|
85
99
|
log "Load Libs"
|
86
100
|
|
@@ -97,6 +111,8 @@ module RServiceBus
|
|
97
111
|
return self
|
98
112
|
end
|
99
113
|
|
114
|
+
#Load, configure and initialise Subscriptions
|
115
|
+
#
|
100
116
|
def configureSubscriptions
|
101
117
|
subscriptionStorage = ConfigureSubscriptionStorage.new.get( @config.appName, @config.subscriptionUri )
|
102
118
|
@subscriptionManager = SubscriptionManager.new( subscriptionStorage )
|
@@ -104,6 +120,8 @@ module RServiceBus
|
|
104
120
|
return self
|
105
121
|
end
|
106
122
|
|
123
|
+
#Initialise statistics monitor
|
124
|
+
#
|
107
125
|
def configureStatistics
|
108
126
|
@stats = Stats.new
|
109
127
|
|
@@ -134,6 +152,8 @@ module RServiceBus
|
|
134
152
|
return self
|
135
153
|
end
|
136
154
|
|
155
|
+
#Ignition
|
156
|
+
#
|
137
157
|
def run
|
138
158
|
log "Starting the Host"
|
139
159
|
|
@@ -243,6 +263,7 @@ module RServiceBus
|
|
243
263
|
end
|
244
264
|
|
245
265
|
#Send the current msg to the appropriate handlers
|
266
|
+
#
|
246
267
|
def HandleMessage()
|
247
268
|
msgName = @msg.msg.class.name
|
248
269
|
handlerList = @handlerList[msgName]
|
@@ -252,6 +273,7 @@ module RServiceBus
|
|
252
273
|
puts "No handler found for: " + msgName
|
253
274
|
puts YAML::dump(@msg)
|
254
275
|
raise "No Handler Found"
|
276
|
+
|
255
277
|
else
|
256
278
|
log "Handler found for: " + msgName, true
|
257
279
|
handlerList.each do |handler|
|
@@ -265,7 +287,7 @@ module RServiceBus
|
|
265
287
|
end
|
266
288
|
end
|
267
289
|
end
|
268
|
-
|
290
|
+
|
269
291
|
#Sends a msg across the bus
|
270
292
|
#
|
271
293
|
# @param [String] serialized_object serialized RServiceBus::Message
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rservicebus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.41
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby interpretation of NServiceBus
|
15
15
|
email: guy@guyirvine.com
|
@@ -19,6 +19,7 @@ executables:
|
|
19
19
|
- ReturnErroredMessagesToSourceQueue
|
20
20
|
- ReturnErroredMessagesToSourceQueueBeanstalk
|
21
21
|
- ReturnErroredMessagesToSourceQueueBunny
|
22
|
+
- SendEmptyMessage
|
22
23
|
extensions: []
|
23
24
|
extra_rdoc_files: []
|
24
25
|
files:
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- bin/ReturnErroredMessagesToSourceQueueBunny
|
61
62
|
- bin/rservicebus
|
62
63
|
- bin/rservicebus-init
|
64
|
+
- bin/SendEmptyMessage
|
63
65
|
- LICENSE
|
64
66
|
- README.md
|
65
67
|
homepage: http://rubygems.org/gems/rservicebus
|