Class List Method List File List

# Class: VertxTcpEventbusBridge::TcpEventBusBridge

Inherits:
  Object
  - Object
  - VertxTcpEventbusBridge::TcpEventBusBridge
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb

## Overview

TCP EventBus bridge for Vert.x

## Class Method Summary (collapse)

- + (::VertxTcpEventbusBridge::TcpEventBusBridge) create(vertx = nil, options = nil, netServerOptions = nil)

## Instance Method Summary (collapse)

- - (void) close { ... }
  Close the current socket.
- - (self) listen(port = nil, address = nil) { ... }
  Listen on specific port and bind to specific address.

## Class Method Details

### + (`::VertxTcpEventbusBridge::TcpEventBusBridge`) create(vertx = nil, options = nil, netServerOptions = nil)

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- options (`Hash`) (defaults to: `nil`)
- netServerOptions (`Hash`) (defaults to: `nil`)

Returns:

- (`::VertxTcpEventbusBridge::TcpEventBusBridge`)

Raises:

- (`ArgumentError`)

    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 21

    def self.create(vertx=nil,options=nil,netServerOptions=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && options == nil && netServerOptions == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtEventbusBridgeTcp::TcpEventBusBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxTcpEventbusBridge::TcpEventBusBridge)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given? && netServerOptions == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtEventbusBridgeTcp::TcpEventBusBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtBridge::BridgeOptions.java_class]).call(vertx.j_del,Java::IoVertxExtBridge::BridgeOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxTcpEventbusBridge::TcpEventBusBridge)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && netServerOptions.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtEventbusBridgeTcp::TcpEventBusBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtBridge::BridgeOptions.java_class,Java::IoVertxCoreNet::NetServerOptions.java_class]).call(vertx.j_del,Java::IoVertxExtBridge::BridgeOptions.new(::Vertx::Util::Utils.to_json_object(options)),Java::IoVertxCoreNet::NetServerOptions.new(::Vertx::Util::Utils.to_json_object(netServerOptions))),::VertxTcpEventbusBridge::TcpEventBusBridge)
      end
      raise ArgumentError, "Invalid arguments when calling create(vertx,options,netServerOptions)"
    end

## Instance Method Details

### - (`void`) close { ... }

This method returns an undefined value.

Close the current socket.

Yields:

- the result handler

Raises:

- (`ArgumentError`)

    61
    62
    63
    64
    65
    66
    67
    68
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 61

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      elsif 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`) listen(port = nil, address = nil) { ... }

Listen on specific port and bind to specific address

Parameters:

- port (`Fixnum`) (defaults to: `nil`) —
  tcp port
- address (`String`) (defaults to: `nil`) —
  tcp address to the bind

Yields:

- the result handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 36

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