Class: VertxAmqpBridge::AmqpBridge

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-amqp-bridge/amqp_bridge.rb

Overview

Vert.x AMQP Bridge. Facilitates sending and receiving AMQP 1.0 messages.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (::VertxAmqpBridge::AmqpBridge) create(vertx = nil, options = nil)

Creates a Bridge with the given options.

Parameters:

  • vertx (::Vertx::Vertx) (defaults to: nil)
    the vertx instance to use
  • options (Hash) (defaults to: nil)
    the options

Returns:

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-amqp-bridge/amqp_bridge.rb', line 23

def self.create(vertx=nil,options=nil)
  if vertx.class.method_defined?(:j_del) && !block_given? && options == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxAmqpbridge::AmqpBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxAmqpBridge::AmqpBridge)
  elsif vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxAmqpbridge::AmqpBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxAmqpbridge::AmqpBridgeOptions.java_class]).call(vertx.j_del,Java::IoVertxAmqpbridge::AmqpBridgeOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxAmqpBridge::AmqpBridge)
  end
  raise ArgumentError, "Invalid arguments when calling create(vertx,options)"
end

Instance Method Details

- (void) close { ... }

This method returns an undefined value.

Shuts the bridge down, closing the underlying connection.

Yields:

  • the result handler

Raises:

  • (ArgumentError)


73
74
75
76
77
78
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-amqp-bridge/amqp_bridge.rb', line 73

def close
  if block_given?
    return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling close()"
end

- (::Vertx::MessageConsumer) create_consumer(amqpAddress = nil)

Creates a consumer on the given AMQP address. This method MUST be called from the bridge Context thread, as used in the result handler callback from the start methods. The bridge MUST be successfully started before the method is called.

Parameters:

  • amqpAddress (String) (defaults to: nil)
    the address to consume from

Returns:

Raises:

  • (ArgumentError)


52
53
54
55
56
57
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-amqp-bridge/amqp_bridge.rb', line 52

def create_consumer(amqpAddress=nil)
  if amqpAddress.class == String && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createConsumer, [Java::java.lang.String.java_class]).call(amqpAddress),::Vertx::MessageConsumer)
  end
  raise ArgumentError, "Invalid arguments when calling create_consumer(amqpAddress)"
end

- (::Vertx::MessageProducer) create_producer(amqpAddress = nil)

Creates a producer to the given AMQP address. This method MUST be called from the bridge Context thread, as used in the result handler callback from the start methods. The bridge MUST be successfully started before the method is called.

Parameters:

  • amqpAddress (String) (defaults to: nil)
    the address to produce to

Returns:

Raises:

  • (ArgumentError)


64
65
66
67
68
69
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-amqp-bridge/amqp_bridge.rb', line 64

def create_producer(amqpAddress=nil)
  if amqpAddress.class == String && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createProducer, [Java::java.lang.String.java_class]).call(amqpAddress),::Vertx::MessageProducer)
  end
  raise ArgumentError, "Invalid arguments when calling create_producer(amqpAddress)"
end

- (void) start(hostname = nil, port = nil, username = nil, password = nil) { ... }

This method returns an undefined value.

Starts the bridge, establishing the underlying connection.

Parameters:

  • hostname (String) (defaults to: nil)
    the host name to connect to
  • port (Fixnum) (defaults to: nil)
    the port to connect to
  • username (String) (defaults to: nil)
    the username
  • password (String) (defaults to: nil)
    the password

Yields:

  • the result handler

Raises:

  • (ArgumentError)


38
39
40
41
42
43
44
45
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-amqp-bridge/amqp_bridge.rb', line 38

def start(hostname=nil,port=nil,username=nil,password=nil)
  if hostname.class == String && port.class == Fixnum && block_given? && username == nil && password == nil
    return @j_del.java_method(:start, [Java::java.lang.String.java_class,Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(hostname,port,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpBridge::AmqpBridge) : nil) }))
  elsif hostname.class == String && port.class == Fixnum && username.class == String && password.class == String && block_given?
    return @j_del.java_method(:start, [Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(hostname,port,username,password,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpBridge::AmqpBridge) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling start(hostname,port,username,password)"
end