Class: VertxServiceDiscovery::ServicePublisher

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_publisher.rb

Overview

The publisher is used by the importer to publish or unpublish records.

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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_publisher.rb', line 18

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

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

def self.j_class
  Java::IoVertxServicediscoverySpi::ServicePublisher.java_class
end

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (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.


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_publisher.rb', line 59

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

- (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).


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_publisher.rb', line 38

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 an existing 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.


80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_publisher.rb', line 80

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