Class: VertxServiceDiscovery::ServiceDiscovery

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

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 {Hash{String => Object}records}.

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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (::VertxServiceDiscovery::ServiceDiscovery) create(vertx) + (::VertxServiceDiscovery::ServiceDiscovery) create(vertx, options)

Creates an instance of VertxServiceDiscovery::ServiceDiscovery.

Overloads:

Returns:



306
307
308
309
310
311
312
313
314
315
316
317
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 306

def self.create(*args)
  if args[0].class.method_defined?(:j_del) && !block_given? && args[1] == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxServicediscovery::ServiceDiscovery.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(args[0].j_del),::VertxServiceDiscovery::ServiceDiscovery)
  elsif args[0].class.method_defined?(:j_del) && args[1].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(args[0].j_del,Java::IoVertxServicediscovery::ServiceDiscoveryOptions.new(::Vertx::Util::Utils.to_json_object(args[1]))),::VertxServiceDiscovery::ServiceDiscovery)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]})"
  end
end

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (void) releaseServiceObject(discovery, svcObject)

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:



289
290
291
292
293
294
295
296
297
298
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 289

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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:



123
124
125
126
127
128
129
130
131
132
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 123

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling bindings()"
  end
end

- (void) close

This method returns an undefined value.

Closes the service discovery


371
372
373
374
375
376
377
378
379
380
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 371

def close
  if !block_given?
    return @j_del.java_method(:close, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling close()"
  end
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 => Object} 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.


336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 336

def get_record(*args)
  if args[0].class == Hash && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:getRecord, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(args[0]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getRecord, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(args[0]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxServicediscovery::Record))
    end
  elsif args[0].class == Proc && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:getRecord, [Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getRecord, [Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxServicediscovery::Record))
    end
  elsif args[0].class == Proc && (args[1].class == TrueClass || args[1].class == FalseClass) && true
    if (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| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getRecord, [Java::JavaUtilFunction::Function.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxServicediscovery::Record))
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_record(#{args[0]},#{args[1]})"
  end
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 => Object} 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.


251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 251

def get_records(*args)
  if args[0].class == Hash && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:getRecords, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(args[0]),block_given? ? 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) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getRecords, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(args[0]),block_given? ? 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) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  elsif args[0].class == Proc && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:getRecords, [Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),block_given? ? 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) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getRecords, [Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),block_given? ? 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) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  elsif args[0].class == Proc && (args[1].class == TrueClass || args[1].class == FalseClass) && true
    if (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| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),args[1],block_given? ? 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) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getRecords, [Java::JavaUtilFunction::Function.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| args[0].call(event != nil ? JSON.parse(event.toJson.encode) : nil) unless args[0] == nil }),args[1],block_given? ? 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) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_records(#{args[0]},#{args[1]})"
  end
end

- (::VertxServiceDiscovery::ServiceReference) getReference(record)

Gets a service reference from the given record.

Parameters:

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

Returns:



385
386
387
388
389
390
391
392
393
394
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 385

def get_reference(*args)
  if args[0].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(args[0]))),::VertxServiceDiscovery::ServiceReference)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_reference(#{args[0]})"
  end
end

- (::VertxServiceDiscovery::ServiceReference) getReferenceWithConfiguration(record, configuration)

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

Parameters:

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

Returns:



111
112
113
114
115
116
117
118
119
120
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 111

def get_reference_with_configuration(*args)
  if args[0].class == Hash && args[1].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(args[0])),::Vertx::Util::Utils.to_json_object(args[1])),::VertxServiceDiscovery::ServiceReference)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_reference_with_configuration(#{args[0]},#{args[1]})"
  end
end

- (Hash{String => Object}) 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{String => Object})
    the discovery options. Modifying the returned object would not update the discovery service configuration. This object should be considered as read-only.


222
223
224
225
226
227
228
229
230
231
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 222

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling options()"
  end
end

- (void) publish(record, resultHandler) { ... }

This method returns an undefined value.

Publishes a record.

Parameters:

  • record (Hash{String => Object})
    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.


204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 204

def publish(*args)
  if args[0].class == Hash && true
    if (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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxServicediscovery::Record))
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling publish(#{args[0]})"
  end
end

- (self) registerServiceExporter(exporter, configuration, completionHandler) { ... }

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

Parameters:

Yields:

  • handler notified when the exporter has been correctly initialized.

Returns:

  • (self)


161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 161

def register_service_exporter(*args)
  if args[0].class.method_defined?(:j_del) && args[1].class == Hash && true
    if (block_given?)
      @j_del.java_method(:registerServiceExporter, [Java::IoVertxServicediscoverySpi::ServiceExporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,::Vertx::Util::Utils.to_json_object(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:registerServiceExporter, [Java::IoVertxServicediscoverySpi::ServiceExporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,::Vertx::Util::Utils.to_json_object(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling register_service_exporter(#{args[0]},#{args[1]})"
  end
end

- (self) registerServiceImporter(importer, configuration, completionHandler) { ... }

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

Parameters:

Yields:

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

Returns:

  • (self)


75
76
77
78
79
80
81
82
83
84
85
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 75

def register_service_importer(*args)
  if args[0].class.method_defined?(:j_del) && args[1].class == Hash && true
    if (block_given?)
      @j_del.java_method(:registerServiceImporter, [Java::IoVertxServicediscoverySpi::ServiceImporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,::Vertx::Util::Utils.to_json_object(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:registerServiceImporter, [Java::IoVertxServicediscoverySpi::ServiceImporter.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,::Vertx::Util::Utils.to_json_object(args[1]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling register_service_importer(#{args[0]},#{args[1]})"
  end
end

- (true, false) release(reference)

Releases the service reference.

Parameters:

Returns:

  • (true, false)
    whether or not the reference has been released.


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

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

- (void) unpublish(id, resultHandler) { ... }

This method returns an undefined value.

Un-publishes a record.

Parameters:

  • id (String)
    the registration id

Yields:

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


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

def unpublish(*args)
  if args[0].class == String && true
    if (block_given?)
      return @j_del.java_method(:unpublish, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:unpublish, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling unpublish(#{args[0]})"
  end
end

- (void) update(record, resultHandler) { ... }

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{String => Object})
    the updated record

Yields:

  • handler called when the lookup has been completed.


138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_discovery.rb', line 138

def update(*args)
  if args[0].class == Hash && true
    if (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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxServicediscovery::Record))
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling update(#{args[0]})"
  end
end