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:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 117

def self.create(*args)
  if args[0].class == String && ::Vertx::Util::unknown_type.accept?(args[1]) && !block_given? && args[2] == nil && args[3] == nil && args[4] == 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(args[0],::Vertx::Util::Utils.to_object(args[1])),::VertxKafkaClient::KafkaProducerRecord, nil, nil)
  elsif args[0].class == String && ::Vertx::Util::unknown_type.accept?(args[1]) && ::Vertx::Util::unknown_type.accept?(args[2]) && !block_given? && args[3] == nil && args[4] == 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(args[0],::Vertx::Util::Utils.to_object(args[1]),::Vertx::Util::Utils.to_object(args[2])),::VertxKafkaClient::KafkaProducerRecord, nil, nil)
  elsif args[0].class == String && ::Vertx::Util::unknown_type.accept?(args[1]) && ::Vertx::Util::unknown_type.accept?(args[2]) && args[3].class == Fixnum && args[4].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(args[0],::Vertx::Util::Utils.to_object(args[1]),::Vertx::Util::Utils.to_object(args[2]),args[3],::Vertx::Util::Utils.to_integer(args[4])),::VertxKafkaClient::KafkaProducerRecord, nil, nil)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]},#{args[2]},#{args[3]},#{args[4]})"
  end
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)


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 61

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

- (self) addHeaders(headers)

Add a list of headers to this record.

Parameters:

Returns:

  • (self)


40
41
42
43
44
45
46
47
48
49
50
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 40

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

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

Returns the headers of this record

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 23

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling headers()"
  end
end

- (Object) key

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

Returns:

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


145
146
147
148
149
150
151
152
153
154
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 145

def key
  if !block_given?
    return @j_arg_K.wrap(@j_del.java_method(:key, []).call())
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling key()"
  end
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)


80
81
82
83
84
85
86
87
88
89
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 80

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

- (Fixnum) timestamp

Returns the timestamp of this record

Returns:

  • (Fixnum)
    the timestamp of this record


157
158
159
160
161
162
163
164
165
166
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 157

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

- (String) topic

Returns the topic this record is being sent to

Returns:

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


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

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

- (Object) value

Returns the value

Returns:

  • (Object)
    the value


133
134
135
136
137
138
139
140
141
142
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-kafka-client/kafka_producer_record.rb', line 133

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