Class List Method List File List

# Class: VertxServiceDiscovery::ServiceDiscovery

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

## Overview

Service Discovery main entry point.

The service discovery is an infrastructure that let you publish and find `services`. A `service` is a discoverable functionality. It can be qualified by its type, metadata, and location. So a `service` can be a database, a service proxy, a HTTP endpoint. It does not have to be a vert.x entity, but can be anything. Each service is described by a Hash.

The service discovery implements the interactions defined in the service-oriented computing. And to some extend, also provides the dynamic service-oriented computing interaction. So, application can react to arrival and departure of services.

A service provider can:

* publish a service record * un-publish a published record * update the status of a published service (down, out of service...)

A service consumer can:

* lookup for services * bind to a selected service (it gets a ServiceReference) and use it * release the service once the consumer is done with it * listen for arrival, departure and modification of services.

Consumer would 1) lookup for service record matching their need, 2) retrieve the ServiceReference that give access to the service, 3) get a service object to access the service, 4) release the service object once done.

A state above, the central piece of information shared by the providers and consumers are Hashrecords.

Providers and consumers must create their own ServiceDiscovery instance. These instances are collaborating in background (distributed structure) to keep the set of services in sync.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxServiceDiscovery::ServiceDiscovery) create(vertx = nil, options = nil) { ... }
  Creates an instance of ServiceDiscovery.
- + (Object) j_api_type
- + (Object) j_class
- + (void) release_service_object(discovery = nil, svcObject = nil)
  Release the service object retrieved using get methods from the service type interface.
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (Set<::VertxServiceDiscovery::ServiceReference>) bindings
  The set of service references retrieved by this service discovery.
- - (void) close
  Closes the service discovery.
- - (void) get_record(param_1 = nil, param_2 = nil)
  Lookups for a single record.
- - (void) get_records(param_1 = nil, param_2 = nil)
  Lookups for a set of records.
- - (::VertxServiceDiscovery::ServiceReference) get_reference(record = nil)
  Gets a service reference from the given record.
- - (::VertxServiceDiscovery::ServiceReference) get_reference_with_configuration(record = nil, configuration = nil)
  Gets a service reference from the given record, the reference is configured with the given json object.
- - (Hash) options
  The discovery options.
- - (void) publish(record = nil) { ... }
  Publishes a record.
- - (::VertxServiceDiscovery::ServiceDiscovery) register_service_exporter(exporter = nil, configuration = nil) { ... }
  Registers a discovery bridge.
- - (::VertxServiceDiscovery::ServiceDiscovery) register_service_importer(importer = nil, configuration = nil) { ... }
  Registers a discovery service importer.
- - (true, false) release?(reference = nil)
  Releases the service reference.
- - (void) unpublish(id = nil) { ... }
  Un-publishes a record.
- - (void) update(record = nil) { ... }
  Updates the given record.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    51
    52
    53
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 51

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

### + (`::VertxServiceDiscovery::ServiceDiscovery`) create(vertx = nil, options = nil) { ... }

Creates an instance of VertxServiceDiscovery::ServiceDiscovery.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the vert.x instance
- options (`Hash`) (defaults to: `nil`) —
  the discovery options

Yields:

- completion handler called when the service discovery has been initialized. This includes the initialization of the service importer registered from the SPI.

Returns:

- (`::VertxServiceDiscovery::ServiceDiscovery`) —
  the created instance, should not be used to retrieve services before the invocation of the completion handler.

Raises:

- (`ArgumentError`)

    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 71

    def self.create(vertx=nil,options=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxServicediscovery::ServiceDiscovery.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxServiceDiscovery::ServiceDiscovery)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxServicediscovery::ServiceDiscovery.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxServicediscovery::ServiceDiscoveryOptions.java_class]).call(vertx.j_del,Java::IoVertxServicediscovery::ServiceDiscoveryOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxServiceDiscovery::ServiceDiscovery)
      elsif vertx.class.method_defined?(:j_del) && block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxServicediscovery::ServiceDiscovery.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCore::Handler.java_class]).call(vertx.j_del,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxServiceDiscovery::ServiceDiscovery)) })),::VertxServiceDiscovery::ServiceDiscovery)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxServicediscovery::ServiceDiscovery.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxServicediscovery::ServiceDiscoveryOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(vertx.j_del,Java::IoVertxServicediscovery::ServiceDiscoveryOptions.new(::Vertx::Util::Utils.to_json_object(options)),(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxServiceDiscovery::ServiceDiscovery)) })),::VertxServiceDiscovery::ServiceDiscovery)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{options})"
    end

### + (`Object`) j_api_type

    60
    61
    62
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 60

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    63
    64
    65
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 63

    def self.j_class
      Java::IoVertxServicediscovery::ServiceDiscovery.java_class
    end

### + (`void`) release_service_object(discovery = nil, svcObject = nil)

This method returns an undefined value.

Release the service object retrieved using `get` methods from the service type interface. It searches for the reference associated with the given object and release it.

Parameters:

- discovery (`::VertxServiceDiscovery::ServiceDiscovery`) (defaults to: `nil`) —
  the service discovery
- svcObject (`Object`) (defaults to: `nil`) —
  the service object

Raises:

- (`ArgumentError`)

    253
    254
    255
    256
    257
    258
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 253

    def self.release_service_object(discovery=nil,svcObject=nil)
      if discovery.class.method_defined?(:j_del) && ::Vertx::Util::unknown_type.accept?(svcObject) && !block_given?
        return Java::IoVertxServicediscovery::ServiceDiscovery.java_method(:releaseServiceObject, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::java.lang.Object.java_class]).call(discovery.j_del,::Vertx::Util::Utils.to_object(svcObject))
      end
      raise ArgumentError, "Invalid arguments when calling release_service_object(#{discovery},#{svcObject})"
    end

### + (`Object`) unwrap(obj)

    57
    58
    59
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 57

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

### + (`Object`) wrap(obj)

    54
    55
    56
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 54

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

## Instance Method Details

### - (`Set<::VertxServiceDiscovery::ServiceReference>`) bindings

Returns the set of service references retrieved by this service discovery.

Returns:

- (`Set<::VertxServiceDiscovery::ServiceReference>`) —
  the set of service references retrieved by this service discovery.

Raises:

- (`ArgumentError`)

    235
    236
    237
    238
    239
    240
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 235

    def bindings
      if !block_given?
        return ::Vertx::Util::Utils.to_set(@j_del.java_method(:bindings, []).call()).map! { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxServiceDiscovery::ServiceReference) }
      end
      raise ArgumentError, "Invalid arguments when calling bindings()"
    end

### - (`void`) close

This method returns an undefined value.

Closes the service discovery

Raises:

- (`ArgumentError`)

    141
    142
    143
    144
    145
    146
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 141

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

### - (`void`) getRecord(filter, resultHandler) { ... } - (`void`) getRecord(filter, resultHandler) { ... } - (`void`) getRecord(filter, includeOutOfService, resultHandler) { ... }

This method returns an undefined value.

Lookups for a single record.

The filter is a taking a Hash as argument and returning a boolean. You should see it as an `accept` method of a filter. This method return a record passing the filter.

Unlike #get_record, this method may accept records with a `OUT OF SERVICE` status, if the `includeOutOfService` parameter is set to `true`.

Overloads:

- - (`void`) getRecord(filter, resultHandler) { ... }

  Parameters:

  - filter (`Hash{String => Object}`) —
    the filter.

  Yields:

  - handler called when the lookup has been completed. When there are no matching record, the operation succeeds, but the async result has no result (`null`).
- - (`void`) getRecord(filter, resultHandler) { ... }

  Parameters:

  - filter (`Proc`) —
    the filter, must not be `null`. To return all records, use a function accepting all records

  Yields:

  - the result handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has no result.
- - (`void`) getRecord(filter, includeOutOfService, resultHandler) { ... }

  Parameters:

  - filter (`Proc`) —
    the filter, must not be `null`. To return all records, use a function accepting all records
  - includeOutOfService (`true`, `false`) —
    whether or not the filter accepts `OUT OF SERVICE` records

  Yields:

  - the result handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has no result.

Raises:

- (`ArgumentError`)

    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 185

    def get_record(param_1=nil,param_2=nil)
      if param_1.class == Hash && block_given? && param_2 == nil
        return @j_del.java_method(:getRecord, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(param_1),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
      elsif param_1.class == Proc && block_given? && param_2 == nil
        return @j_del.java_method(:getRecord, [Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| param_1.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
      elsif param_1.class == Proc && (param_2.class == TrueClass || param_2.class == FalseClass) && block_given?
        return @j_del.java_method(:getRecord, [Java::JavaUtilFunction::Function.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| param_1.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),param_2,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get_record(#{param_1},#{param_2})"
    end

### - (`void`) getRecords(filter, resultHandler) { ... } - (`void`) getRecords(filter, resultHandler) { ... } - (`void`) getRecords(filter, includeOutOfService, resultHandler) { ... }

This method returns an undefined value.

Lookups for a set of records. Unlike #get_record, this method returns all matching records.

The filter is a taking a Hash as argument and returning a boolean. You should see it as an `accept` method of a filter. This method return a record passing the filter.

Unlike #get_records, this method may accept records with a `OUT OF SERVICE` status, if the `includeOutOfService` parameter is set to `true`.

Overloads:

- - (`void`) getRecords(filter, resultHandler) { ... }

  Parameters:

  - filter (`Hash{String => Object}`) —
    the filter - see #get_record

  Yields:

  - handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result.
- - (`void`) getRecords(filter, resultHandler) { ... }

  Parameters:

  - filter (`Proc`) —
    the filter, must not be `null`. To return all records, use a function accepting all records

  Yields:

  - handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result.
- - (`void`) getRecords(filter, includeOutOfService, resultHandler) { ... }

  Parameters:

  - filter (`Proc`) —
    the filter, must not be `null`. To return all records, use a function accepting all records
  - includeOutOfService (`true`, `false`) —
    whether or not the filter accepts `OUT OF SERVICE` records

  Yields:

  - handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result.

Raises:

- (`ArgumentError`)

    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 214

    def get_records(param_1=nil,param_2=nil)
      if param_1.class == Hash && block_given? && param_2 == nil
        return @j_del.java_method(:getRecords, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(param_1),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.toJson.encode) : nil } : nil) }))
      elsif param_1.class == Proc && block_given? && param_2 == nil
        return @j_del.java_method(:getRecords, [Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| param_1.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.toJson.encode) : nil } : nil) }))
      elsif param_1.class == Proc && (param_2.class == TrueClass || param_2.class == FalseClass) && block_given?
        return @j_del.java_method(:getRecords, [Java::JavaUtilFunction::Function.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| param_1.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),param_2,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.toJson.encode) : nil } : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get_records(#{param_1},#{param_2})"
    end

### - (`::VertxServiceDiscovery::ServiceReference`) get_reference(record = nil)

Gets a service reference from the given record.

Parameters:

- record (`Hash`) (defaults to: `nil`) —
  the chosen record

Returns:

- (`::VertxServiceDiscovery::ServiceReference`) —
  the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.

Raises:

- (`ArgumentError`)

    86
    87
    88
    89
    90
    91
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 86

    def get_reference(record=nil)
      if record.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getReference, [Java::IoVertxServicediscovery::Record.java_class]).call(Java::IoVertxServicediscovery::Record.new(::Vertx::Util::Utils.to_json_object(record))),::VertxServiceDiscovery::ServiceReference)
      end
      raise ArgumentError, "Invalid arguments when calling get_reference(#{record})"
    end

### - (`::VertxServiceDiscovery::ServiceReference`) get_reference_with_configuration(record = nil, configuration = nil)

Gets a service reference from the given record, the reference is configured with the given json object.

Parameters:

- record (`Hash`) (defaults to: `nil`) —
  the chosen record
- configuration (`Hash{String => Object}`) (defaults to: `nil`) —
  the configuration

Returns:

- (`::VertxServiceDiscovery::ServiceReference`) —
  the service reference, that allows retrieving the service object. Once called the service reference is cached, and need to be released.

Raises:

- (`ArgumentError`)

    96
    97
    98
    99
    100
    101
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 96

    def get_reference_with_configuration(record=nil,configuration=nil)
      if record.class == Hash && configuration.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getReferenceWithConfiguration, [Java::IoVertxServicediscovery::Record.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(Java::IoVertxServicediscovery::Record.new(::Vertx::Util::Utils.to_json_object(record)),::Vertx::Util::Utils.to_json_object(configuration)),::VertxServiceDiscovery::ServiceReference)
      end
      raise ArgumentError, "Invalid arguments when calling get_reference_with_configuration(#{record},#{configuration})"
    end

### - (`Hash`) options

Returns the discovery options. Modifying the returned object would not update the discovery service configuration. This object should be considered as read-only.

Returns:

- (`Hash`) —
  the discovery options. Modifying the returned object would not update the discovery service configuration. This object should be considered as read-only.

Raises:

