Class: VertxServiceDiscovery::EventBusService

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb

Overview

for event bus services (service proxies). Consumers receive a service proxy to use the service.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


20
21
22
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 20

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

+ (Hash{String => Object}) createRecord(name, address, classname) + (Hash{String => Object}) createRecord(name, address, itf, metadata)

Sugar method to creates a record for this type.

The java interface is added to the metadata in the `service.interface` key.

Overloads:

  • + (Hash{String => Object}) createRecord(name, address, classname)

    Parameters:

    • name (String)
      the service name
    • address (String)
      the address
    • classname (String)
      the payload class
  • + (Hash{String => Object}) createRecord(name, address, itf, metadata)

    Parameters:

    • name (String)
      the name of the service.
    • address (String)
      the event bus address on which the service available
    • itf (String)
      the Java interface (name)
    • metadata (Hash{String => Object})
      the metadata

Returns:

  • (Hash{String => Object})
    the created record


68
69
70
71
72
73
74
75
76
77
78
79
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 68

def self.create_record(*args)
  if args[0].class == String && args[1].class == String && args[2].class == String && !block_given? && args[3] == nil
    return Java::IoVertxServicediscoveryTypes::EventBusService.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(args[0],args[1],args[2]) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::EventBusService.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(args[0],args[1],args[2]).toJson.encode) : nil
  elsif args[0].class == String && args[1].class == String && args[2].class == String && args[3].class == Hash && !block_given?
    return Java::IoVertxServicediscoveryTypes::EventBusService.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(args[0],args[1],args[2],::Vertx::Util::Utils.to_json_object(args[3])) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::EventBusService.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(args[0],args[1],args[2],::Vertx::Util::Utils.to_json_object(args[3])).toJson.encode) : nil
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create_record(#{args[0]},#{args[1]},#{args[2]},#{args[3]})"
  end
end

+ (Object) getServiceProxy(discovery, filter, clientClass, resultHandler) { ... }

Lookup for a service record and if found, retrieve it and return the service object (used to consume the service). This is a convenient method to avoid explicit lookup and then retrieval of the service. This method requires to have the clientClass set with the expected set of client. This is important for usages not using Java so you can pass the expected type.

Parameters:

Yields:

  • the result handler

Returns:

  • (Object)
    null - do not use


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-service-discovery/event_bus_service.rb', line 90

def self.get_service_proxy(*args)
  if args[0].class.method_defined?(:j_del) && args[1].class == Proc && args[2].class == Class && true
    return ::Vertx::Util::Utils.v_type_of(args[2]).wrap(Java::IoVertxServicediscoveryTypes::EventBusService.java_method(:getServiceProxy, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::JavaUtilFunction::Function.java_class,Java::JavaLang::Class.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,(Proc.new { |event| args[1].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[1] == nil }),::Vertx::Util::Utils.j_class_of(args[2]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.v_type_of(args[2]).wrap(ar.result) : nil) } : promise))
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_service_proxy(#{args[0]},#{args[1]},#{args[2]})"
  end
end

+ (Object) getServiceProxyWithJsonFilter(discovery, filter, clientClass, resultHandler) { ... }

Lookup for a service record and if found, retrieve it and return the service object (used to consume the service). This is a convenient method to avoid explicit lookup and then retrieval of the service. This method requires to have the clientClass set with the expected set of client. This is important for usages not using Java so you can pass the expected type.

Parameters:

Yields:

  • the result handler

Returns:

  • (Object)
    null - do not use


45
46
47
48
49
50
51
52
53
54
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 45

def self.get_service_proxy_with_json_filter(*args)
  if args[0].class.method_defined?(:j_del) && args[1].class == Hash && args[2].class == Class && true
    return ::Vertx::Util::Utils.v_type_of(args[2]).wrap(Java::IoVertxServicediscoveryTypes::EventBusService.java_method(:getServiceProxyWithJsonFilter, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::JavaLang::Class.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,::Vertx::Util::Utils.to_json_object(args[1]),::Vertx::Util::Utils.j_class_of(args[2]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.v_type_of(args[2]).wrap(ar.result) : nil) } : promise))
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_service_proxy_with_json_filter(#{args[0]},#{args[1]},#{args[2]})"
  end
end

+ (Object) j_api_type



29
30
31
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 29

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



32
33
34
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 32

def self.j_class
  Java::IoVertxServicediscoveryTypes::EventBusService.java_class
end

+ (Object) TYPE

Name of the type.


105
106
107
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 105

def self.TYPE
  Java::IoVertxServicediscoveryTypes::EventBusService.TYPE
end

+ (Object) UNKNOWN

Unknown type.


101
102
103
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 101

def self.UNKNOWN
  Java::IoVertxServicediscoveryTypes::EventBusService.UNKNOWN
end

+ (Object) unwrap(obj)



26
27
28
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 26

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

+ (Object) wrap(obj)



23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/event_bus_service.rb', line 23

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