Class: Kafka::FFI::Admin::AdminOptions
- Inherits:
-
OpaquePointer
- Object
- OpaquePointer
- Kafka::FFI::Admin::AdminOptions
- Defined in:
- lib/kafka/ffi/admin/admin_options.rb
Instance Attribute Summary
Attributes inherited from OpaquePointer
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
-
#set_broker(broker_id) ⇒ Object
(also: #broker=)
Override which broker the Admin request will be sent to.
-
#set_operation_timeout(timeout) ⇒ Object
(also: #operation_timeout=)
Set the broker's operation wait timeout for the request to be processed by the cluster.
-
#set_request_timeout(timeout) ⇒ Object
(also: #request_timeout=)
Sets the overall request timeout which includes broker lookup, request transmissing, operation time, and response processing.
-
#set_validate_only(on) ⇒ Object
(also: #validate_only=)
Tell the broker to only validate the request without actually performing the operation.
Methods inherited from OpaquePointer
by_ref, from_native, inherited, #initialize, to_native
Constructor Details
This class inherits a constructor from Kafka::FFI::OpaquePointer
Class Method Details
.new(client, api) ⇒ Object
7 8 9 |
# File 'lib/kafka/ffi/admin/admin_options.rb', line 7 def self.new(client, api) ::Kafka::FFI.rd_kafka_AdminOptions_new(client, api) end |
Instance Method Details
#destroy ⇒ Object
117 118 119 |
# File 'lib/kafka/ffi/admin/admin_options.rb', line 117 def destroy ::Kafka::FFI.rd_kafka_AdminOptions_destroy(self) end |
#set_broker(broker_id) ⇒ Object Also known as: broker=
This API shoudl typically not be used and primarily serves as a workaround in some cases.
Override which broker the Admin request will be sent to. By default, requests are sent to the controller Broker with a couple exceptions (see librdkafka)
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/kafka/ffi/admin/admin_options.rb', line 96 def set_broker(broker_id) error = ::FFI::MemoryPointer.new(:char, 512) resp = ::Kafka::FFI.rd_kafka_AdminOptions_set_broker(self, broker_id, error, error.size) if resp != :ok raise ::Kafka::ResponseError.new(resp, error.read_string) end nil ensure error.free end |
#set_operation_timeout(timeout) ⇒ Object Also known as: operation_timeout=
Set the broker's operation wait timeout for the request to be processed by the cluster.
Only valid for :create_topics, :delete_topics, and :create_partitions operations.
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/kafka/ffi/admin/admin_options.rb', line 51 def set_operation_timeout(timeout) error = ::FFI::MemoryPointer.new(:char, 512) resp = ::Kafka::FFI.rd_kafka_AdminOptions_set_operation_timeout(self, timeout, error, error.size) if resp != :ok raise ::Kafka::ResponseError.new(resp, error.read_string) end nil ensure error.free end |
#set_request_timeout(timeout) ⇒ Object Also known as: request_timeout=
Default request timeout is socket.timeout.ms
config option.
Sets the overall request timeout which includes broker lookup, request transmissing, operation time, and response processing.
Valid for all admin requests.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kafka/ffi/admin/admin_options.rb', line 26 def set_request_timeout(timeout) error = ::FFI::MemoryPointer.new(:char, 512) resp = ::Kafka::FFI.rd_kafka_AdminOptions_set_request_timeout(self, timeout, error, error.size) if resp != :ok raise ::Kafka::ResponseError.new(resp, error.read_string) end nil ensure error.free end |
#set_validate_only(on) ⇒ Object Also known as: validate_only=
Tell the broker to only validate the request without actually performing the operation.
Only valid for :create_topics, :delete_topics, and :create_partitions operations.
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/kafka/ffi/admin/admin_options.rb', line 73 def set_validate_only(on) error = ::FFI::MemoryPointer.new(:char, 512) resp = ::Kafka::FFI.rd_kafka_AdminOptions_set_validate_only(self, on, error, error.size) if resp != :ok raise ::Kafka::ResponseError.new(resp, error.read_string) end nil ensure error.free end |