rservicebus 0.0.37 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rservicebus-init +103 -0
- metadata +4 -2
@@ -0,0 +1,103 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
############################################
|
6
|
+
ContentReadMe = StringIO.new( <<"END_DATA" )
|
7
|
+
#Req
|
8
|
+
|
9
|
+
##What
|
10
|
+
This is the starting point for RServiceBus
|
11
|
+
|
12
|
+
A single client, using the agent to send a message
|
13
|
+
|
14
|
+
A single message handler, running inside rservicebus which receives
|
15
|
+
the message and sends a reply
|
16
|
+
|
17
|
+
The client then picks up the reply
|
18
|
+
|
19
|
+
##How
|
20
|
+
make sure beanstalk is running, then
|
21
|
+
|
22
|
+
run the
|
23
|
+
./run
|
24
|
+
|
25
|
+
command in one terminal
|
26
|
+
|
27
|
+
in a second terminal, run
|
28
|
+
ruby Client.rb
|
29
|
+
END_DATA
|
30
|
+
|
31
|
+
|
32
|
+
############################################
|
33
|
+
ContentClient = StringIO.new( <<"END_DATA" )
|
34
|
+
require "rservicebus"
|
35
|
+
require "rservicebus/Agent"
|
36
|
+
require "./Contract"
|
37
|
+
|
38
|
+
agent = RServiceBus::Agent.new.getAgent( URI.parse( "beanstalk://localhost" ) )
|
39
|
+
|
40
|
+
1.upto(2) do |request_nbr|
|
41
|
+
agent.sendMsg(HelloWorld.new( "Hello World! " + request_nbr.to_s ), "HelloWorld", "helloResponse")
|
42
|
+
end
|
43
|
+
|
44
|
+
msg = agent.checkForReply( "helloResponse" )
|
45
|
+
puts msg
|
46
|
+
msg = agent.checkForReply( "helloResponse" )
|
47
|
+
puts msg
|
48
|
+
END_DATA
|
49
|
+
|
50
|
+
|
51
|
+
############################################
|
52
|
+
ContentRun = StringIO.new( <<"END_DATA" )
|
53
|
+
APPNAME=HelloWorld \
|
54
|
+
ERROR_QUEUE_NAME=error \
|
55
|
+
MAX_RETRIES=2 \
|
56
|
+
VERBOSE=true \
|
57
|
+
WORKING_DIR=./ \
|
58
|
+
rservicebus
|
59
|
+
END_DATA
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
############################################
|
64
|
+
ContentContract = StringIO.new( <<"END_DATA" )
|
65
|
+
class HelloWorld
|
66
|
+
attr_reader :name
|
67
|
+
def initialize( name )
|
68
|
+
@name = name
|
69
|
+
end
|
70
|
+
end
|
71
|
+
END_DATA
|
72
|
+
|
73
|
+
|
74
|
+
############################################
|
75
|
+
ContentMessageHandler = StringIO.new( <<"END_DATA" )
|
76
|
+
class MessageHandler_HelloWorld
|
77
|
+
|
78
|
+
attr_accessor :Bus
|
79
|
+
|
80
|
+
def Handle( msg )
|
81
|
+
#raise "Manually generated error for testng"
|
82
|
+
puts "Handling Hello World: " + msg.name
|
83
|
+
@Bus.Reply( "Hey. " + msg.name )
|
84
|
+
end
|
85
|
+
end
|
86
|
+
END_DATA
|
87
|
+
|
88
|
+
################################################################################################
|
89
|
+
class Init
|
90
|
+
|
91
|
+
def Run
|
92
|
+
IO.write( "README.md", ContentReadMe.string );
|
93
|
+
IO.write( "Client.rb", ContentClient.string );
|
94
|
+
IO.write( "Contract.rb", ContentContract.string );
|
95
|
+
IO.write( "run", ContentRun.string );
|
96
|
+
|
97
|
+
Dir.mkdir( "./MessageHandler" ) unless Dir.exists? "./MessageHandler";
|
98
|
+
IO.write( "MessageHandler/HelloWorld.rb", ContentMessageHandler.string );
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
Init.new.Run
|
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.38
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,13 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby interpretation of NServiceBus
|
15
15
|
email: guy@guyirvine.com
|
16
16
|
executables:
|
17
17
|
- rservicebus
|
18
|
+
- rservicebus-init
|
18
19
|
- ReturnErroredMessagesToSourceQueue
|
19
20
|
- ReturnErroredMessagesToSourceQueueBeanstalk
|
20
21
|
- ReturnErroredMessagesToSourceQueueBunny
|
@@ -58,6 +59,7 @@ files:
|
|
58
59
|
- bin/ReturnErroredMessagesToSourceQueueBeanstalk
|
59
60
|
- bin/ReturnErroredMessagesToSourceQueueBunny
|
60
61
|
- bin/rservicebus
|
62
|
+
- bin/rservicebus-init
|
61
63
|
- LICENSE
|
62
64
|
- README.md
|
63
65
|
homepage: http://rubygems.org/gems/rservicebus
|