onstomp 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dba24fe177cfa2ac236c6ceaed731d0b9d9f55720a9cf092a7c3501335c8d879
4
- data.tar.gz: 5e57ed6e6afa49e937df80f66c1dcc09ff4dd41a41e51dd5bec913fd93a52e15
3
+ metadata.gz: 1e7dbfd893a6b95f5f4ccd27d0cd52e020bc1bd18b860240e96f76ad4e68ab75
4
+ data.tar.gz: 18e70c1771dbe700fce021658c73197ffc59e4fcb163fdea06dd999283f136f6
5
5
  SHA512:
6
- metadata.gz: a64c0d26233c4fda27dd86145fc5a7055c88716551aec493d48530f311d5cd3825fb1a904e5c91055ea21daf0bdaeaca3a8b6227fa58721014e9f79abc5df3ce
7
- data.tar.gz: d2283694042fc1cc619bae2a0c05b64508a69de94f4b861460d2ffcfb79414d02663881793759e8592e63312ee00b9b426ee03fe438122e6cc5a5ee3025322f5
6
+ metadata.gz: 0d781f70aa092cda65cfb396ff5ae07e8fb547e7e292c9bfdd5bda5f4fb33aba4127d799c9ede0b0ea16b60ad1682c31d51d6c5f02082e1a74a8bb0b056e1bfe
7
+ data.tar.gz: 7d0a63dce9fa5257feb44593e684febc3010953750efbb71e1939b6480751472cc4a867f17d9c2b3a7cc6f936d16c2673510f1e5992821f9d045cf0e8c719053
@@ -1,10 +1,6 @@
1
1
  rvm:
2
- - 1.9.2
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.0
6
- - 2.2.2
7
- - jruby-18mode
8
- - jruby-19mode
9
-
2
+ - 2.3.7
3
+ - 2.4.4
4
+ - 2.5.1
5
+ - jruby-head
10
6
  bundler_args: --without docs
@@ -9,7 +9,7 @@ class OnStomp::Client
9
9
  include OnStomp::Interfaces::ReceiptManager
10
10
  include OnStomp::Interfaces::SubscriptionManager
11
11
  include OnStomp::Components::Scopes
12
-
12
+
13
13
  # The `URI` reference to the STOMP broker
14
14
  # @return [String]
15
15
  attr_reader :uri
@@ -19,51 +19,52 @@ class OnStomp::Client
19
19
  # Connection object specific to the established STOMP protocol version
20
20
  # @return [OnStomp::Connections::Base]
21
21
  attr_reader :connection
22
-
22
+
23
23
  # The protocol versions to allow for this connection
24
24
  # @return [Array<String>]
25
25
  attr_configurable_protocols :versions
26
-
26
+
27
27
  # The client-side heartbeat settings to allow for this connection
28
28
  # @return [Array<Fixnum>]
29
29
  attr_configurable_client_beats :heartbeats
30
-
30
+
31
31
  # The host header value to send to the broker when connecting. This allows
32
32
  # the client to inform the server which host it wishes to connect with
33
33
  # when multiple brokers may share an IP address through virtual hosting.
34
34
  # @return [String]
35
35
  attr_configurable_str :host, :default => 'localhost', :uri_attr => :host
36
-
36
+
37
37
  # The login header value to send to the broker when connecting.
38
38
  # @return [String]
39
39
  attr_configurable_str :login, :default => '', :uri_attr => :user
40
-
40
+
41
41
  # The passcode header value to send to the broker when connecting.
42
42
  # @return [String]
43
43
  attr_configurable_str :passcode, :default => '', :uri_attr => :password
44
-
44
+
45
45
  # The class to use when instantiating a new IO processor for the connection.
46
46
  # Defaults to {OnStomp::Components::ThreadedProcessor}
47
47
  # @return [Class]
48
48
  attr_configurable_processor :processor
49
-
49
+
50
50
  # The number of seconds to wait before a write-blocked connection is
51
51
  # considered dead. Defaults to 120 seconds.
52
52
  # @return [Fixnum]
53
53
  attr_configurable_int :write_timeout, :default => 120
54
-
54
+
55
55
  # The number of seconds to wait before a connection that is read-blocked
56
56
  # during the {OnStomp::Connections::Base#connect connect} phase is
57
57
  # considered dead. Defaults to 120 seconds.
58
58
  # @return [Fixnum]
59
59
  attr_configurable_int :read_timeout, :default => 120
60
-
60
+
61
61
  # @api gem:1 STOMP:1.0,1.1
62
62
  # Creates a new client for the specified uri and optional hash of options.
63
63
  # @param [String,URI] uri
64
64
  # @param [{Symbol => Object}] options
65
65
  def initialize uri, options={}
66
66
  @uri = uri.is_a?(::URI) ? uri : ::URI.parse(uri)
67
+ options = options.dup
67
68
  @ssl = options.delete(:ssl)
68
69
  configure_configurable options
69
70
  configure_subscription_management
@@ -72,7 +73,7 @@ class OnStomp::Client
72
73
  close unless f[:receipt]
73
74
  end
74
75
  end
75
-
76
+
76
77
  # @api gem:1 STOMP:1.0,1.1
77
78
  # Connects to the STOMP broker referenced by {#uri}. Includes optional
