Package org.apache.sling.distribution.journal.kafka

## Class KafkaClientProvider

- java.lang.Object
- - org.apache.sling.distribution.journal.kafka.KafkaClientProvider

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `org.apache.sling.distribution.journal.MessagingProvider`

    public class KafkaClientProvider
    extends Object
    implements org.apache.sling.distribution.journal.MessagingProvider, Closeable

### Field Summary

Fields
`static int` `PARTITION`

### Constructor Summary

Constructors
`KafkaClientProvider​(org.osgi.service.event.EventAdmin eventAdmin, KafkaEndpoint kafkaEndpoint)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `assertTopic​(String topic)`
`String` `assignTo​(long offset)`
`String` `assignTo​(org.apache.sling.distribution.journal.Reset reset, long relativeOffset)`
`void` `close()`
`protected <T> org.apache.kafka.clients.consumer.KafkaConsumer<String,​T>` `createConsumer​(Class<? extends org.apache.kafka.common.serialization.Deserializer<?>> deserializer, org.apache.sling.distribution.journal.Reset reset)`
`Closeable` `createPoller​(String topicName, org.apache.sling.distribution.journal.Reset reset, String assign, org.apache.sling.distribution.journal.HandlerAdapter<?>... adapters)`
`<T> org.apache.sling.distribution.journal.MessageSender<T>` `createSender​(String topic)`
`URI` `getServerUri()`
`long` `retrieveOffset​(String topicName, org.apache.sling.distribution.journal.Reset reset)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.sling.distribution.journal.MessagingProvider

`createPoller`

### Field Detail

#### PARTITION

    public static final int PARTITION

See Also:
  Constant Field Values

### Constructor Detail

#### KafkaClientProvider

    public KafkaClientProvider​(org.osgi.service.event.EventAdmin eventAdmin,
                               KafkaEndpoint kafkaEndpoint)

### Method Detail

#### close

    public void close()

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`

#### createSender

    public <T> org.apache.sling.distribution.journal.MessageSender<T> createSender​(String topic)

Specified by:
  `createSender` in interface `org.apache.sling.distribution.journal.MessagingProvider`

#### createPoller

    public Closeable createPoller​(String topicName,
                                  org.apache.sling.distribution.journal.Reset reset,
                                  @Nullable
                                  String assign,
                                  org.apache.sling.distribution.journal.HandlerAdapter<?>... adapters)

Specified by:
  `createPoller` in interface `org.apache.sling.distribution.journal.MessagingProvider`

#### assertTopic

    public void assertTopic​(String topic)
                     throws org.apache.sling.distribution.journal.MessagingException

Specified by:
  `assertTopic` in interface `org.apache.sling.distribution.journal.MessagingProvider`
Throws:
  `org.apache.sling.distribution.journal.MessagingException`

#### retrieveOffset

    public long retrieveOffset​(String topicName,
                               org.apache.sling.distribution.journal.Reset reset)

Specified by:
  `retrieveOffset` in interface `org.apache.sling.distribution.journal.MessagingProvider`

#### assignTo

    public String assignTo​(long offset)

Specified by:
  `assignTo` in interface `org.apache.sling.distribution.journal.MessagingProvider`

#### assignTo

    public String assignTo​(org.apache.sling.distribution.journal.Reset reset,
                           long relativeOffset)

Specified by:
  `assignTo` in interface `org.apache.sling.distribution.journal.MessagingProvider`

#### createConsumer

    protected <T> org.apache.kafka.clients.consumer.KafkaConsumer<String,​T> createConsumer​(Class<? extends org.apache.kafka.common.serialization.Deserializer<?>> deserializer,
                                                                                                 org.apache.sling.distribution.journal.Reset reset)

#### getServerUri

    public URI getServerUri()

Specified by:
  `getServerUri` in interface `org.apache.sling.distribution.journal.MessagingProvider`