Class: VertxTcpEventbusBridge::TcpEventBusBridge

Inherits:
Object
  • Object
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

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


18
19
20
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 18

def @@j_api_type.accept?(obj)
  obj.class == TcpEventBusBridge
end

+ (::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:

Raises:

  • (ArgumentError)


37
38
39
40
41
42
43
44
45
46
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 37

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

+ (Object) j_api_type



27
28
29
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 27

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



30
31
32
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 30

def self.j_class
  Java::IoVertxExtEventbusBridgeTcp::TcpEventBusBridge.java_class
end

+ (Object) unwrap(obj)



24
25
26
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 24

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



21
22
23
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 21

def @@j_api_type.wrap(obj)
  TcpEventBusBridge.new(obj)
end

Instance Method Details

- (void) close { ... }

This method returns an undefined value.

Close the current socket.

Yields:

  • the result handler

Raises:

  • (ArgumentError)


77
78
79
80
81
82
83
84
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 77

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)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 52

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