78
79
  # headers in the CONNECT frame, if specified.
@@ -91,7 +92,7 @@ class OnStomp::Client
91
92
  self
92
93
  end
93
94
  alias :open :connect
94
-
95
+
95
96
  # @api gem:1 STOMP:1.0,1.1
96
97
  # Sends a DISCONNECT frame to the broker and blocks until the connection
97
98
  # has been closed. This method ensures that all frames not yet sent to
@@ -106,14 +107,14 @@ class OnStomp::Client
106
107
  end
107
108
  alias :disconnect_without_flush :disconnect
108
109
  alias :disconnect :disconnect_with_flush
109
-
110
+
110
111
  # @api gem:1 STOMP:1.0,1.1
111
112
  # Returns true if a connection to the broker exists and itself is connected.
112
113
  # @return [true,false]
113
114
  def connected?
114
115
  connection && connection.connected?
115
116
  end
116
-
117
+
117
118
  # @api gem:1 STOMP:1.0,1.1
118
119
  # Forces the connection between broker and client closed.
119
120
  # @note Use of this method may result in frames never being sent to the
@@ -125,9 +126,9 @@ class OnStomp::Client
125
126
  processor_inst.stop
126
127
  self
127
128
  end
128
-
129
+
129
130
  # @group Methods you ought not use directly.
130
-
131
+
131
132
  # Ultimately sends a {OnStomp::Components::Frame frame} to the STOMP broker.
132
133
  # This method should not be invoked directly. Use the frame methods provided
133
134
  # by the {OnStomp::Interfaces:FrameMethod} interface.
@@ -139,32 +140,32 @@ class OnStomp::Client
139
140
  connection && connection.write_frame_nonblock(frame)
140
141
  end
141
142
  end
142
-
143
+
143
144
  # Called by {#connection} when a frame has been read from the socket
144
145
  # connection to the STOMP broker.
145
146
  def dispatch_received frame
146
147
  trigger_before_receiving frame
147
148
  trigger_after_receiving frame
148
149
  end
149
-
150
+
150
151
  # Called by {#connection} when a frame has been written to the socket
151
152
  # connection to the STOMP broker.
152
153
  def dispatch_transmitted frame
153
154
  trigger_after_transmitting frame
154
155
  end
155
-
156
+
156
157
  # @endgroup
157
-
158
+
158
159
  private
159
160
  def register_callbacks f, cbs
160
161
  cbs[:subscribe] && add_subscription(f, cbs[:subscribe])
161
162
  cbs[:receipt] && add_receipt(f, cbs[:receipt])
162
163
  end
163
-
164
+
164
165
  def processor_inst
165
166
  @processor_inst ||= processor.new(self)
166
167
  end
167
-
168
+
168
169
  def close
169
170
  connection && connection.close
170
171
  clear_subscriptions
@@ -7,7 +7,7 @@ module OnStomp
7
7
  # Minor / feature version
8
8
  MINOR = 0
9
9
  # Patch version
10
- PATCH = 11
10
+ PATCH = 12
11
11
  # Complete version
12
12
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
13
13
  end
@@ -54,6 +54,19 @@ module OnStomp::Failover
54
54
  login: 'user_name'
55
55
  })
56
56
  end
57
+
58
+ it 'passes the ssl settings to both clients in the pool' do
59
+ c = Client.new('failover:(stomp:///,stomp+ssl:///)', {
60
+ buffer: 'OnStomp::Failover::DummyBuffer',
61
+ retry_attempts: 2,
62
+ ssl: { ca_file: 'ca.crt' },
63
+ login: 'user_name'
64
+ })
65
+
66
+ c.client_pool.clients.count.should == 2
67
+ c.client_pool.clients[0].ssl.should == { ca_file: 'ca.crt' }
68
+ c.client_pool.clients[1].ssl.should == { ca_file: 'ca.crt' }
69
+ end
57
70
  end
58
71
 
59
72
  describe ".connected?" do
@@ -70,7 +83,7 @@ module OnStomp::Failover
70
83
  client.connected?.should be_false
71
84
  end
72
85
  end
73
-
86
+
74
87
  describe ".connect" do
75
88
  it "should call reconnect" do
76
89
  client.should_receive(:reconnect).and_return(true)
@@ -94,7 +107,7 @@ module OnStomp::Failover
94
107
  triggered.should be_true
95
108
  end
96
109
  end
97
-
110
+
98
111
  describe ".disconnect" do
99
112
  let(:connection) {
100
113
  mock('connection').tap do |m|
@@ -132,7 +145,7 @@ module OnStomp::Failover
132
145
  Thread.pass while t.alive?
133
146
  actual_disconnect.call *args
134
147
  end
135
-
148
+
136
149
  active_client.should_receive(:disconnect).with(:header1 => 'value 1')
137
150
  client.disconnect :header1 => 'value 1'
138
151
  end
@@ -158,7 +171,7 @@ module OnStomp::Failover
158
171
  client.disconnect :header1 => 'value 1'
159
172
  end
160
173
  end
161
-
174
+
162
175
  describe ".transmit" do
163
176
  it "should transmit on the active client if there is one" do
164
177
  active_client.should_receive(:transmit).with('test', :coming => 'home')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onstomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian D. Eccles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-18 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec