Class: VertxKafkaClient::KafkaProducerRecord

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_producer_record.rb

Overview

Vert.x Kafka producer record.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (::VertxKafkaClient::KafkaProducerRecord) create(topic, value) + (::VertxKafkaClient::KafkaProducerRecord) create(topic, key, value) + (::VertxKafkaClient::KafkaProducerRecord) create(topic, key, value, timestamp, partition)

Create a concrete instance of a Vert.x producer record

Overloads:

  • + (::VertxKafkaClient::KafkaProducerRecord) create(topic, value)

    Parameters:

    • topic (String)
      the topic this record is being sent to
    • value (Object)
      the value
  • + (::VertxKafkaClient::KafkaProducerRecord) create(topic, key, value)

    Parameters:

    • topic (String)
      the topic this record is being sent to
    • key (Object)
      the key (or null if no key is specified)
    • value (Object)
      the value
  • + (::VertxKafkaClient::KafkaProducerRecord) create(topic, key, value, timestamp, partition)

    Parameters:

    • topic (String)
      the topic this record is being sent to
    • key (Object)
      the key (or null if no key is specified)
    • value (Object)
      the value
    • timestamp (Fixnum)
      the timestamp of this record
    • partition (Fixnum)
      the partition to which the record will be sent (or null if no partition was specified)

Returns:

Raises:

  • (ArgumentError)

35
36
37
38
39
40
41
42
43
44
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 35

def self.create(param_1=nil,param_2=nil,param_3=nil,param_4=nil,param_5=nil)
  if param_1.class == String && ::Vertx::Util::unknown_type.accept?(param_2) && !block_given? && param_3 == nil && param_4 == nil && param_5 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxKafkaClientProducer::KafkaProducerRecord.java_method(:create, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class]).call(param_1,::Vertx::Util::Utils.to_object(param_2)),::VertxKafkaClient::KafkaProducerRecord, nil, nil)
  elsif param_1.class == String && ::Vertx::Util::unknown_type.accept?(param_2) && ::Vertx::Util::unknown_type.accept?(param_3) && !block_given? && param_4 == nil && param_5 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxKafkaClientProducer::KafkaProducerRecord.java_method(:create, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class,Java::java.lang.Object.java_class]).call(param_1,::Vertx::Util::Utils.to_object(param_2),::Vertx::Util::Utils.to_object(param_3)),::VertxKafkaClient::KafkaProducerRecord, nil, nil)
  elsif param_1.class == String && ::Vertx::Util::unknown_type.accept?(param_2) && ::Vertx::Util::unknown_type.accept?(param_3) && param_4.class == Fixnum && param_5.class == Fixnum && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxKafkaClientProducer::KafkaProducerRecord.java_method(:create, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::JavaLang::Long.java_class,Java::JavaLang::Integer.java_class]).call(param_1,::Vertx::Util::Utils.to_object(param_2),::Vertx::Util::Utils.to_object(param_3),param_4,::Vertx::Util::Utils.to_integer(param_5)),::VertxKafkaClient::KafkaProducerRecord, nil, nil)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{param_1},#{param_2},#{param_3},#{param_4},#{param_5})"
end

Instance Method Details

- (self) addHeader(header) - (self) addHeader(key, value) - (self) addHeader(key, value)

Like #add_header but with a key/value pair

Overloads:

  • - (self) addHeader(header)

    Parameters:

  • - (self) addHeader(key, value)

    Parameters:

    • key (String)
    • value (String)
  • - (self) addHeader(key, value)

    Parameters:

Returns:

  • (self)

Raises:

  • (ArgumentError)

90
91
92
93
94
95
96
97
98
99
100
101
102
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 90

def add_header(param_1=nil,param_2=nil)
  if param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil
    @j_del.java_method(:addHeader, [Java::IoVertxKafkaClientProducer::KafkaHeader.java_class]).call(param_1.j_del)
    return self
  elsif param_1.class == String && param_2.class == String && !block_given?
    @j_del.java_method(:addHeader, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(param_1,param_2)
    return self
  elsif param_1.class == String && param_2.class.method_defined?(:j_del) && !block_given?
    @j_del.java_method(:addHeader, [Java::java.lang.String.java_class,Java::IoVertxCoreBuffer::Buffer.java_class]).call(param_1,param_2.j_del)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling add_header(#{param_1},#{param_2})"
end

- (self) add_headers(headers = nil)

Add a list of headers to this record.

Parameters:

Returns:

  • (self)

Raises:

  • (ArgumentError)

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

def add_headers(headers=nil)
  if headers.class == Array && !block_given?
    @j_del.java_method(:addHeaders, [Java::JavaUtil::List.java_class]).call(headers.map { |element| element.j_del })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling add_headers(#{headers})"
end

- (Array<::VertxKafkaClient::KafkaHeader>) headers

Returns the headers of this record

Returns:

Raises:

  • (ArgumentError)

114
115
116
117
118
119
120
121
122
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 114

def headers
  if !block_given?
    if @cached_headers != nil
      return @cached_headers
    end
    return @cached_headers = @j_del.java_method(:headers, []).call().to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxKafkaClient::KafkaHeader) }
  end
  raise ArgumentError, "Invalid arguments when calling headers()"
end

- (Object) key

Returns the key (or null if no key is specified)

Returns:

  • (Object)
    the key (or null if no key is specified)

Raises:

  • (ArgumentError)

53
54
55
56
57
58
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 53

def key
  if !block_given?
    return @j_arg_K.wrap(@j_del.java_method(:key, []).call())
  end
  raise ArgumentError, "Invalid arguments when calling key()"
end

- (Fixnum) partition

Returns the partition to which the record will be sent (or null if no partition was specified)

Returns:

  • (Fixnum)
    the partition to which the record will be sent (or null if no partition was specified)

Raises:

  • (ArgumentError)

74
75
76
77
78
79
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 74

def partition
  if !block_given?
    return @j_del.java_method(:partition, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling partition()"
end

- (Fixnum) timestamp

Returns the timestamp of this record

Returns:

  • (Fixnum)
    the timestamp of this record

Raises:

  • (ArgumentError)

67
68
69
70
71
72
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 67

def timestamp
  if !block_given?
    return @j_del.java_method(:timestamp, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling timestamp()"
end

- (String) topic

Returns the topic this record is being sent to

Returns:

  • (String)
    the topic this record is being sent to

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_producer_record.rb', line 46

def topic
  if !block_given?
    return @j_del.java_method(:topic, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling topic()"
end

- (Object) value

Returns the value

Returns:

  • (Object)
    the value

Raises:

  • (ArgumentError)

60
61
62
63
64
65
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 60

def value
  if !block_given?
    return @j_arg_V.wrap(@j_del.java_method(:value, []).call())
  end
  raise ArgumentError, "Invalid arguments when calling value()"
end