Class List Method List File List

# Class: VertxServiceDiscovery::ServicePublisher

Inherits:
  Object
  - Object
  - VertxServiceDiscovery::ServicePublisher
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/service_publisher.rb

## Instance Method Summary (collapse)

- - (ServicePublisher) initialize(j_del) constructor
  A new instance of ServicePublisher.
- - (Object) j_del
- - (Object) publish(record = nil)
- - (Object) unpublish(id = nil)

## Constructor Details

### - (`ServicePublisher`) initialize(j_del)

Returns a new instance of ServicePublisher

    8
    9
    10
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/service_publisher.rb', line 8

    def initialize(j_del)
      @j_del = j_del
    end

## Instance Method Details

### - (`Object`) j_del

    13
    14
    15
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/service_publisher.rb', line 13

    def j_del
      @j_del
    end

### - (`Object`) publish(record = nil)

Raises:

- (`ArgumentError`)

    20
    21
    22
    23
    24
    25
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/service_publisher.rb', line 20

    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

### - (`Object`) unpublish(id = nil)

Raises:

- (`ArgumentError`)

    30
    31
    32
    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/service_publisher.rb', line 30

    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