Class: VertxTcpEventbusBridge::TcpEventBusBridge

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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)

19
20
21
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 19

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)

Yields:

Returns:

Raises:

  • (ArgumentError)

39
40
41
42
43
44
45
46
47
48
49
50
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 39

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)
  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,Java::IoVertxCore::Handler.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)),(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxTcpEventbusBridge::BridgeEvent)) })),::VertxTcpEventbusBridge::TcpEventBusBridge)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{options},#{netServerOptions})"
end

+ (Object) j_api_type


28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 28

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 31

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

+ (Object) unwrap(obj)


25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 25

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

+ (Object) wrap(obj)


22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 22

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)

81
82
83
84
85
86
87
88
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 81

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)

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 56

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