Class: Rdkafka::Callbacks::GroupResult

Inherits:
Object
  • Object
show all
Defined in:
lib/rdkafka/callbacks.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(group_result_pointer) ⇒ GroupResult

Returns a new instance of GroupResult.



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rdkafka/callbacks.rb', line 27

def initialize(group_result_pointer)
  native_error = Rdkafka::Bindings.rd_kafka_group_result_error(group_result_pointer)

  if native_error.null?
    @result_error = 0
    @error_string = FFI::Pointer::NULL
  else
    @result_error = native_error[:code]
    @error_string = native_error[:errstr]
  end

  @result_name = Rdkafka::Bindings.rd_kafka_group_result_name(group_result_pointer)
end

Instance Attribute Details

#error_stringObject (readonly)

Returns the value of attribute error_string.



26
27
28
# File 'lib/rdkafka/callbacks.rb', line 26

def error_string
  @error_string
end

#result_errorObject (readonly)

Returns the value of attribute result_error.



26
27
28
# File 'lib/rdkafka/callbacks.rb', line 26

def result_error
  @result_error
end

#result_nameObject (readonly)

Returns the value of attribute result_name.



26
27
28
# File 'lib/rdkafka/callbacks.rb', line 26

def result_name
  @result_name
end

Class Method Details

.create_group_results_from_array(count, array_pointer) ⇒ Object



40
41
42
43
44
45
# File 'lib/rdkafka/callbacks.rb', line 40

def self.create_group_results_from_array(count, array_pointer)
  (1..count).map do |index|
    result_pointer = (array_pointer + (index - 1)).read_pointer
    new(result_pointer)
  end
end