Class: VertxKafkaClient::AdminUtils

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb

Overview

Provides a wrapper around important methods in Kafka's AdminUtils, namely

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-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 18

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

+ (::VertxKafkaClient::AdminUtils) create(vertx, zookeeperHosts) + (::VertxKafkaClient::AdminUtils) create(vertx, zookeeperHosts, autoClose) + (::VertxKafkaClient::AdminUtils) create(vertx, zookeeperHosts, connectionTimeoutMs, isSecure, autoClose)

Create a new AdminUtils instance

Overloads:

  • + (::VertxKafkaClient::AdminUtils) create(vertx, zookeeperHosts)

    Parameters:

    • vertx (::Vertx::Vertx)
      Vert.x instance to use
    • zookeeperHosts (String)
      comma-separated list of Zookeeper server, e.g. localhost:2181,localhost:2182
  • + (::VertxKafkaClient::AdminUtils) create(vertx, zookeeperHosts, autoClose)

    Parameters:

    • vertx (::Vertx::Vertx)
      Vert.x instance to use
    • zookeeperHosts (String)
      comma-separated list of Zookeeper server, e.g. localhost:2181,localhost:2182
    • autoClose (true, false)
      If set to true, the client will auto-close the connection after a command
  • + (::VertxKafkaClient::AdminUtils) create(vertx, zookeeperHosts, connectionTimeoutMs, isSecure, autoClose)

    Parameters:

    • vertx (::Vertx::Vertx)
      Vert.x instance to use
    • zookeeperHosts (String)
      comma-separated list of Zookeeper server, e.g. localhost:2181,localhost:2182
    • connectionTimeoutMs (Fixnum)
      Maximum time in ms to wait for the client to connect to Zookeeper
    • isSecure (true, false)
      If set to true, ZkUtils will perform security checks, i.e. ACL checks
    • autoClose (true, false)
      If set to true, the client will auto-close the connection after a command

Returns:

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
56
57
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 48

def self.create(param_1=nil,param_2=nil,param_3=nil,param_4=nil,param_5=nil)
  if param_1.class.method_defined?(:j_del) && param_2.class == String && !block_given? && param_3 == nil && param_4 == nil && param_5 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxKafkaAdmin::AdminUtils.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(param_1.j_del,param_2),::VertxKafkaClient::AdminUtils)
  elsif param_1.class.method_defined?(:j_del) && param_2.class == String && (param_3.class == TrueClass || param_3.class == FalseClass) && !block_given? && param_4 == nil && param_5 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxKafkaAdmin::AdminUtils.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::boolean.java_class]).call(param_1.j_del,param_2,param_3),::VertxKafkaClient::AdminUtils)
  elsif param_1.class.method_defined?(:j_del) && param_2.class == String && param_3.class == Fixnum && (param_4.class == TrueClass || param_4.class == FalseClass) && (param_5.class == TrueClass || param_5.class == FalseClass) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxKafkaAdmin::AdminUtils.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::boolean.java_class,Java::boolean.java_class]).call(param_1.j_del,param_2,param_3,param_4,param_5),::VertxKafkaClient::AdminUtils)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{param_1},#{param_2},#{param_3},#{param_4},#{param_5})"
end

+ (Object) j_api_type



27
28
29
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 27

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



30
31
32
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 30

def self.j_class
  Java::IoVertxKafkaAdmin::AdminUtils.java_class
end

+ (Object) unwrap(obj)



24
25
26
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 24

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

+ (Object) wrap(obj)



21
22
23
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 21

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

Instance Method Details

- (void) change_topic_config(topicName = nil, topicConfig = nil) { ... }

This method returns an undefined value.

Updates the configuration of the topic given by topicName. Configuration parameters are passed in as a Map (Key -> Value) of Strings.

Parameters:

  • topicName (String) (defaults to: nil)
    topic to be configured
  • topicConfig (Hash{String => String}) (defaults to: nil)
    Map with configuration items

Yields:

  • vert.x callback

Raises:

  • (ArgumentError)


101
102
103
104
105
106
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 101

def change_topic_config(topicName=nil,topicConfig=nil)
  if topicName.class == String && topicConfig.class == Hash && block_given?
    return @j_del.java_method(:changeTopicConfig, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class]).call(topicName,Hash[topicConfig.map { |k,v| [k,v] }],(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling change_topic_config(#{topicName},#{topicConfig})"
end

- (void) close { ... }

This method returns an undefined value.

Closes the underlying connection to Zookeeper. It is required to call the method for cleanup purposes if AdminUtils was not created with autoClose set to true.

Yields:

  • vert.x callback

Raises:

  • (ArgumentError)


111
112
113
114
115
116
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 111

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

- (void) create_topic(topicName = nil, partitionCount = nil, replicationFactor = nil, topicConfig = nil) { ... }

This method returns an undefined value.

Creates a new Kafka topic on all Brokers managed by the given Zookeeper instance(s). In contrast to @see #create_topic, one can pass in additional configuration parameters as a map (String -> String).

Parameters:

  • topicName (String) (defaults to: nil)
    Name of the to-be-created topic
  • partitionCount (Fixnum) (defaults to: nil)
    Number of partitions
  • replicationFactor (Fixnum) (defaults to: nil)
    Number of replicates. Must be lower or equal to the number of available Brokers
  • topicConfig (Hash{String => String}) (defaults to: nil)
    map with additional topic configuration parameters

Yields:

  • vert.x callback

Raises:

  • (ArgumentError)


67
68
69
70
71
72
73
74
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 67

def create_topic(topicName=nil,partitionCount=nil,replicationFactor=nil,topicConfig=nil)
  if topicName.class == String && partitionCount.class == Fixnum && replicationFactor.class == Fixnum && block_given? && topicConfig == nil
    return @j_del.java_method(:createTopic, [Java::java.lang.String.java_class,Java::int.java_class,Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(topicName,partitionCount,replicationFactor,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  elsif topicName.class == String && partitionCount.class == Fixnum && replicationFactor.class == Fixnum && topicConfig.class == Hash && block_given?
    return @j_del.java_method(:createTopic, [Java::java.lang.String.java_class,Java::int.java_class,Java::int.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class]).call(topicName,partitionCount,replicationFactor,Hash[topicConfig.map { |k,v| [k,v] }],(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling create_topic(#{topicName},#{partitionCount},#{replicationFactor},#{topicConfig})"
end

- (void) delete_topic(topicName = nil) { ... }

This method returns an undefined value.

Delete the Kafka topic given by the topicName.

Parameters:

  • topicName (String) (defaults to: nil)
    Name of the topic to be deleted

Yields:

  • vert.x callback

Raises:

  • (ArgumentError)


79
80
81
82
83
84
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 79

def delete_topic(topicName=nil)
  if topicName.class == String && block_given?
    return @j_del.java_method(:deleteTopic, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(topicName,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling delete_topic(#{topicName})"
end

- (void) topic_exists(topicName = nil) { ... }

This method returns an undefined value.

Checks if the Kafka topic given by topicName does exist.

Parameters:

  • topicName (String) (defaults to: nil)
    Name of the topic

Yields:

  • vert.x callback

Raises:

  • (ArgumentError)


89
90
91
92
93
94
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-kafka-client/admin_utils.rb', line 89

def topic_exists(topicName=nil)
  if topicName.class == String && block_given?
    return @j_del.java_method(:topicExists, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(topicName,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling topic_exists(#{topicName})"
end