final class KafkaProducer[K, V] extends KafkaProducerLike[K, V]
Wraps the Java KafkaProducer
providing send operations that indicate the result of the operation with either
a Scala Future or a Function callback.
- K
type of the key that the producer accepts
- V
type of the value that the producer accepts
- Alphabetic
- By Inheritance
- KafkaProducer
- KafkaProducerLike
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
KafkaProducer(producer: Producer[K, V])
- producer
the underlying Java
KafkaProducer
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to any2stringadd[KafkaProducer[K, V]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (KafkaProducer[K, V], B)
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to ArrowAssoc[KafkaProducer[K, V]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
abortTransaction(): Unit
Aborts the transaction.
Aborts the transaction.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducerabortTransaction method
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
beginTransaction(): Unit
Begin the transaction.
Begin the transaction.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducerbeginTransactions method
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
close(timeout: FiniteDuration): Unit
Close this producer.
Close this producer.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducerclose method
-
def
close(): Unit
Close this producer.
Close this producer.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducerclose method
-
def
commitTransaction(): Unit
Commits the transaction.
Commits the transaction.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducercommitTransaction method
-
def
ensuring(cond: (KafkaProducer[K, V]) ⇒ Boolean, msg: ⇒ Any): KafkaProducer[K, V]
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to Ensuring[KafkaProducer[K, V]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (KafkaProducer[K, V]) ⇒ Boolean): KafkaProducer[K, V]
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to Ensuring[KafkaProducer[K, V]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): KafkaProducer[K, V]
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to Ensuring[KafkaProducer[K, V]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): KafkaProducer[K, V]
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to Ensuring[KafkaProducer[K, V]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
flush(): Unit
Make all buffered records immediately available to send and wait until records have been sent.
Make all buffered records immediately available to send and wait until records have been sent.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducerflush method
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to StringFormat[KafkaProducer[K, V]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
initTransactions(): Unit
Initialise a transaction.
Initialise a transaction.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducerinitTransactions method
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
partitionsFor(topic: String): List[PartitionInfo]
Get the partition metadata for the give topic.
Get the partition metadata for the give topic.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducerpartitionsFor method
- val producer: Producer[K, V]
-
def
send(record: ProducerRecord[K, V]): Future[RecordMetadata]
Asynchronously send a record to a topic.
Asynchronously send a record to a topic.
- record
ProducerRecordto sent- returns
the result of the sent records as a
Future
- Definition Classes
- KafkaProducer → KafkaProducerLike
-
def
sendOffsetsToTransaction(offsets: Map[TopicPartition, OffsetAndMetadata], consumerGroupId: String): Unit
Sends a list of consumed offsets to the consumer group coordinator, and also marks those offsets as part of the current transaction.
Sends a list of consumed offsets to the consumer group coordinator, and also marks those offsets as part of the current transaction.
- Definition Classes
- KafkaProducer → KafkaProducerLike
- See also
Java
KafkaProducersendOffsetsToTransaction method
-
def
sendWithCallback(record: ProducerRecord[K, V])(callback: (Try[RecordMetadata]) ⇒ Unit): Unit
Asynchronously send a record to a topic and invoke the provided callback when the send has been acknowledged.
Asynchronously send a record to a topic and invoke the provided callback when the send has been acknowledged.
- record
ProducerRecordto sent- callback
callback that is called when the send has been acknowledged
- Definition Classes
- KafkaProducer → KafkaProducerLike
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
→[B](y: B): (KafkaProducer[K, V], B)
- Implicit
- This member is added by an implicit conversion from KafkaProducer[K, V] to ArrowAssoc[KafkaProducer[K, V]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc