Class List Method List File List

# Class: VertxServiceDiscovery::RedisDataSource

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

## Overview

Service type for Redis data source.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Hash) create_record(name = nil, location = nil, metadata = nil)
  Convenient method to create a record for a Redis data source.
- + (void) get_redis_client(param_1 = nil, param_2 = nil, param_3 = nil)
  Convenient method that looks for a Redis data source and provides the configured VertxRedis::RedisClient.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Class Method Details

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

Returns:

- (`Boolean`)

    19
    20
    21
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/redis_data_source.rb', line 19

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

### + (`Hash`) create_record(name = nil, location = nil, metadata = nil)

Convenient method to create a record for a Redis data source.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the service name
- location (`Hash{String => Object}`) (defaults to: `nil`) —
  the location of the service (e.g. url, port...)
- metadata (`Hash{String => Object}`) (defaults to: `nil`) —
  additional metadata

Returns:

- (`Hash`) —
  the created record

Raises:

- (`ArgumentError`)

    39
    40
    41
    42
    43
    44
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/redis_data_source.rb', line 39

    def self.create_record(name=nil,location=nil,metadata=nil)
      if name.class == String && location.class == Hash && metadata.class == Hash && !block_given?
        return Java::IoVertxServicediscoveryTypes::RedisDataSource.java_method(:createRecord, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(name,::Vertx::Util::Utils.to_json_object(location),::Vertx::Util::Utils.to_json_object(metadata)) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::RedisDataSource.java_method(:createRecord, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(name,::Vertx::Util::Utils.to_json_object(location),::Vertx::Util::Utils.to_json_object(metadata)).toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling create_record(#{name},#{location},#{metadata})"
    end

### + (`void`) getRedisClient(discovery, filter, resultHandler) { ... } + (`void`) getRedisClient(discovery, filter, resultHandler) { ... } + (`void`) getRedisClient(discovery, filter, consumerConfiguration, resultHandler) { ... } + (`void`) getRedisClient(discovery, filter, consumerConfiguration, resultHandler) { ... }

This method returns an undefined value.

Convenient method that looks for a Redis data source and provides the configured VertxRedis::RedisClient. The async result is marked as failed is there are no matching services, or if the lookup fails.

Overloads:

- + (`void`) getRedisClient(discovery, filter, resultHandler) { ... }

  Parameters:

  - discovery (`::VertxServiceDiscovery::ServiceDiscovery`) —
    The service discovery instance
  - filter (`Hash{String => Object}`) —
    The filter, optional

  Yields:

  - The result handler
- + (`void`) getRedisClient(discovery, filter, resultHandler) { ... }

  Parameters:

  - discovery (`::VertxServiceDiscovery::ServiceDiscovery`) —
    The service discovery instance
  - filter (`Proc`) —
    The filter, cannot be `null`

  Yields:

  - The result handler
- + (`void`) getRedisClient(discovery, filter, consumerConfiguration, resultHandler) { ... }

  Parameters:

  - discovery (`::VertxServiceDiscovery::ServiceDiscovery`) —
    The service discovery instance
  - filter (`Hash{String => Object}`) —
    The filter, optional
  - consumerConfiguration (`Hash{String => Object}`) —
    The additional consumer configuration

  Yields:

  - The result handler
- + (`void`) getRedisClient(discovery, filter, consumerConfiguration, resultHandler) { ... }

  Parameters:

  - discovery (`::VertxServiceDiscovery::ServiceDiscovery`) —
    The service discovery instance
  - filter (`Proc`) —
    The filter, cannot be `null`
  - consumerConfiguration (`Hash{String => Object}`) —
    The additional consumer configuration

  Yields:

  - The result handler

Raises:

- (`ArgumentError`)

    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/redis_data_source.rb', line 66

    def self.get_redis_client(param_1=nil,param_2=nil,param_3=nil)
      if param_1.class.method_defined?(:j_del) && param_2.class == Hash && block_given? && param_3 == nil
        return Java::IoVertxServicediscoveryTypes::RedisDataSource.java_method(:getRedisClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,::Vertx::Util::Utils.to_json_object(param_2),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxRedis::RedisClient) : nil) }))
      elsif param_1.class.method_defined?(:j_del) && param_2.class == Proc && block_given? && param_3 == nil
        return Java::IoVertxServicediscoveryTypes::RedisDataSource.java_method(:getRedisClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,(Proc.new { |event| param_2.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxRedis::RedisClient) : nil) }))
      elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && param_3.class == Hash && block_given?
        return Java::IoVertxServicediscoveryTypes::RedisDataSource.java_method(:getRedisClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,::Vertx::Util::Utils.to_json_object(param_2),::Vertx::Util::Utils.to_json_object(param_3),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxRedis::RedisClient) : nil) }))
      elsif param_1.class.method_defined?(:j_del) && param_2.class == Proc && param_3.class == Hash && block_given?
        return Java::IoVertxServicediscoveryTypes::RedisDataSource.java_method(:getRedisClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::JavaUtilFunction::Function.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,(Proc.new { |event| param_2.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),::Vertx::Util::Utils.to_json_object(param_3),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxRedis::RedisClient) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get_redis_client(#{param_1},#{param_2},#{param_3})"
    end

### + (`Object`) j_api_type

    28
    29
    30
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/redis_data_source.rb', line 28

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

    def self.j_class
      Java::IoVertxServicediscoveryTypes::RedisDataSource.java_class
    end

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

    25
    26
    27
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/redis_data_source.rb', line 25

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

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

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

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