Method: Kafka::FFI::Message#opaque

Defined in:
lib/kafka/ffi/message.rb

#opaquenil, FFI::Pointer

Note:

Using the opaque is dangerous and requires that the application maintain a reference to the object passed to produce. Failing to do so will cause segfaults due to the object having been garbage collected.

Returns the per message opaque pointer that was given to produce. This is a pointer to a Ruby object owned by the application.

Examples:

Retrieve object from opaque

require "fiddle"
obj = Fiddle::Pointer.new(msg.opaque.to_i).to_value

Returns:

  • (nil)

    Opaque was not set

  • (FFI::Pointer)

    Pointer to opaque address



88
89
90
# File 'lib/kafka/ffi/message.rb', line 88

def opaque
  self[:private]
end