qpid_proton 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/README.md +26 -10
- data/examples/broker.rb +99 -91
- data/examples/example_test.rb +11 -11
- data/ext/cproton/cproton.c +3 -3
- data/lib/core/connection.rb +18 -12
- data/lib/core/connection_driver.rb +13 -3
- data/lib/core/container.rb +276 -120
- data/lib/core/disposition.rb +1 -1
- data/lib/core/endpoint.rb +3 -0
- data/lib/core/listener.rb +6 -0
- data/lib/core/message.rb +5 -9
- data/lib/core/messaging_handler.rb +5 -1
- data/lib/core/receiver.rb +1 -2
- data/lib/core/sasl.rb +1 -1
- data/lib/core/session.rb +6 -4
- data/lib/core/terminus.rb +10 -4
- data/lib/core/transfer.rb +3 -0
- data/lib/core/transport.rb +1 -0
- data/lib/core/uri.rb +9 -10
- data/lib/core/work_queue.rb +76 -0
- data/lib/qpid_proton.rb +2 -8
- data/lib/types/array.rb +1 -0
- data/lib/types/hash.rb +0 -11
- data/lib/util/schedule.rb +79 -0
- data/lib/util/wrapper.rb +4 -0
- data/tests/old_examples/old_example_test.rb +0 -8
- data/tests/test_container.rb +203 -126
- data/tests/test_container_sasl.rb +141 -0
- data/tests/test_interop.rb +1 -1
- data/tests/test_messaging_adapter.rb +1 -1
- data/tests/test_tools.rb +30 -5
- data/tests/test_uri.rb +2 -0
- metadata +5 -9
- data/lib/messenger/messenger.rb +0 -703
- data/lib/messenger/subscription.rb +0 -36
- data/lib/messenger/tracker.rb +0 -37
- data/lib/messenger/tracker_status.rb +0 -68
- data/lib/util/timeout.rb +0 -49
- data/tests/old_examples/recv.rb +0 -23
- data/tests/old_examples/send.rb +0 -21
@@ -1,36 +0,0 @@
|
|
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::Messenger
|
20
|
-
|
21
|
-
# A +Subscription+ is an opaque object for working with a +Messenger+'s
|
22
|
-
# subscriptions.
|
23
|
-
#
|
24
|
-
class Subscription
|
25
|
-
|
26
|
-
def initialize(impl) # :nodoc:
|
27
|
-
@impl = impl
|
28
|
-
end
|
29
|
-
|
30
|
-
def impl # :nodoc:
|
31
|
-
@impl
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/lib/messenger/tracker.rb
DELETED
@@ -1,37 +0,0 @@
|
|
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::Messenger
|
20
|
-
|
21
|
-
# A +Tracker+ is used to track the disposition of a +Message+.
|
22
|
-
#
|
23
|
-
class Tracker
|
24
|
-
|
25
|
-
CUMULATIVE = Cproton::PN_CUMULATIVE
|
26
|
-
|
27
|
-
def initialize(impl) # :nodoc:
|
28
|
-
@impl = impl
|
29
|
-
end
|
30
|
-
|
31
|
-
def impl # :nodoc:
|
32
|
-
@impl
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
@@ -1,68 +0,0 @@
|
|
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::Messenger
|
20
|
-
|
21
|
-
# TrackerStatus contains symbols that represent the status value for a
|
22
|
-
# Tracker.
|
23
|
-
#
|
24
|
-
class TrackerStatus
|
25
|
-
|
26
|
-
def initialize value, name # :nodoc:
|
27
|
-
@value = value
|
28
|
-
@name = name
|
29
|
-
end
|
30
|
-
|
31
|
-
def value # :nodoc:
|
32
|
-
@value
|
33
|
-
end
|
34
|
-
|
35
|
-
def to_s # :nodoc:
|
36
|
-
@name.to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.by_name(name) # :nodoc:
|
40
|
-
@by_name[name.to_sym] unless name.nil?
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.by_value(value) # :nodoc:
|
44
|
-
@by_value[value] unless value.nil?
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def self.add_item(key, value) # :nodoc:
|
50
|
-
@by_name ||= {}
|
51
|
-
@by_name[key] = TrackerStatus.new value, key
|
52
|
-
@by_value ||= {}
|
53
|
-
@by_value[value] = @by_name[key]
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.const_missing(key) # :nodoc:
|
57
|
-
@by_name[key]
|
58
|
-
end
|
59
|
-
|
60
|
-
self.add_item :UNKNOWN, Cproton::PN_STATUS_UNKNOWN
|
61
|
-
self.add_item :PENDING, Cproton::PN_STATUS_PENDING
|
62
|
-
self.add_item :ACCEPTED, Cproton::PN_STATUS_ACCEPTED
|
63
|
-
self.add_item :REJECTED, Cproton::PN_STATUS_REJECTED
|
64
|
-
self.add_item :SETTLED, Cproton::PN_STATUS_SETTLED
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
data/lib/util/timeout.rb
DELETED
@@ -1,49 +0,0 @@
|
|
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::Util
|
20
|
-
|
21
|
-
# Provides methods for converting between milliseconds, seconds
|
22
|
-
# and timeout values.
|
23
|
-
#
|
24
|
-
# @private
|
25
|
-
module Timeout
|
26
|
-
|
27
|
-
def sec_to_millis(s)
|
28
|
-
return (s * 1000).to_int
|
29
|
-
end
|
30
|
-
|
31
|
-
def millis_to_sec(ms)
|
32
|
-
return (ms.to_f / 1000.0).to_int
|
33
|
-
end
|
34
|
-
|
35
|
-
def timeout_to_millis(s)
|
36
|
-
return Cproton::PN_MILLIS_MAX if s.nil?
|
37
|
-
|
38
|
-
return sec_to_millis(s)
|
39
|
-
end
|
40
|
-
|
41
|
-
def millis_to_timeout(ms)
|
42
|
-
return nil if ms == Cproton::PN_MILLIS_MAX
|
43
|
-
|
44
|
-
return millis_to_sec(ms)
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
data/tests/old_examples/recv.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'qpid_proton.rb'
|
4
|
-
|
5
|
-
messenger = Qpid::Proton::Messenger::Messenger.new()
|
6
|
-
messenger.incoming_window = 1
|
7
|
-
message = Qpid::Proton::Message.new()
|
8
|
-
|
9
|
-
address = ARGV[0]
|
10
|
-
if not address then
|
11
|
-
address = "~0.0.0.0"
|
12
|
-
end
|
13
|
-
messenger.subscribe(address)
|
14
|
-
|
15
|
-
messenger.start()
|
16
|
-
|
17
|
-
puts "Listening"; STDOUT.flush
|
18
|
-
messenger.receive()
|
19
|
-
messenger.get(message)
|
20
|
-
puts "Got: #{message.body}"
|
21
|
-
messenger.accept()
|
22
|
-
|
23
|
-
messenger.stop()
|
data/tests/old_examples/send.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'qpid_proton.rb'
|
4
|
-
|
5
|
-
messenger = Qpid::Proton::Messenger::Messenger.new()
|
6
|
-
messenger.outgoing_window = 10
|
7
|
-
message = Qpid::Proton::Message.new()
|
8
|
-
|
9
|
-
address = ARGV[0]
|
10
|
-
if not address then
|
11
|
-
address = "0.0.0.0"
|
12
|
-
end
|
13
|
-
|
14
|
-
message.address = address
|
15
|
-
message.body = "Hello World!"
|
16
|
-
|
17
|
-
messenger.start()
|
18
|
-
tracker = messenger.put(message)
|
19
|
-
messenger.send()
|
20
|
-
print "Status: ", messenger.status(tracker), "\n"
|
21
|
-
messenger.stop()
|