rservicebus 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rservicebus/Transporter.rb +27 -9
- metadata +1 -1
@@ -32,7 +32,7 @@ module RServiceBus
|
|
32
32
|
sourceUrl = getValue( 'SOURCE_URL', "127.0.0.1:11300" )
|
33
33
|
@source = Beanstalk::Pool.new([sourceUrl])
|
34
34
|
@source.watch sourceQueueName
|
35
|
-
|
35
|
+
|
36
36
|
log "Connected to, #{sourceQueueName}@#{sourceUrl}"
|
37
37
|
|
38
38
|
rescue Exception => e
|
@@ -57,7 +57,7 @@ module RServiceBus
|
|
57
57
|
|
58
58
|
@destination.close unless @destination.nil?
|
59
59
|
@destination = nil
|
60
|
-
|
60
|
+
|
61
61
|
@remoteUserName = nil
|
62
62
|
@remoteQueueName = nil
|
63
63
|
end
|
@@ -68,19 +68,37 @@ module RServiceBus
|
|
68
68
|
if @gateway.nil? || remoteHostName != @remoteHostName || @destination.nil? then
|
69
69
|
self.disconnect
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
if @gateway.nil? then
|
73
73
|
#Get destination url from job
|
74
74
|
@remoteHostName = remoteHostName
|
75
|
-
@remoteUserName = getValue( "REMOTE_USER_#{remoteHostName.upcase}"
|
75
|
+
@remoteUserName = getValue( "REMOTE_USER_#{remoteHostName.upcase}" )
|
76
|
+
if @remoteUserName.nil? then
|
77
|
+
log "**** Username not specified for Host, #{remoteHostName}"
|
78
|
+
log "**** Add an environment variable of the form, REMOTE_USER_#{remoteHostName.upcase}=[USERNAME]"
|
79
|
+
abort()
|
80
|
+
end
|
76
81
|
|
77
82
|
@localPort = getValue( "LOCAL_PORT", 27018 ).to_i
|
83
|
+
log "Local Port: #{@localPort}", true
|
78
84
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
85
|
+
begin
|
86
|
+
log "Connect SSH, #{@remoteUserName}@#{@remoteHostName}"
|
87
|
+
# Open port 27018 to forward to 127.0.0.11300 on the remote host
|
88
|
+
@gateway = Net::SSH::Gateway.new(@remoteHostName, @remoteUserName)
|
89
|
+
@gateway.open('127.0.0.1', 11300, @localPort)
|
90
|
+
log "Connected to SSH, #{@remoteUserName}@#{@remoteHostName}"
|
91
|
+
|
92
|
+
rescue Errno::EADDRINUSE => e
|
93
|
+
puts "*** Local transport port in use, #{@localPort}"
|
94
|
+
puts "*** Change local transport port, #{@localPort}, using format, LOCAL_PORT=#{@localPort+1}"
|
95
|
+
abort()
|
96
|
+
rescue Errno::EACCES => e
|
97
|
+
puts "*** Local transport port specified, #{@localPort}, needs sudo access"
|
98
|
+
puts "*** Change local transport port using format, LOCAL_PORT=27018"
|
99
|
+
abort()
|
100
|
+
|
101
|
+
end
|
84
102
|
|
85
103
|
begin
|
86
104
|
destinationUrl = "127.0.0.1:#{@localPort}"
|