Consumer<K, V> (Interface)

Package: io.axual.client.consumer

The axualClient.buildConsumer() call returns an implementation of Consumer interface.

AxualClient client = ... (1)

ConsumerConfig consumerConfig = ConsumerConfig.builder()
	.build(); (2)

Processor<K, V> processor = ... (3)

Consumer<K, V> consumer = client.buildConsumer(consumerConfig); (4)

consumer.startConsuming(...); (5)
1 Build AxualClient object.
2 Build ConsumerConfig object.
3 Build Processor object.
4 Build Consumer object.
5 Start consuming


Future<ConsumeFailedException> startConsuming()

Start consuming process. Returns a Future object wrapping a ConsumeFailedException

ConsumeFailedException stopConsuming()

Stop consuming and disconnect.

boolean isConsuming()

Indicates whether the consumer is still consuming, might return ConsumeFailedException if no longer consuming because of an error.

void close()

Closes the consumer.

ConsumerMessage<K, V> (Interface)

A wrapper for the consumed message passed to the Processor. Includes metadata information like partition, offset and timestamp.

Processor<K, V> (Interface)

Implement this interface to process each consumed message.

class MyProcessor implements Processor<K, V> {
    public void processMessage(ConsumerMessage<K, V> message) {"Processing message: Key: {}, Value: {}", message.getKey(), message.getValue());

If using Java 8, above code can be simplified using Streams API as below:

Processor<K, V> processor = message ->"Processing message: Key: {}, Value: {}", message.getKey(), message.getValue());


An Enum used used to manage consumer behavior.


This strategy will try to deliver messages once (or less) and continue processing in all failure cases. In case something fails the message will be lost. For Consumers this means skipping to the end of a new PartitionOffset upon subscribing.


This strategy will retry to deliver messages upon technical failures, potentially leading to message duplication in certain situations. Duplication is considered to be a lesser evil by applications that adopt this strategy. Be sure to be idempotent in your application when adopting this strategy. For Consumers this strategy jumps to the beginning of the stream if the consumer’s group id did not commit any offset beforehand.