qpid_proton 0.18.1 → 0.19.0
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.
- checksums.yaml +4 -4
- data/ext/cproton/cproton.c +863 -75
- data/lib/codec/data.rb +589 -815
- data/lib/codec/mapping.rb +142 -126
- data/lib/core/condition.rb +89 -0
- data/lib/core/connection.rb +188 -228
- data/lib/core/connection_driver.rb +202 -0
- data/lib/core/container.rb +366 -0
- data/lib/core/delivery.rb +76 -251
- data/lib/core/disposition.rb +21 -35
- data/lib/core/endpoint.rb +21 -53
- data/lib/core/event.rb +156 -0
- data/lib/core/exceptions.rb +109 -106
- data/lib/core/link.rb +24 -49
- data/lib/core/listener.rb +82 -0
- data/lib/core/message.rb +59 -155
- data/lib/core/messaging_handler.rb +190 -0
- data/lib/core/receiver.rb +38 -7
- data/lib/core/sasl.rb +43 -46
- data/lib/core/sender.rb +55 -32
- data/lib/core/session.rb +58 -58
- data/lib/core/ssl.rb +5 -13
- data/lib/core/ssl_details.rb +1 -2
- data/lib/core/ssl_domain.rb +5 -8
- data/lib/core/terminus.rb +62 -30
- data/lib/core/tracker.rb +45 -0
- data/lib/core/transfer.rb +121 -0
- data/lib/core/transport.rb +62 -97
- data/lib/core/uri.rb +73 -0
- data/lib/core/url.rb +11 -7
- data/lib/handler/adapter.rb +78 -0
- data/lib/handler/messaging_adapter.rb +127 -0
- data/lib/handler/messaging_handler.rb +128 -178
- data/lib/handler/reactor_messaging_adapter.rb +158 -0
- data/lib/messenger/messenger.rb +9 -8
- data/lib/messenger/subscription.rb +1 -2
- data/lib/messenger/tracker.rb +1 -2
- data/lib/messenger/tracker_status.rb +1 -2
- data/lib/qpid_proton.rb +36 -66
- data/lib/reactor/container.rb +40 -234
- data/lib/types/array.rb +73 -130
- data/lib/types/described.rb +2 -44
- data/lib/types/hash.rb +19 -56
- data/lib/types/strings.rb +1 -2
- data/lib/types/type.rb +68 -0
- data/lib/util/{handler.rb → deprecation.rb} +22 -15
- data/lib/util/error_handler.rb +4 -25
- data/lib/util/timeout.rb +1 -2
- data/lib/util/version.rb +1 -2
- data/lib/util/wrapper.rb +58 -38
- metadata +16 -33
- data/lib/core/base_handler.rb +0 -31
- data/lib/core/selectable.rb +0 -130
- data/lib/event/collector.rb +0 -148
- data/lib/event/event.rb +0 -318
- data/lib/event/event_base.rb +0 -91
- data/lib/event/event_type.rb +0 -71
- data/lib/handler/acking.rb +0 -70
- data/lib/handler/c_adaptor.rb +0 -47
- data/lib/handler/c_flow_controller.rb +0 -33
- data/lib/handler/endpoint_state_handler.rb +0 -217
- data/lib/handler/incoming_message_handler.rb +0 -74
- data/lib/handler/outgoing_message_handler.rb +0 -100
- data/lib/handler/wrapped_handler.rb +0 -76
- data/lib/reactor/acceptor.rb +0 -41
- data/lib/reactor/backoff.rb +0 -41
- data/lib/reactor/connector.rb +0 -115
- data/lib/reactor/global_overrides.rb +0 -44
- data/lib/reactor/link_option.rb +0 -90
- data/lib/reactor/reactor.rb +0 -196
- data/lib/reactor/session_per_connection.rb +0 -45
- data/lib/reactor/ssl_config.rb +0 -41
- data/lib/reactor/task.rb +0 -39
- data/lib/reactor/urls.rb +0 -45
- data/lib/util/class_wrapper.rb +0 -54
- data/lib/util/condition.rb +0 -47
- data/lib/util/constants.rb +0 -85
- data/lib/util/engine.rb +0 -82
- data/lib/util/reactor.rb +0 -32
- data/lib/util/swig_helper.rb +0 -114
- data/lib/util/uuid.rb +0 -32
@@ -0,0 +1,190 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
|
19
|
+
module Qpid::Proton
|
20
|
+
|
21
|
+
# A handler for AMQP messaging events.
|
22
|
+
#
|
23
|
+
# Subclass the handler and provide the #on_xxx methods with your event-handling code.
|
24
|
+
#
|
25
|
+
# An AMQP endpoint (connection, session or link) must be opened and closed at
|
26
|
+
# each end. Normally proton responds automatically to an incoming
|
27
|
+
# open/close. You can prevent the automatic response by raising
|
28
|
+
# {StopAutoResponse} from +#on_xxx_open+ or +#on_xxx_close+. The application becomes responsible
|
29
|
+
# for calling +#open/#close+ at a later point.
|
30
|
+
#
|
31
|
+
class MessagingHandler
|
32
|
+
|
33
|
+
# @return [Hash] handler options, see {#initialize}
|
34
|
+
attr_reader :options
|
35
|
+
|
36
|
+
# @!group Most common events
|
37
|
+
|
38
|
+
# @!method on_container_start(container)
|
39
|
+
# The container event loop is started
|
40
|
+
# @param container [Container] The container.
|
41
|
+
|
42
|
+
# @!method on_container_stop(container)
|
43
|
+
# The container event loop is stopped
|
44
|
+
# @param container [Container] The container.
|
45
|
+
|
46
|
+
# @!method on_message(delivery, message)
|
47
|
+
# A message is received.
|
48
|
+
# @param delivery [Delivery] The delivery.
|
49
|
+
# @param message [Message] The message
|
50
|
+
|
51
|
+
# @!method on_sendable(sender)
|
52
|
+
# A message can be sent
|
53
|
+
# @param sender [Sender] The sender.
|
54
|
+
|
55
|
+
# @!endgroup
|
56
|
+
|
57
|
+
# @!group Endpoint lifecycle events
|
58
|
+
|
59
|
+
# @!method on_connection_open(connection)
|
60
|
+
# The remote peer opened the connection
|
61
|
+
# @param connection
|
62
|
+
|
63
|
+
# @!method on_connection_close(connection)
|
64
|
+
# The remote peer closed the connection
|
65
|
+
# @param connection
|
66
|
+
|
67
|
+
# @!method on_connection_error(connection)
|
68
|
+
# The remote peer closed the connection with an error condition
|
69
|
+
# @param connection
|
70
|
+
|
71
|
+
# @!method on_session_open(session)
|
72
|
+
# The remote peer opened the session
|
73
|
+
# @param session
|
74
|
+
|
75
|
+
# @!method on_session_close(session)
|
76
|
+
# The remote peer closed the session
|
77
|
+
# @param session
|
78
|
+
|
79
|
+
# @!method on_session_error(session)
|
80
|
+
# The remote peer closed the session with an error condition
|
81
|
+
# @param session
|
82
|
+
|
83
|
+
# @!method on_sender_open(sender)
|
84
|
+
# The remote peer opened the sender
|
85
|
+
# @param sender
|
86
|
+
|
87
|
+
# @!method on_sender_detach(sender)
|
88
|
+
# The remote peer detached the sender
|
89
|
+
# @param sender
|
90
|
+
|
91
|
+
# @!method on_sender_close(sender)
|
92
|
+
# The remote peer closed the sender
|
93
|
+
# @param sender
|
94
|
+
|
95
|
+
# @!method on_sender_error(sender)
|
96
|
+
# The remote peer closed the sender with an error condition
|
97
|
+
# @param sender
|
98
|
+
|
99
|
+
# @!method on_receiver_open(receiver)
|
100
|
+
# The remote peer opened the receiver
|
101
|
+
# @param receiver
|
102
|
+
|
103
|
+
# @!method on_receiver_detach(receiver)
|
104
|
+
# The remote peer detached the receiver
|
105
|
+
# @param receiver
|
106
|
+
|
107
|
+
# @!method on_receiver_close(receiver)
|
108
|
+
# The remote peer closed the receiver
|
109
|
+
# @param receiver
|
110
|
+
|
111
|
+
# @!method on_receiver_error(receiver)
|
112
|
+
# The remote peer closed the receiver with an error condition
|
113
|
+
# @param receiver
|
114
|
+
|
115
|
+
# @!endgroup
|
116
|
+
|
117
|
+
# @!group Delivery events
|
118
|
+
|
119
|
+
# @!method on_tracker_accept(tracker)
|
120
|
+
# The receiving end accepted a delivery
|
121
|
+
# @param tracker [Tracker] The tracker.
|
122
|
+
|
123
|
+
# @!method on_tracker_reject(tracker)
|
124
|
+
# The receiving end rejected a delivery
|
125
|
+
# @param tracker [Tracker] The tracker.
|
126
|
+
|
127
|
+
# @!method on_tracker_release(tracker)
|
128
|
+
# The receiving end released a delivery
|
129
|
+
# @param tracker [Tracker] The tracker.
|
130
|
+
|
131
|
+
# @!method on_tracker_modify(tracker)
|
132
|
+
# The receiving end modified a delivery
|
133
|
+
# @param tracker [Tracker] The tracker.
|
134
|
+
|
135
|
+
# @!method on_tracker_settle(tracker)
|
136
|
+
# The receiving end settled a delivery
|
137
|
+
# @param tracker [Tracker] The tracker.
|
138
|
+
|
139
|
+
# @!method on_delivery_settle(delivery)
|
140
|
+
# The sending end settled a delivery
|
141
|
+
# @param delivery [Delivery] The delivery.
|
142
|
+
|
143
|
+
# @!method on_delivery_abort(delivery)
|
144
|
+
# A message was begun but aborted by the sender, so was not received.
|
145
|
+
# @param delivery [Delivery] The delivery.
|
146
|
+
|
147
|
+
# @!endgroup
|
148
|
+
|
149
|
+
# @!group Flow control events
|
150
|
+
|
151
|
+
# @!method on_sender_drain_start(sender)
|
152
|
+
# The remote end of the sender requested draining
|
153
|
+
# @param sender [Sender] The sender.
|
154
|
+
|
155
|
+
# @!method on_receiver_drain_finish(receiver)
|
156
|
+
# The remote end of the receiver completed draining
|
157
|
+
# @param receiver [Receiver] The receiver.
|
158
|
+
|
159
|
+
# @!endgroup
|
160
|
+
|
161
|
+
# @!group Transport events
|
162
|
+
|
163
|
+
# @!method on_transport_open(transport)
|
164
|
+
# The underlying network channel opened
|
165
|
+
# @param transport [Transport] The transport.
|
166
|
+
|
167
|
+
# @!method on_transport_close(transport)
|
168
|
+
# The underlying network channel closed
|
169
|
+
# @param transport [Transport] The transport.
|
170
|
+
|
171
|
+
# @!method on_transport_error(transport)
|
172
|
+
# The underlying network channel is closing due to an error.
|
173
|
+
# @param transport [Transport] The transport.
|
174
|
+
|
175
|
+
# @!endgroup
|
176
|
+
|
177
|
+
# @!group Unhandled events
|
178
|
+
|
179
|
+
# @!method on_error(error_condition)
|
180
|
+
# The fallback error handler when no specific on_xxx_error is defined
|
181
|
+
# @param error_condition [Condition] Provides information about the error.
|
182
|
+
|
183
|
+
# @!method on_unhandled(method_name, *args)
|
184
|
+
# Called for events with no handler. Similar to ruby's standard #method_
|
185
|
+
# @param method_name [Symbol] Name of the event method that would have been called.
|
186
|
+
# @param args [Array] Arguments that would have been passed
|
187
|
+
|
188
|
+
# @!endgroup
|
189
|
+
end
|
190
|
+
end
|
data/lib/core/receiver.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# Licensed to the Apache Software Foundation (ASF) under one
|
3
2
|
# or more contributor license agreements. See the NOTICE file
|
4
3
|
# distributed with this work for additional information
|
@@ -15,7 +14,7 @@
|
|
15
14
|
# KIND, either express or implied. See the License for the
|
16
15
|
# specific language governing permissions and limitations
|
17
16
|
# under the License.
|
18
|
-
|
17
|
+
|
19
18
|
|
20
19
|
module Qpid::Proton
|
21
20
|
|
@@ -25,11 +24,43 @@ module Qpid::Proton
|
|
25
24
|
#
|
26
25
|
class Receiver < Link
|
27
26
|
|
28
|
-
# @private
|
29
|
-
include Util::SwigHelper
|
30
|
-
|
31
27
|
# @private
|
32
28
|
PROTON_METHOD_PREFIX = "pn_link"
|
29
|
+
# @private
|
30
|
+
include Util::Wrapper
|
31
|
+
|
32
|
+
# Open {Receiver} link
|
33
|
+
#
|
34
|
+
# @overload open_receiver(address)
|
35
|
+
# @param address [String] address of the source to receive from
|
36
|
+
# @overload open_receiver(opts)
|
37
|
+
# @param opts [Hash] Receiver options, see {Receiver#open}
|
38
|
+
# @option opts [Boolean] :credit_window automatically maintain this much credit
|
39
|
+
# for messages to be pre-fetched while the current message is processed.
|
40
|
+
# @option opts [Boolean] :auto_accept if true, deliveries that are not settled by
|
41
|
+
# the application in {MessagingHandler#on_message} are automatically accepted.
|
42
|
+
# @option opts [Integer] :credit_window (10) automatically replenish credits for flow control.
|
43
|
+
# @option opts [Boolean] :dynamic (false) dynamic property for source {Terminus#dynamic}
|
44
|
+
# @option opts [String,Hash] :source source address or source options, see {Terminus#apply}
|
45
|
+
# @option opts [String,Hash] :target target address or target options, see {Terminus#apply}
|
46
|
+
# @option opts [String] :name (generated) unique name for the link.
|
47
|
+
def open(opts=nil)
|
48
|
+
opts ||= {}
|
49
|
+
opts = { :source => opts } if opts.is_a? String
|
50
|
+
@credit_window = opts.fetch(:credit_window, 10)
|
51
|
+
@auto_accept = opts.fetch(:auto_accept, true)
|
52
|
+
source.apply(opts[:source])
|
53
|
+
target.apply(opts[:target])
|
54
|
+
source.dynamic = !!opts[:dynamic]
|
55
|
+
super()
|
56
|
+
self
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [Integer] credit window, see {#open}
|
60
|
+
attr_reader :credit_window
|
61
|
+
|
62
|
+
# @return [Boolean] auto_accept flag, see {#open}
|
63
|
+
attr_reader :auto_accept
|
33
64
|
|
34
65
|
# @!attribute drain
|
35
66
|
#
|
@@ -43,7 +74,7 @@ module Qpid::Proton
|
|
43
74
|
#
|
44
75
|
# @return [Boolean] True if drain mode is set.
|
45
76
|
#
|
46
|
-
|
77
|
+
proton_set_get :drain
|
47
78
|
|
48
79
|
# @!attribute [r] draining?
|
49
80
|
#
|
@@ -77,7 +108,7 @@ module Qpid::Proton
|
|
77
108
|
# @param limit [Integer] The maximum bytes to receive.
|
78
109
|
#
|
79
110
|
# @return [Integer, nil] The number of bytes received, or nil if the end of
|
80
|
-
# the stream was reached.
|
111
|
+
# the stream was reached.
|
81
112
|
#
|
82
113
|
# @see Deliver#pending To see how much buffer space is needed.
|
83
114
|
#
|
data/lib/core/sasl.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# Licensed to the Apache Software Foundation (ASF) under one
|
3
2
|
# or more contributor license agreements. See the NOTICE file
|
4
3
|
# distributed with this work for additional information
|
@@ -15,7 +14,7 @@
|
|
15
14
|
# KIND, either express or implied. See the License for the
|
16
15
|
# specific language governing permissions and limitations
|
17
16
|
# under the License.
|
18
|
-
|
17
|
+
|
19
18
|
|
20
19
|
module Qpid::Proton
|
21
20
|
|
@@ -30,6 +29,7 @@ module Qpid::Proton
|
|
30
29
|
#
|
31
30
|
# @note Do not instantiate directly, use {Transport#sasl} to create a SASL object.
|
32
31
|
class SASL
|
32
|
+
include Util::Deprecation
|
33
33
|
|
34
34
|
# Negotation has not completed.
|
35
35
|
NONE = Cproton::PN_SASL_NONE
|
@@ -40,7 +40,7 @@ module Qpid::Proton
|
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
-
include Util::
|
43
|
+
include Util::Wrapper
|
44
44
|
PROTON_METHOD_PREFIX = "pn_sasl"
|
45
45
|
|
46
46
|
public
|
@@ -53,11 +53,11 @@ module Qpid::Proton
|
|
53
53
|
|
54
54
|
# @!attribute allow_insecure_mechs
|
55
55
|
# @return [Bool] true if clear text authentication is allowed on insecure connections.
|
56
|
-
|
56
|
+
proton_set_get :allow_insecure_mechs
|
57
57
|
|
58
58
|
# @!attribute user [r]
|
59
59
|
# @return [String] the authenticated user name
|
60
|
-
|
60
|
+
proton_get :user
|
61
61
|
|
62
62
|
# Set the mechanisms allowed for SASL negotation
|
63
63
|
# @param mechanisms [String] space-delimited list of allowed mechanisms
|
@@ -66,9 +66,7 @@ module Qpid::Proton
|
|
66
66
|
end
|
67
67
|
|
68
68
|
# @deprecated use {#allowed_mechs=}
|
69
|
-
|
70
|
-
self.allowed_mechs = m
|
71
|
-
end
|
69
|
+
deprecated_alias :mechanisms, :allowed_mechs=
|
72
70
|
|
73
71
|
# True if extended SASL negotiation is supported
|
74
72
|
#
|
@@ -83,44 +81,43 @@ module Qpid::Proton
|
|
83
81
|
Cproton.pn_sasl_extended()
|
84
82
|
end
|
85
83
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
self.config_name = name
|
84
|
+
class << self
|
85
|
+
include Util::Deprecation
|
86
|
+
|
87
|
+
# Set the sasl configuration path
|
88
|
+
#
|
89
|
+
# This is used to tell SASL where to look for the configuration file.
|
90
|
+
# In the current implementation it can be a colon separated list of directories.
|
91
|
+
#
|
92
|
+
# The environment variable PN_SASL_CONFIG_PATH can also be used to set this path,
|
93
|
+
# but if both methods are used then this pn_sasl_config_path() will take precedence.
|
94
|
+
#
|
95
|
+
# If not set the underlying implementation default will be used.
|
96
|
+
#
|
97
|
+
# @param path the configuration path
|
98
|
+
#
|
99
|
+
def config_path=(path)
|
100
|
+
Cproton.pn_sasl_config_path(nil, path)
|
101
|
+
path
|
102
|
+
end
|
103
|
+
|
104
|
+
# Set the configuration file name, without extension
|
105
|
+
#
|
106
|
+
# The name with an a ".conf" extension will be searched for in the
|
107
|
+
# configuration path. If not set, it defaults to "proton-server" or
|
108
|
+
# "proton-client" for a server (incoming) or client (outgoing) connection
|
109
|
+
# respectively.
|
110
|
+
#
|
111
|
+
# @param name the configuration file name without extension
|
112
|
+
#
|
113
|
+
def config_name=(name)
|
114
|
+
Cproton.pn_sasl_config_name(nil, name)
|
115
|
+
end
|
116
|
+
|
117
|
+
# @deprecated use {config_path=}
|
118
|
+
deprecated_alias :config_path, :config_path=
|
119
|
+
# @deprecated use {config_name=}
|
120
|
+
deprecated_alias :config_name, :config_name=
|
124
121
|
end
|
125
122
|
end
|
126
123
|
end
|
data/lib/core/sender.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# Licensed to the Apache Software Foundation (ASF) under one
|
3
2
|
# or more contributor license agreements. See the NOTICE file
|
4
3
|
# distributed with this work for additional information
|
@@ -15,7 +14,7 @@
|
|
15
14
|
# KIND, either express or implied. See the License for the
|
16
15
|
# specific language governing permissions and limitations
|
17
16
|
# under the License.
|
18
|
-
|
17
|
+
|
19
18
|
|
20
19
|
module Qpid::Proton
|
21
20
|
|
@@ -28,49 +27,73 @@ module Qpid::Proton
|
|
28
27
|
# @private
|
29
28
|
include Util::ErrorHandler
|
30
29
|
|
31
|
-
#
|
32
|
-
can_raise_error :stream, :error_class => Qpid::Proton::LinkError
|
33
|
-
|
34
|
-
# Signals the availability of deliveries.
|
30
|
+
# Open the {Sender} link
|
35
31
|
#
|
32
|
+
# @overload open_sender(address)
|
33
|
+
# @param address [String] address of the target to send to
|
34
|
+
# @overload open_sender(opts)
|
35
|
+
# @option opts [Boolean] :auto_settle (true) if true, automatically settle transfers
|
36
|
+
# @option opts [Boolean] :dynamic (false) dynamic property for source {Terminus#dynamic}
|
37
|
+
# @option opts [String,Hash] :source source address or source options, see {Terminus#apply}
|
38
|
+
# @option opts [String,Hash] :target target address or target options, see {Terminus#apply}
|
39
|
+
# @option opts [String] :name (generated) unique name for the link.
|
40
|
+
def open(opts=nil)
|
41
|
+
opts = { :target => opts } if opts.is_a? String
|
42
|
+
opts ||= {}
|
43
|
+
target.apply opts[:target]
|
44
|
+
source.apply opts[:source]
|
45
|
+
target.dynamic = !!opts[:dynamic]
|
46
|
+
@auto_settle = opts.fetch(:auto_settle, true)
|
47
|
+
super()
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Boolean] auto_settle flag, see {#open}
|
52
|
+
attr_reader :auto_settle
|
53
|
+
|
54
|
+
# Hint to the remote receiver about the number of messages available.
|
55
|
+
# The receiver may use this to optimize credit flow, or may ignore it.
|
36
56
|
# @param n [Integer] The number of deliveries potentially available.
|
37
|
-
#
|
38
57
|
def offered(n)
|
39
58
|
Cproton.pn_link_offered(@impl, n)
|
40
59
|
end
|
41
60
|
|
42
|
-
#
|
43
|
-
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
# @return [
|
48
|
-
|
49
|
-
|
50
|
-
if
|
51
|
-
|
52
|
-
|
53
|
-
|
61
|
+
# TODO aconway 2017-12-05: incompatible, used to return bytes sent.
|
62
|
+
|
63
|
+
# @!method send(message)
|
64
|
+
# Send a message.
|
65
|
+
# @param message [Message] The message to send.
|
66
|
+
# @return [Tracker] Tracks the outcome of the message.
|
67
|
+
def send(message, *args)
|
68
|
+
tag = nil
|
69
|
+
if args.size > 0
|
70
|
+
# deprecated: allow tag in args[0] for backwards compat
|
71
|
+
raise ArgumentError("too many arguments") if args.size > 1
|
72
|
+
tag = args[0]
|
54
73
|
end
|
74
|
+
tag ||= next_tag
|
75
|
+
t = Tracker.new(Cproton.pn_delivery(@impl, tag))
|
76
|
+
Cproton.pn_link_send(@impl, message.encode)
|
77
|
+
Cproton.pn_link_advance(@impl)
|
78
|
+
t.settle if snd_settle_mode == SND_SETTLED
|
79
|
+
return t
|
55
80
|
end
|
56
81
|
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# @param bytes [Array] The bytes to send.
|
60
|
-
#
|
61
|
-
# @return [Integer] The number of bytes sent.
|
62
|
-
#
|
82
|
+
# @deprecated use {#send}
|
63
83
|
def stream(bytes)
|
84
|
+
deprecated __method__, "send"
|
64
85
|
Cproton.pn_link_send(@impl, bytes)
|
65
86
|
end
|
66
87
|
|
67
|
-
|
68
|
-
|
69
|
-
result = @tag_count.succ
|
70
|
-
@tag_count = result
|
71
|
-
return "#{result}"
|
72
|
-
end
|
88
|
+
# @deprecated internal use only
|
89
|
+
def delivery_tag() deprecated(__method__); next_tag; end
|
73
90
|
|
74
|
-
|
91
|
+
private
|
75
92
|
|
93
|
+
def initialize(*arg) super; @tag_count = 0; end
|
94
|
+
def next_tag() (@tag_count += 1).to_s(32); end
|
95
|
+
can_raise_error :stream, :error_class => Qpid::Proton::LinkError
|
96
|
+
end
|
76
97
|
end
|
98
|
+
|
99
|
+
|