Class: VertxAmqpClient::AmqpClient
- Inherits:
-
Object
- Object
- VertxAmqpClient::AmqpClient
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb
Overview
AMQP Client entry point.
Use this interface to create an instance of AmqpClient and connect to a broker and server.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxAmqpClient::AmqpClient) create(param_1 = nil, param_2 = nil)
Creates a new instance of AmqpClient with the given Vert.x instance and the given options.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) close { ... }
Closes the client.
-
- (self) connect { ... }
Connects to the AMQP broker or router.
-
- (self) create_receiver(param_1 = nil, param_2 = nil, param_3 = nil)
Creates a receiver used to consumer messages from the given address.
-
- (self) create_sender(address = nil, options = nil) { ... }
Creates a sender used to send messages to the given address.
Class Method Details
+ (Boolean) accept?(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 23 def @@j_api_type.accept?(obj) obj.class == AmqpClient end |
+ (::VertxAmqpClient::AmqpClient) create(options) + (::VertxAmqpClient::AmqpClient) create(vertx, options)
Creates a new instance of VertxAmqpClient::AmqpClient with the given Vert.x instance and the given options.
45 46 47 48 49 50 51 52 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 45 def self.create(param_1=nil,param_2=nil) if param_1.class == Hash && !block_given? && param_2 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxAmqp::AmqpClient.java_method(:create, [Java::IoVertxAmqp::AmqpClientOptions.java_class]).call(Java::IoVertxAmqp::AmqpClientOptions.new(::Vertx::Util::Utils.to_json_object(param_1))),::VertxAmqpClient::AmqpClient) elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxAmqp::AmqpClient.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxAmqp::AmqpClientOptions.java_class]).call(param_1.j_del,Java::IoVertxAmqp::AmqpClientOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxAmqpClient::AmqpClient) end raise ArgumentError, "Invalid arguments when calling create(#{param_1},#{param_2})" end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 32 def self.j_api_type @@j_api_type end |
+ (Object) j_class
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 35 def self.j_class Java::IoVertxAmqp::AmqpClient.java_class end |
+ (Object) unwrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 29 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 26 def @@j_api_type.wrap(obj) AmqpClient.new(obj) end |
Instance Method Details
- (void) close { ... }
This method returns an undefined value.
Closes the client. The client must always be closed once not needed anymore.
68 69 70 71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 68 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 |
- (self) connect { ... }
Connects to the AMQP broker or router. The location is specified in the Hash as well as the
potential credential required.
57 58 59 60 61 62 63 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 57 def connect if block_given? @j_del.java_method(:connect, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpClient::AmqpConnection) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling connect()" end |
- (self) createReceiver(address, completionHandler) { ... } - (self) createReceiver(address, messageHandler, completionHandler) { ... } - (self) createReceiver(address, receiverOptions, completionHandler) { ... } - (self) createReceiver(address, receiverOptions, messageHandler, completionHandler) { ... }
Creates a receiver used to consumer messages from the given address. This method avoids having to connect
explicitly. You can retrieve the connection using VertxAmqpClient::AmqpReceiver#connection.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 93 def create_receiver(param_1=nil,param_2=nil,param_3=nil) if param_1.class == String && block_given? && param_2 == nil && param_3 == nil @j_del.java_method(:createReceiver, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpClient::AmqpReceiver) : nil) })) return self elsif param_1.class == String && param_2.class == Proc && block_given? && param_3 == nil @j_del.java_method(:createReceiver, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,(Proc.new { |event| param_2.call(::Vertx::Util::Utils.safe_create(event,::VertxAmqpClient::AmqpMessage)) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpClient::AmqpReceiver) : nil) })) return self elsif param_1.class == String && param_2.class == Hash && block_given? && param_3 == nil @j_del.java_method(:createReceiver, [Java::java.lang.String.java_class,Java::IoVertxAmqp::AmqpReceiverOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,Java::IoVertxAmqp::AmqpReceiverOptions.new(::Vertx::Util::Utils.to_json_object(param_2)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpClient::AmqpReceiver) : nil) })) return self elsif param_1.class == String && param_2.class == Hash && param_3.class == Proc && block_given? @j_del.java_method(:createReceiver, [Java::java.lang.String.java_class,Java::IoVertxAmqp::AmqpReceiverOptions.java_class,Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,Java::IoVertxAmqp::AmqpReceiverOptions.new(::Vertx::Util::Utils.to_json_object(param_2)),(Proc.new { |event| param_3.call(::Vertx::Util::Utils.safe_create(event,::VertxAmqpClient::AmqpMessage)) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpClient::AmqpReceiver) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling create_receiver(#{param_1},#{param_2},#{param_3})" end |
- (self) create_sender(address = nil, options = nil) { ... }
Creates a sender used to send messages to the given address. The address must be set.
114 115 116 117 118 119 120 121 122 123 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-amqp-client/amqp_client.rb', line 114 def create_sender(address=nil,=nil) if address.class == String && block_given? && == nil @j_del.java_method(:createSender, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(address,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpClient::AmqpSender) : nil) })) return self elsif address.class == String && .class == Hash && block_given? @j_del.java_method(:createSender, [Java::java.lang.String.java_class,Java::IoVertxAmqp::AmqpSenderOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(address,Java::IoVertxAmqp::AmqpSenderOptions.new(::Vertx::Util::Utils.to_json_object()),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAmqpClient::AmqpSender) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling create_sender(#{address},#{})" end |