|
Spring Integration Kafka Support | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.integration.kafka.core.DefaultConnection
public class DefaultConnection
A connection to a Kafka broker.
Constructor Summary | |
---|---|
DefaultConnection(BrokerAddress brokerAddress,
java.lang.String clientId,
int bufferSize,
int soTimeout,
int minBytes,
int maxWait)
|
Method Summary | |
---|---|
void |
close()
Closes the connection to the broker. |
Result<java.lang.Void> |
commitOffsetsForConsumer(java.lang.String consumerId,
java.util.Map<Partition,java.lang.Long> offsets)
Update offsets in the native Kafka offset management system. |
Result<KafkaMessageBatch> |
fetch(FetchRequest... requests)
Fetche data from Kafka. |
Result<java.lang.Long> |
fetchInitialOffset(long referenceTime,
Partition... partitions)
Fetch an actual offset in the partition, immediately before the given reference time, or the smallest and largest value, respectively, if the special values -1 ( OffsetRequest.LatestTime() ) and -2 (OffsetRequest.LatestTime() )
are used . |
Result<java.lang.Long> |
fetchStoredOffsetsForConsumer(java.lang.String consumerId,
Partition... partitions)
Fetch offsets from the native Kafka offset management system. |
Result<BrokerAddress> |
findLeaders(java.lang.String... topics)
Retrieve the leader broker addresses for all the partitions in the given topics. |
BrokerAddress |
getBrokerAddress()
The broker address for this consumer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultConnection(BrokerAddress brokerAddress, java.lang.String clientId, int bufferSize, int soTimeout, int minBytes, int maxWait)
Method Detail |
---|
public BrokerAddress getBrokerAddress()
Connection
getBrokerAddress
in interface Connection
Connection.getBrokerAddress()
public void close()
Connection
close
in interface Connection
public Result<KafkaMessageBatch> fetch(FetchRequest... requests) throws ConsumerException
fetch
in interface Connection
requests
- a list of fetch operations
ConsumerException
- the ConsumerException if any underlying errorpublic Result<java.lang.Long> fetchStoredOffsetsForConsumer(java.lang.String consumerId, Partition... partitions) throws ConsumerException
Connection
fetchStoredOffsetsForConsumer
in interface Connection
consumerId
- the id of the consumerpartitions
- the list of partitions whose offsets are queried for
Result
in case of success
ConsumerException
- the ConsumerException if any underlying errorpublic Result<java.lang.Long> fetchInitialOffset(long referenceTime, Partition... partitions) throws ConsumerException
Connection
OffsetRequest.LatestTime()
) and -2 (OffsetRequest.LatestTime()
)
are used . To be used to position the initial offset of a read operation.
fetchInitialOffset
in interface Connection
referenceTime
- The returned values will be before this time, if they exist. The special
values -2 (OffsetRequest.LatestTime()
) and -1 (OffsetRequest.LatestTime()
) are supported.partitions
- the offsets, indexed by Partition
Result
in case of success
ConsumerException
- the ConsumerException if any underlying errorConnection.fetchInitialOffset(long, Partition...)
public Result<java.lang.Void> commitOffsetsForConsumer(java.lang.String consumerId, java.util.Map<Partition,java.lang.Long> offsets) throws ConsumerException
Connection
commitOffsetsForConsumer
in interface Connection
consumerId
- the id of the consumeroffsets
- the offsets, indexed by Partition
Result
in case of success
ConsumerException
- the ConsumerException if any underlying errorpublic Result<BrokerAddress> findLeaders(java.lang.String... topics) throws ConsumerException
Connection
findLeaders
in interface Connection
topics
- the topics whose partitions we query for
Partition
ConsumerException
- the ConsumerException if any underlying errorConnection.findLeaders(String...)
|
Spring Integration Kafka Support | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |