Class List Method List File List

# Class: VertxKafkaClient::KafkaAdminClient

Inherits:
  Object
  - Object
  - VertxKafkaClient::KafkaAdminClient
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb

## Overview

Vert.x Kafka Admin client implementation

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxKafkaClient::KafkaAdminClient) create(vertx = nil, config = nil)
  Create a new KafkaAdminClient instance.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) create_topics(topics = nil) { ... }
  Creates a batch of new Kafka topics.
- - (void) delete_topics(topicNames = nil) { ... }
  Deletes a batch of Kafka topics.
- - (void) list_consumer_groups { ... }
  Get the the consumer groups available in the cluster with the default options.
- - (void) list_topics { ... }
  List the topics available in the cluster with the default options.

## 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-kafka-client/kafka_admin_client.rb', line 18

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

### + (`::VertxKafkaClient::KafkaAdminClient`) create(vertx = nil, config = nil)

Create a new KafkaAdminClient instance

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  Vert.x instance to use
- config (`Hash{String => String}`) (defaults to: `nil`) —
  Kafka admin client configuration

Returns:

- (`::VertxKafkaClient::KafkaAdminClient`) —
  an instance of the KafkaAdminClient

Raises:

- (`ArgumentError`)

    37
    38
    39
    40
    41
    42
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 37

    def self.create(vertx=nil,config=nil)
      if vertx.class.method_defined?(:j_del) && config.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxKafkaAdmin::KafkaAdminClient.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::JavaUtil::Map.java_class]).call(vertx.j_del,Hash[config.map { |k,v| [k,v] }]),::VertxKafkaClient::KafkaAdminClient)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{config})"
    end

### + (`Object`) j_api_type

    27
    28
    29
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.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-kafka-client/kafka_admin_client.rb', line 30

    def self.j_class
      Java::IoVertxKafkaAdmin::KafkaAdminClient.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-kafka-client/kafka_admin_client.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-kafka-client/kafka_admin_client.rb', line 21

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

## Instance Method Details

### - (`void`) create_topics(topics = nil) { ... }

This method returns an undefined value.

Creates a batch of new Kafka topics

Parameters:

- topics (`Array<Hash>`) (defaults to: `nil`) —
  topics to create

Yields:

- handler called on operation completed

Raises:

- (`ArgumentError`)

    56
    57
    58
    59
    60
    61
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 56

    def create_topics(topics=nil)
      if topics.class == Array && block_given?
        return @j_del.java_method(:createTopics, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(topics.map { |element| Java::IoVertxKafkaAdmin::NewTopic.new(::Vertx::Util::Utils.to_json_object(element)) },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling create_topics(#{topics})"
    end

### - (`void`) delete_topics(topicNames = nil) { ... }

This method returns an undefined value.

Deletes a batch of Kafka topics

Parameters:

- topicNames (`Array<String>`) (defaults to: `nil`) —
  the names of the topics to delete

Yields:

- handler called on operation completed

Raises:

- (`ArgumentError`)

    66
    67
    68
    69
    70
    71
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 66

    def delete_topics(topicNames=nil)
      if topicNames.class == Array && block_given?
        return @j_del.java_method(:deleteTopics, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(topicNames.map { |element| element },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling delete_topics(#{topicNames})"
    end

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

This method returns an undefined value.

Get the the consumer groups available in the cluster with the default options

Yields:

- handler called on operation completed with the consumer groups ids

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 75

    def list_consumer_groups
      if block_given?
        return @j_del.java_method(:listConsumerGroups, [Java::IoVertxCore::Handler.java_class]).call((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) }))
      end
      raise ArgumentError, "Invalid arguments when calling list_consumer_groups()"
    end

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

This method returns an undefined value.

List the topics available in the cluster with the default options.

Yields:

- handler called on operation completed with the topics set

Raises:

- (`ArgumentError`)

    46
    47
    48
    49
    50
    51
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 46

    def list_topics
      if block_given?
        return @j_del.java_method(:listTopics, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.to_set(ar.result).map! { |elt| elt } : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling list_topics()"
    end