Class: Vertx::EventBus
- Inherits:
-
Object
- Object
- Vertx::EventBus
- Includes:
- Measured
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (self) add_inbound_interceptor { ... }
Add an interceptor that will be called whenever a message is received by Vert.x.
-
- (self) add_outbound_interceptor { ... }
Add an interceptor that will be called whenever a message is sent from Vert.x.
-
- (::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) remove_inbound_interceptor { ... }
Remove an interceptor that was added by #add_inbound_interceptor.
-
- (self) remove_outbound_interceptor { ... }
Remove an interceptor that was added by #add_outbound_interceptor.
-
- (self) request(address = nil, message = nil, options = nil) { ... }
Like #request but specifying options that can be used to configure the delivery.
-
- (self) send(address = nil, message = nil, options = nil)
Like #send but specifying options that can be used to configure the delivery.
-
- (::Vertx::MessageProducer) sender(address = nil, options = nil)
Like #sender but specifying delivery options that will be used for configuring the delivery of the message.
Class Method Details
+ (Boolean) accept?(obj)
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 31 def @@j_api_type.accept?(obj) obj.class == EventBus end |
+ (Object) j_api_type
40 41 42 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 40 def self.j_api_type @@j_api_type end |
+ (Object) j_class
43 44 45 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 43 def self.j_class Java::IoVertxCoreEventbus::EventBus.java_class end |
+ (Object) unwrap(obj)
37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 37 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 34 def @@j_api_type.wrap(obj) EventBus.new(obj) end |
Instance Method Details
- (self) add_inbound_interceptor { ... }
Add an interceptor that will be called whenever a message is received by Vert.x
173 174 175 176 177 178 179 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 173 def add_inbound_interceptor if true @j_del.java_method(:addInboundInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::DeliveryContext, nil)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling add_inbound_interceptor()" end |
- (self) add_outbound_interceptor { ... }
Add an interceptor that will be called whenever a message is sent from Vert.x
153 154 155 156 157 158 159 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 153 def add_outbound_interceptor if true @j_del.java_method(:addOutboundInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::DeliveryContext, nil)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling add_outbound_interceptor()" end |
- (::Vertx::MessageConsumer) consumer(address = nil) { ... }
Create a consumer and register it against the specified address.
104 105 106 107 108 109 110 111 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 104 def consumer(address=nil) if address.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:consumer, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageConsumer, nil) elsif address.class == String && true return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:consumer, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(address,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Message, nil)) unless !block_given? })),::Vertx::MessageConsumer, nil) 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.
116 117 118 119 120 121 122 123 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 116 def local_consumer(address=nil) if address.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:localConsumer, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageConsumer, nil) elsif address.class == String && true return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:localConsumer, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(address,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Message, nil)) unless !block_given? })),::Vertx::MessageConsumer, nil) end raise ArgumentError, "Invalid arguments when calling local_consumer(#{address})" end |
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object
48 49 50 51 52 53 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 48 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.
90 91 92 93 94 95 96 97 98 99 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 90 def publish(address=nil,=nil,=nil) if address.class == String && ::Vertx::Util::unknown_type.accept?() && !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 && ::Vertx::Util::unknown_type.accept?() && .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},#{},#{})" 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.
142 143 144 145 146 147 148 149 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 142 def publisher(address=nil,=nil) if address.class == String && !block_given? && == nil return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:publisher, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageProducer, nil) elsif address.class == String && .class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(@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())),::Vertx::MessageProducer, nil) end raise ArgumentError, "Invalid arguments when calling publisher(#{address},#{})" end |
- (self) remove_inbound_interceptor { ... }
Remove an interceptor that was added by #add_inbound_interceptor
183 184 185 186 187 188 189 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 183 def remove_inbound_interceptor if true @j_del.java_method(:removeInboundInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::DeliveryContext, nil)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling remove_inbound_interceptor()" end |
- (self) remove_outbound_interceptor { ... }
Remove an interceptor that was added by #add_outbound_interceptor
163 164 165 166 167 168 169 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 163 def remove_outbound_interceptor if true @j_del.java_method(:removeOutboundInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::DeliveryContext, nil)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling remove_outbound_interceptor()" end |
- (self) request(address = nil, message = nil, options = nil) { ... }
Like #request but specifying
options that can be used to configure the delivery.
75 76 77 78 79 80 81 82 83 84 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 75 def request(address=nil,=nil,=nil) if address.class == String && ::Vertx::Util::unknown_type.accept?() && true && == nil @j_del.java_method(:request, [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::Util::Utils.safe_create(ar.result,::Vertx::Message, nil) : nil) } unless !block_given?)) return self elsif address.class == String && ::Vertx::Util::unknown_type.accept?() && .class == Hash && true @j_del.java_method(:request, [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::Util::Utils.safe_create(ar.result,::Vertx::Message, nil) : nil) } unless !block_given?)) return self end raise ArgumentError, "Invalid arguments when calling request(#{address},#{},#{})" end |
- (self) send(address = nil, message = nil, options = nil)
Like #send but specifying
options that can be used to configure the delivery.
59 60 61 62 63 64 65 66 67 68 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 59 def send(address=nil,=nil,=nil) if address.class == String && ::Vertx::Util::unknown_type.accept?() && !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 && ::Vertx::Util::unknown_type.accept?() && .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 end raise ArgumentError, "Invalid arguments when calling send(#{address},#{},#{})" 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.
129 130 131 132 133 134 135 136 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/event_bus.rb', line 129 def sender(address=nil,=nil) if address.class == String && !block_given? && == nil return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:sender, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageProducer, nil) elsif address.class == String && .class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(@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())),::Vertx::MessageProducer, nil) end raise ArgumentError, "Invalid arguments when calling sender(#{address},#{})" end |