| 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 |
module Reactor |
| 21 |
|
| 22 |
# @deprecated use {Qpid::Proton::Container} |
| 23 |
class Container < Qpid::Proton::Container |
| 24 |
include Util::Deprecation |
| 25 |
|
| 26 |
private |
| 27 |
alias super_connect connect # Access to superclass method |
| 28 |
|
| 29 |
public |
| 30 |
|
| 31 |
# @deprecated use {Qpid::Proton::Container} |
| 32 |
def initialize(handlers, opts=nil) |
| 33 |
deprecated Qpid::Proton::Reactor::Container, Qpid::Proton::Container |
| 34 |
h = handlers || (opts && opts[:global_handler]) || Handler::ReactorMessagingAdapter.new(nil) |
| 35 |
id = opts && opts[:container_id] |
| 36 |
super(h, id) |
| 37 |
end |
| 38 |
|
| 39 |
alias container_id id |
| 40 |
alias global_handler handler |
| 41 |
|
| 42 |
def connect(opts=nil) |
| 43 |
url = opts && (opts[:url] || opts[:address]) |
| 44 |
raise ::ArgumentError.new, "no :url or :address option provided" unless url |
| 45 |
super(url, opts) |
| 46 |
end |
| 47 |
|
| 48 |
def create_sender(context, opts=nil) |
| 49 |
c = context if context.is_a? Qpid::Proton::Connection |
| 50 |
unless c |
| 51 |
url = Qpid::Proton::uri context |
| 52 |
c = super_connect(url, opts) |
| 53 |
opts ||= {} |
| 54 |
opts[:target] ||= url.amqp_address |
| 55 |
end |
| 56 |
c.open_sender opts |
| 57 |
end |
| 58 |
|
| 59 |
def create_receiver(context, opts=nil) |
| 60 |
c = context if context.is_a? Qpid::Proton::Connection |
| 61 |
unless c |
| 62 |
url = Qpid::Proton::uri context |
| 63 |
c = super_connect(url, opts) |
| 64 |
opts ||= {} |
| 65 |
opts[:source] ||= url.amqp_address |
| 66 |
end |
| 67 |
c.open_receiver opts |
| 68 |
end |
| 69 |
|
| 70 |
def listen(url, ssl_domain = nil) |
| 71 |
# TODO aconway 2017-11-29: ssl_domain |
| 72 |
super(url) |
| 73 |
end |
| 74 |
end |
| 75 |
end |
| 76 |
end |