Class List Method List File List

# Class: Vertx::EventBus

Inherits:
  Object
  - Object
  - Vertx::EventBus
  show all
Includes:
  Measured
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb

## Instance Method Summary (collapse)

- - (Object) add_interceptor
- - (Object) consumer(address = nil)
- - (EventBus) initialize(j_del) constructor
  A new instance of EventBus.
- - (Object) j_del
- - (Object) local_consumer(address = nil)
- - (Boolean) metrics_enabled?
- - (Object) publish(address = nil, message = nil, options = nil)
- - (Object) publisher(address = nil, options = nil)
- - (Object) remove_interceptor
- - (Object) send(address = nil, message = nil, options = nil)
- - (Object) sender(address = nil, options = nil)

## Constructor Details

### - (`EventBus`) initialize(j_del)

Returns a new instance of EventBus

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 21

    def initialize(j_del)
      @j_del = j_del
    end

## Instance Method Details

### - (`Object`) add_interceptor

Raises:

- (`ArgumentError`)

    128
    129
    130
    131
    132
    133
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 128

    def add_interceptor
      if block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:addInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::SendContext)) })),::Vertx::EventBus)
      end
      raise ArgumentError, "Invalid arguments when calling add_interceptor()"
    end

### - (`Object`) consumer(address = nil)

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    86
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 79

    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)
      elsif address.class == String && block_given?
        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)) })),::Vertx::MessageConsumer)
      end
      raise ArgumentError, "Invalid arguments when calling consumer(address)"
    end

### - (`Object`) j_del

    26
    27
    28
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 26

    def j_del
      @j_del
    end

### - (`Object`) local_consumer(address = nil)

Raises:

- (`ArgumentError`)

    91
    92
    93
    94
    95
    96
    97
    98
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 91

    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)
      elsif address.class == String && block_given?
        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)) })),::Vertx::MessageConsumer)
      end
      raise ArgumentError, "Invalid arguments when calling local_consumer(address)"
    end

### - (`Boolean`) metrics_enabled?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    31
    32
    33
    34
    35
    36
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 31

    def metrics_enabled?
      if !block_given?
        return @j_del.java_method(:isMetricsEnabled, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling metrics_enabled?()"
    end

### - (`Object`) publish(address = nil, message = nil, options = nil)

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 65

    def publish(address=nil,message=nil,options=nil)
      if address.class == String && (message.class == String  || message.class == Hash || message.class == Array || message.class == NilClass || message.class == TrueClass || message.class == FalseClass || message.class == Fixnum || message.class == Float) && !block_given? && options == 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(message))
        return self
      elsif address.class == String && (message.class == String  || message.class == Hash || message.class == Array || message.class == NilClass || message.class == TrueClass || message.class == FalseClass || message.class == Fixnum || message.class == Float) && options.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(message),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object(options)))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling publish(address,message,options)"
    end

### - (`Object`) publisher(address = nil, options = nil)

Raises:

- (`ArgumentError`)

    117
    118
    119
    120
    121
    122
    123
    124
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 117

    def publisher(address=nil,options=nil)
      if address.class == String && !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:publisher, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageProducer)
      elsif address.class == String && options.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(options))),::Vertx::MessageProducer)
      end
      raise ArgumentError, "Invalid arguments when calling publisher(address,options)"
    end

### - (`Object`) remove_interceptor

Raises:

- (`ArgumentError`)

    137
    138
    139
    140
    141
    142
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 137

    def remove_interceptor
      if block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:removeInterceptor, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::SendContext)) })),::Vertx::EventBus)
      end
      raise ArgumentError, "Invalid arguments when calling remove_interceptor()"
    end

### - (`Object`) send(address = nil, message = nil, options = nil)

Raises:

- (`ArgumentError`)

    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 44

    def send(address=nil,message=nil,options=nil)
      if address.class == String && (message.class == String  || message.class == Hash || message.class == Array || message.class == NilClass || message.class == TrueClass || message.class == FalseClass || message.class == Fixnum || message.class == Float) && !block_given? && options == 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(message))
        return self
      elsif address.class == String && (message.class == String  || message.class == Hash || message.class == Array || message.class == NilClass || message.class == TrueClass || message.class == FalseClass || message.class == Fixnum || message.class == Float) && block_given? && options == 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(message),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Message) : nil) }))
        return self
      elsif address.class == String && (message.class == String  || message.class == Hash || message.class == Array || message.class == NilClass || message.class == TrueClass || message.class == FalseClass || message.class == Fixnum || message.class == Float) && options.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(message),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object(options)))
        return self
      elsif address.class == String && (message.class == String  || message.class == Hash || message.class == Array || message.class == NilClass || message.class == TrueClass || message.class == FalseClass || message.class == Fixnum || message.class == Float) && options.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(message),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object(options)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Message) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling send(address,message,options)"
    end

### - (`Object`) sender(address = nil, options = nil)

Raises:

- (`ArgumentError`)

    104
    105
    106
    107
    108
    109
    110
    111
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/event_bus.rb', line 104

    def sender(address=nil,options=nil)
      if address.class == String && !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:sender, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageProducer)
      elsif address.class == String && options.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(options))),::Vertx::MessageProducer)
      end
      raise ArgumentError, "Invalid arguments when calling sender(address,options)"
    end