- (`ArgumentError`)

    242
    243
    244
    245
    246
    247
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 242

    def options
      if !block_given?
        return @j_del.java_method(:options, []).call() != nil ? JSON.parse(@j_del.java_method(:options, []).call().toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling options()"
    end

### - (`void`) publish(record = nil) { ... }

This method returns an undefined value.

Publishes a record.

Parameters:

- record (`Hash`) (defaults to: `nil`) —
  the record

Yields:

- handler called when the operation has completed (successfully or not). In case of success, the passed record has a registration id required to modify and un-register the service.

Raises:

- (`ArgumentError`)

    151
    152
    153
    154
    155
    156
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 151

    def publish(record=nil)
      if record.class == Hash && block_given?
        return @j_del.java_method(:publish, [Java::IoVertxServicediscovery::Record.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxServicediscovery::Record.new(::Vertx::Util::Utils.to_json_object(record)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling publish(#{record})"
    end

### - (`::VertxServiceDiscovery::ServiceDiscovery`) register_service_exporter(exporter = nil, configuration = nil) { ... }

Registers a discovery bridge. Exporters let you integrate other discovery technologies in this service discovery.

Parameters:

- exporter (`::VertxServiceDiscovery::ServiceExporter`) (defaults to: `nil`) —
  the service exporter
- configuration (`Hash{String => Object}`) (defaults to: `nil`) —
  the optional configuration

Yields:

- handler notified when the exporter has been correctly initialized.

Returns:

- (`::VertxServiceDiscovery::ServiceDiscovery`) —
  the current VertxServiceDiscovery::ServiceDiscovery

Raises:

- (`ArgumentError`)

    131
    132
    133
    134
    135
    136
    137
    138
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 131

    def register_service_exporter(exporter=nil,configuration=nil)
      if exporter.class.method_defined?(:j_del) && configuration.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:registerServiceExporter, [Java::IoVertxServicediscoverySpi::ServiceExporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(exporter.j_del,::Vertx::Util::Utils.to_json_object(configuration)),::VertxServiceDiscovery::ServiceDiscovery)
      elsif exporter.class.method_defined?(:j_del) && configuration.class == Hash && block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:registerServiceExporter, [Java::IoVertxServicediscoverySpi::ServiceExporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(exporter.j_del,::Vertx::Util::Utils.to_json_object(configuration),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })),::VertxServiceDiscovery::ServiceDiscovery)
      end
      raise ArgumentError, "Invalid arguments when calling register_service_exporter(#{exporter},#{configuration})"
    end

### - (`::VertxServiceDiscovery::ServiceDiscovery`) register_service_importer(importer = nil, configuration = nil) { ... }

Registers a discovery service importer. Importers let you integrate other discovery technologies in this service discovery.

Parameters:

- importer (`::VertxServiceDiscovery::ServiceImporter`) (defaults to: `nil`) —
  the service importer
- configuration (`Hash{String => Object}`) (defaults to: `nil`) —
  the optional configuration

Yields:

- handler call when the importer has finished its initialization and initial imports

Returns:

- (`::VertxServiceDiscovery::ServiceDiscovery`) —
  the current VertxServiceDiscovery::ServiceDiscovery

Raises:

- (`ArgumentError`)

    117
    118
    119
    120
    121
    122
    123
    124
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 117

    def register_service_importer(importer=nil,configuration=nil)
      if importer.class.method_defined?(:j_del) && configuration.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:registerServiceImporter, [Java::IoVertxServicediscoverySpi::ServiceImporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(importer.j_del,::Vertx::Util::Utils.to_json_object(configuration)),::VertxServiceDiscovery::ServiceDiscovery)
      elsif importer.class.method_defined?(:j_del) && configuration.class == Hash && block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:registerServiceImporter, [Java::IoVertxServicediscoverySpi::ServiceImporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(importer.j_del,::Vertx::Util::Utils.to_json_object(configuration),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })),::VertxServiceDiscovery::ServiceDiscovery)
      end
      raise ArgumentError, "Invalid arguments when calling register_service_importer(#{importer},#{configuration})"
    end

### - (`true`, `false`) release?(reference = nil)

Releases the service reference.

Parameters:

- reference (`::VertxServiceDiscovery::ServiceReference`) (defaults to: `nil`) —
  the reference to release, must not be `null`

Returns:

- (`true`, `false`) —
  whether or not the reference has been released.

Raises:

- (`ArgumentError`)

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

    def release?(reference=nil)
      if reference.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:release, [Java::IoVertxServicediscovery::ServiceReference.java_class]).call(reference.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling release?(#{reference})"
    end

### - (`void`) unpublish(id = nil) { ... }

This method returns an undefined value.

Un-publishes a record.

Parameters:

- id (`String`) (defaults to: `nil`) —
  the registration id

Yields:

- handler called when the operation has completed (successfully or not).

Raises:

- (`ArgumentError`)

    161
    162
    163
    164
    165
    166
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 161

    def unpublish(id=nil)
      if id.class == String && block_given?
        return @j_del.java_method(:unpublish, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling unpublish(#{id})"
    end

### - (`void`) update(record = nil) { ... }

This method returns an undefined value.

Updates the given record. The record must has been published, and has it's registration id set.

Parameters:

- record (`Hash`) (defaults to: `nil`) —
  the updated record

Yields:

- handler called when the lookup has been completed.

Raises:

- (`ArgumentError`)

    228
    229
    230
    231
    232
    233
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 228

    def update(record=nil)
      if record.class == Hash && block_given?
        return @j_del.java_method(:update, [Java::IoVertxServicediscovery::Record.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxServicediscovery::Record.new(::Vertx::Util::Utils.to_json_object(record)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling update(#{record})"
    end