Class: VertxKafkaClient::KafkaAdminClient

Inherits:
Object
  • Object
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)

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-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:

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) close(timeout = nil) { ... }

This method returns an undefined value.

Close the admin client

Parameters:

  • timeout (Fixnum) (defaults to: nil)
    timeout to wait for closing

Yields:

  • handler called on operation completed

Raises:

  • (ArgumentError)

85
86
87
88
89
90
91
92
93
94
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 85

def close(timeout=nil)
  if !block_given? && timeout == nil
    return @j_del.java_method(:close, []).call()
  elsif block_given? && timeout == nil
    return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  elsif timeout.class == Fixnum && block_given?
    return @j_del.java_method(:close, [Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(timeout,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling close(#{timeout})"
end

- (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_consumer_group_offsets(groupId = nil, partitions = nil) { ... }

This method returns an undefined value.

Delete committed offsets for a set of partitions in a consumer group. This will succeed at the partition level only if the group is not actively subscribed to the corresponding topic.

Parameters:

  • groupId (String) (defaults to: nil)
    The group id of the group whose offsets will be listed
  • partitions (Set<Hash>) (defaults to: nil)
    The set of partitions in the consumer group whose offsets will be deleted

Yields:

Raises:

  • (ArgumentError)

121
122
123
124
125
126
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 121

def delete_consumer_group_offsets(groupId=nil,partitions=nil)
  if groupId.class == String && partitions.class == Set && block_given?
    return @j_del.java_method(:deleteConsumerGroupOffsets, [Java::java.lang.String.java_class,Java::JavaUtil::Set.java_class,Java::IoVertxCore::Handler.java_class]).call(groupId,Java::JavaUtil::LinkedHashSet.new(partitions.map { |element| Java::IoVertxKafkaClientCommon::TopicPartition.new(::Vertx::Util::Utils.to_json_object(element)) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling delete_consumer_group_offsets(#{groupId},#{partitions})"
end

- (void) delete_consumer_groups(groupIds = nil) { ... }

This method returns an undefined value.

Delete consumer groups from the cluster.

Parameters:

  • groupIds (Array<String>) (defaults to: nil)
    the ids of the groups to delete

Yields:

  • handler called on operation completed

Raises:

  • (ArgumentError)

108
109
110
111
112
113
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 108

def delete_consumer_groups(groupIds=nil)
  if groupIds.class == Array && block_given?
    return @j_del.java_method(:deleteConsumerGroups, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(groupIds.map { |element| element },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling delete_consumer_groups(#{groupIds})"
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) describe_cluster { ... }

This method returns an undefined value.

Describe the nodes in the cluster with the default options

Yields:

  • handler called on operation completed with the cluster description

Raises:

  • (ArgumentError)

98
99
100
101
102
103
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_admin_client.rb', line 98

def describe_cluster
  if block_given?
    return @j_del.java_method(:describeCluster, [Java::IoVertxCore::Handler.java_class]).call((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 describe_cluster()"
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