Class: Vertx::EventBus
- Inherits:
-
Object
- Object
- Vertx::EventBus
- Includes:
- Measured
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb
Overview
A Vert.x event-bus is a light-weight distributed messaging system which allows different parts of your application,
or different applications and services to communicate with each in a loosely coupled way.
An event-bus supports publish-subscribe messaging, point-to-point messaging and request-response messaging.
Message delivery is best-effort and messages can be lost if failure of all or part of the event bus occurs.
Please refer to the documentation for more information on the event bus.
Instance Method Summary (collapse)
-
- (void) close { ... }
Close the event bus and release any resources held.
-
- (::Vertx::MessageConsumer) consumer(address = nil) { ... }
Create a consumer and register it against the specified address.
-
- (::Vertx::MessageConsumer) local_consumer(address = nil) { ... }
Like #consumer but the address won't be propagated across the cluster.
-
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object.
-
- (self) publish(address = nil, message = nil, options = nil)
Like #publish but specifying options that can be used to configure the delivery.
-
- (::Vertx::MessageProducer) publisher(address = nil, options = nil)
Like #publisher but specifying delivery options that will be used for configuring the delivery of the message.
-
- (self) send(address = nil, message = nil, options = nil) { ... }
Like #send but specifying a replyHandler that will be called if the recipient subsequently replies to the message.
-
- (::Vertx::MessageProducer) sender(address = nil, options = nil)
Like #sender but specifying delivery options that will be used for configuring the delivery of the message.
Instance Method Details
- (void) close { ... }
This method returns an undefined value.
Close the event bus and release any resources held
127 128 129 130 131 132 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 127 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) consumer(address = nil) { ... }
Create a consumer and register it against the specified address.
78 79 80 81 82 83 84 85 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 78 def consumer(address=nil) if address.class == String && !block_given? return ::Vertx::MessageConsumer.new(@j_del.java_method(:consumer, [Java::java.lang.String.java_class]).call(address)) elsif address.class == String && block_given? return ::Vertx::MessageConsumer.new(@j_del.java_method(:consumer, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(address,(Proc.new { |event| yield(::Vertx::Message.new(event)) }))) end raise ArgumentError, "Invalid arguments when calling consumer(address)" end |
- (::Vertx::MessageConsumer) local_consumer(address = nil) { ... }
Like #consumer but the address won't be propagated across the cluster.
90 91 92 93 94 95 96 97 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 90 def local_consumer(address=nil) if address.class == String && !block_given? return ::Vertx::MessageConsumer.new(@j_del.java_method(:localConsumer, [Java::java.lang.String.java_class]).call(address)) elsif address.class == String && block_given? return ::Vertx::MessageConsumer.new(@j_del.java_method(:localConsumer, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(address,(Proc.new { |event| yield(::Vertx::Message.new(event)) }))) end raise ArgumentError, "Invalid arguments when calling local_consumer(address)" end |
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object
30 31 32 33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 30 def metrics_enabled? if !block_given? return @j_del.java_method(:isMetricsEnabled, []).call() end raise ArgumentError, "Invalid arguments when calling metrics_enabled?()" end |
- (self) publish(address = nil, message = nil, options = nil)
Like #publish but specifying
options
that can be used to configure the delivery.
64 65 66 67 68 69 70 71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 64 def publish(address=nil,=nil,=nil) if address.class == String && (.class == String || .class == Hash || .class == Array || .class == NilClass || .class == TrueClass || .class == FalseClass || .class == Fixnum || .class == Float) && !block_given? && == nil @j_del.java_method(:publish, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class]).call(address,::Vertx::Util::Utils.to_object()) return self elsif address.class == String && (.class == String || .class == Hash || .class == Array || .class == NilClass || .class == TrueClass || .class == FalseClass || .class == Fixnum || .class == Float) && .class == Hash && !block_given? @j_del.java_method(:publish, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class,Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(address,::Vertx::Util::Utils.to_object(),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object())) return self end raise ArgumentError, "Invalid arguments when calling publish(address,message,options)" end |
- (::Vertx::MessageProducer) publisher(address = nil, options = nil)
Like #publisher but specifying delivery options that will be used for configuring the delivery of
the message.
116 117 118 119 120 121 122 123 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 116 def publisher(address=nil,=nil) if address.class == String && !block_given? && == nil return ::Vertx::MessageProducer.new(@j_del.java_method(:publisher, [Java::java.lang.String.java_class]).call(address)) elsif address.class == String && .class == Hash && !block_given? return ::Vertx::MessageProducer.new(@j_del.java_method(:publisher, [Java::java.lang.String.java_class,Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(address,Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object()))) end raise ArgumentError, "Invalid arguments when calling publisher(address,options)" end |
- (self) send(address = nil, message = nil, options = nil) { ... }
Like #send but specifying a
replyHandler
that will be called if the recipient
subsequently replies to the message.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 43 def send(address=nil,=nil,=nil) if address.class == String && (.class == String || .class == Hash || .class == Array || .class == NilClass || .class == TrueClass || .class == FalseClass || .class == Fixnum || .class == Float) && !block_given? && == nil @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class]).call(address,::Vertx::Util::Utils.to_object()) return self elsif address.class == String && (.class == String || .class == Hash || .class == Array || .class == NilClass || .class == TrueClass || .class == FalseClass || .class == Fixnum || .class == Float) && block_given? && == nil @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(address,::Vertx::Util::Utils.to_object(),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Message.new(ar.result) : nil) })) return self elsif address.class == String && (.class == String || .class == Hash || .class == Array || .class == NilClass || .class == TrueClass || .class == FalseClass || .class == Fixnum || .class == Float) && .class == Hash && !block_given? @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class,Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(address,::Vertx::Util::Utils.to_object(),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object())) return self elsif address.class == String && (.class == String || .class == Hash || .class == Array || .class == NilClass || .class == TrueClass || .class == FalseClass || .class == Fixnum || .class == Float) && .class == Hash && block_given? @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class,Java::IoVertxCoreEventbus::DeliveryOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(address,::Vertx::Util::Utils.to_object(),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object()),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Message.new(ar.result) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling send(address,message,options)" end |
- (::Vertx::MessageProducer) sender(address = nil, options = nil)
Like #sender but specifying delivery options that will be used for configuring the delivery of
the message.
103 104 105 106 107 108 109 110 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/event_bus.rb', line 103 def sender(address=nil,=nil) if address.class == String && !block_given? && == nil return ::Vertx::MessageProducer.new(@j_del.java_method(:sender, [Java::java.lang.String.java_class]).call(address)) elsif address.class == String && .class == Hash && !block_given? return ::Vertx::MessageProducer.new(@j_del.java_method(:sender, [Java::java.lang.String.java_class,Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(address,Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object()))) end raise ArgumentError, "Invalid arguments when calling sender(address,options)" end |