Class List Method List File List

# Class: VertxServiceDiscovery::ServiceExporter

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

## Overview

The service exporter allows integrate other discovery technologies with the Vert.x service discovery. It maps entries from another technology to a and maps to a publication in this other technology. The exporter is one side of a service discovery bridge.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) close { ... }
  Close the exporter.
- - (void) init(vertx = nil, publisher = nil, configuration = nil, future = nil)
  Starts the exporter.
- - (void) on_publish(record = nil)
  Notify a new record has been published, the record's registration can be used to uniquely identify the record.
- - (void) on_unpublish(id = nil)
  Notify an existing record has been removed.
- - (void) on_update(record = nil)
  Notify an existing record has been updated, the record's registration can be used to uniquely identify the record.

## Class Method Details

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

Returns:

- (`Boolean`)

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

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

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    34
    35
    36
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_exporter.rb', line 34

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

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

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

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

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

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

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

## Instance Method Details

### - (`void`) close { ... }

This method returns an undefined value.

Close the exporter

Yields:

- the handle to be notified when exporter is closed, may be `null`

Raises:

- (`ArgumentError`)

    81
    82
    83
    84
    85
    86
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_exporter.rb', line 81

    def close
      if block_given?
        return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`void`) init(vertx = nil, publisher = nil, configuration = nil, future = nil)

This method returns an undefined value.

Starts the exporter.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the vertx instance
- publisher (`::VertxServiceDiscovery::ServicePublisher`) (defaults to: `nil`) —
  the service discovery instance
- configuration (`Hash{String => Object}`) (defaults to: `nil`) —
  the bridge configuration if any
- future (`::Vertx::Promise`) (defaults to: `nil`) —
  a future on which the bridge must report the completion of the starting

Raises:

- (`ArgumentError`)

    43
    44
    45
    46
    47
    48
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_exporter.rb', line 43

    def init(vertx=nil,publisher=nil,configuration=nil,future=nil)
      if vertx.class.method_defined?(:j_del) && publisher.class.method_defined?(:j_del) && configuration.class == Hash && future.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:init, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxServicediscoverySpi::ServicePublisher.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Promise.java_class]).call(vertx.j_del,publisher.j_del,::Vertx::Util::Utils.to_json_object(configuration),future.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling init(#{vertx},#{publisher},#{configuration},#{future})"
    end

### - (`void`) on_publish(record = nil)

This method returns an undefined value.

Notify a new record has been published, the record's registration can be used to uniquely identify the record

Parameters:

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

Raises:

- (`ArgumentError`)

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

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

### - (`void`) on_unpublish(id = nil)

This method returns an undefined value.

Notify an existing record has been removed

Parameters:

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

Raises:

- (`ArgumentError`)

    72
    73
    74
    75
    76
    77
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/service_exporter.rb', line 72

    def on_unpublish(id=nil)
      if id.class == String && !block_given?
        return @j_del.java_method(:onUnpublish, [Java::java.lang.String.java_class]).call(id)
      end
      raise ArgumentError, "Invalid arguments when calling on_unpublish(#{id})"
    end

### - (`void`) on_update(record = nil)

This method returns an undefined value.

Notify an existing record has been updated, the record's registration can be used to uniquely identify the record

Parameters:

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

Raises:

- (`ArgumentError`)

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

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