Module: Qpid::Proton

Defined in:
lib/qpid_proton.rb,
lib/types/array.rb,
lib/core/message.rb,
lib/core/session.rb,
lib/core/tracker.rb,
lib/util/wrapper.rb,
lib/codec/mapping.rb,
lib/core/delivery.rb,
lib/core/endpoint.rb,
lib/core/listener.rb,
lib/core/receiver.rb,
lib/core/terminus.rb,
lib/core/transfer.rb,
lib/core/condition.rb,
lib/core/container.rb,
lib/core/transport.rb,
lib/core/connection.rb,
lib/core/exceptions.rb,
lib/core/ssl_domain.rb,
lib/handler/adapter.rb,
lib/core/disposition.rb,
lib/core/ssl_details.rb,
lib/reactor/container.rb,
lib/core/connection_driver.rb,
lib/core/messaging_handler.rb,
lib/handler/messaging_adapter.rb,
lib/handler/messaging_handler.rb,
lib/handler/reactor_messaging_adapter.rb,
lib/core/sender.rb,
lib/types/type.rb,
lib/core/event.rb,
lib/codec/data.rb,
lib/core/sasl.rb,
lib/core/link.rb,
lib/core/url.rb,
lib/core/uri.rb,
lib/core/ssl.rb

Overview

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: Codec, Error, Handler, Messenger, Reactor, Types, Util Classes: AbortedError, ArgumentError, AttributeError, Condition, Connection, ConnectionDriver, Container, Delivery, Disposition, EOSError, Endpoint, Event, HandlerDriver, InProgressError, InterruptedError, Link, LinkError, Listener, Message, MessagingHandler, OverflowError, ProtonError, Receiver, Reject, Release, SASL, SASLError, SSL, SSLDomain, SSLError, SSLSessionDetails, SSLUnavailableError, Sender, Session, SessionError, StateError, StopAutoResponse, Terminus, TimeoutError, Tracker, Transfer, Transport, TransportError, URL, UnderflowError

Class Method Summary collapse

Class Method Details

.uri(s) ⇒ URI::AMQP

Note:

this does not give the same result as a standard URI parser in all cases. For standard conversion to a URI use: URI(s)

Returns s converted to a URI::AMQP or URI::AMQPS object

Shortcut strings are allowed: an “amqp://” prefix is added if s does not already look like an ‘amqp:’, ‘amqps:’ URI.

Parameters:

  • s (String, URI)

    String to convert to a URI, or a URI object. A URI object with no scheme will be converted to URI::AMQP

Returns:

Raises:

  • (BadURIError)

    s is a URI object with a non-AMQP scheme

  • (InvalidURIError)

    s cannot be parsed as a URI or shortcut

  • (::ArgumentError)

    s is not a string or URI



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/core/uri.rb', line 55

def self.uri(s)
  case s
    when URI::AMQP then s     # Pass-thru
  when URI::Generic
    s.scheme ||= 'amqp'
    u = URI.parse(s.to_s)      # Re-parse as amqp
    raise URI::BadURIError, "Not an AMQP URI: '#{u}'" unless u.is_a? URI::AMQP
    u
  else
    s = String.try_convert s
    raise ::ArgumentError, "bad argument (expected URI object or URI string)" unless s
    case s
    when %r{^amqps?:} then URI.parse(s)      # Looks like an AMQP URI
    when %r{^//} then URI.parse("amqp:#{s}") # Looks like a scheme-less URI
    else URI.parse("amqp://#{s}")            # Treat as a bare host:port/path string
    end
  end
end