Class KafkaStreamsContainer


  • public class KafkaStreamsContainer
    extends Object
    • Method Detail

      • start

        public Future<org.apache.kafka.streams.KafkaStreams.State> start​(Executor executor)
         Asynchronously start the underlying KafkaStreams instance.
        Parameters:
        executor - the Executor instance to be used for starting the streams.
        Returns:
        the future KafkaStreams.State of the streams.
      • setState

        public void setState​(State state)
      • getDefaultKeySerde

        public Optional<org.apache.kafka.common.serialization.Serde> getDefaultKeySerde()
        Gets the default Serde configured for key.
        Returns:
        a optional Serde instance.
      • threadMetadata

        public Set<org.apache.kafka.streams.processor.ThreadMetadata> threadMetadata()
        Gets the local thread metadata.
        Returns:
        a set of ThreadMetadata instance.
      • startedSince

        public long startedSince()
        Gets the started epoch-time in milliseconds.
        Returns:
        a unix epoch-time in milliseconds.
      • streamsConfig

        public Conf streamsConfig()
        Gets the configuration for this KafkaStreams instance.
        Returns:
        a Conf instance.
      • applicationId

        public String applicationId()
        Gets configured StreamsConfig.APPLICATION_ID_CONFIG for this KafkaStreams instance.
        Returns:
        a string application.id.
      • applicationServer

        public String applicationServer()
        Gets configured StreamsConfig.APPLICATION_SERVER_CONFIG for this KafkaStreams instance.
        Returns:
        a string application.server.
      • exception

        public Optional<Throwable> exception()
        Gets the last observed exception thrown the KafkaStreams instance.
        Returns:
        a Throwable instance.
      • topologyDescription

        public org.apache.kafka.streams.TopologyDescription topologyDescription()
        Gets the TopologyDescription for this KafkaStreams instance.
        Returns:
        a new TopologyDescription instance.
      • metrics

        public Map<org.apache.kafka.common.MetricName,​? extends org.apache.kafka.common.Metric> metrics()
        Gets all the current Metrics for this KafkaStreams instance.
        Returns:
        a map of Metric.
      • getProducer

        public org.apache.kafka.clients.producer.Producer<byte[],​byte[]> getProducer​(Map<String,​Object> overrides)
        Creates a new Producer instance using the same configs that the Kafka Streams instance.
        Parameters:
        overrides - the producer configs to overrides.
      • close

        public void close​(Duration timeout)
        Closes this KafkaStreams instance.
      • close

        public void close​(boolean cleanUp,
                          Duration timeout)
        Closes this KafkaStreams instance and wait up to the timeout for the streams to be closed. A timeout of 0 means to return immediately (i.e Duration.ZERO
        Parameters:
        cleanUp - flag to clean up the local streams states.
        timeout - the duration to wait for the streams to shutdown.
      • restart

        public void restart()
      • getMetadataForStoreAndKey

        public <K> Optional<StreamsServerInfo> getMetadataForStoreAndKey​(String storeName,
                                                                         K key,
                                                                         org.apache.kafka.common.serialization.Serializer<K> keySerializer)
      • getLocalKeyValueStore

        public <K,​V> LocalStoreAccessor<org.apache.kafka.streams.state.ReadOnlyKeyValueStore<K,​V>> getLocalKeyValueStore​(String storeName)
      • getLocalTimestampedKeyValueStore

        public <K,​V> LocalStoreAccessor<org.apache.kafka.streams.state.ReadOnlyKeyValueStore<K,​org.apache.kafka.streams.state.ValueAndTimestamp<V>>> getLocalTimestampedKeyValueStore​(String storeName)
      • getLocalWindowStore

        public <K,​V> LocalStoreAccessor<org.apache.kafka.streams.state.ReadOnlyWindowStore<K,​V>> getLocalWindowStore​(String storeName)
      • getLocalTimestampedWindowStore

        public <K,​V> LocalStoreAccessor<org.apache.kafka.streams.state.ReadOnlyWindowStore<K,​org.apache.kafka.streams.state.ValueAndTimestamp<V>>> getLocalTimestampedWindowStore​(String storeName)
      • getLocalSessionStore

        public <K,​V> LocalStoreAccessor<org.apache.kafka.streams.state.ReadOnlySessionStore<K,​V>> getLocalSessionStore​(String storeName)
      • isNotRunning

        public boolean isNotRunning()
        Checks if the KafkaStreams is neither RUNNING nor REBALANCING.
      • getKafkaStreams

        public org.apache.kafka.streams.KafkaStreams getKafkaStreams()
        Returns the wrapper KafkaStreams instance.
        Returns:
        the KafkaStreams.