Class BatchConsumer

java.lang.Object
pl.allegro.tech.hermes.consumers.consumer.BatchConsumer
All Implemented Interfaces:
Consumer

public class BatchConsumer extends Object implements Consumer
  • Constructor Details

    • BatchConsumer

      public BatchConsumer(ReceiverFactory messageReceiverFactory, MessageBatchSender sender, MessageBatchFactory batchFactory, MessageConverterResolver messageConverterResolver, pl.allegro.tech.hermes.common.message.wrapper.CompositeMessageContentWrapper compositeMessageContentWrapper, pl.allegro.tech.hermes.common.metric.MetricsFacade metricsFacade, pl.allegro.tech.hermes.tracker.consumers.Trackers trackers, pl.allegro.tech.hermes.api.Subscription subscription, pl.allegro.tech.hermes.api.Topic topic, boolean useTopicMessageSize, SubscriptionLoadRecorder loadRecorder, Duration commitPeriod)
  • Method Details

    • consume

      public void consume(Runnable signalsInterrupt)
      Description copied from interface: Consumer
      Consume **must** make sure that interrupted status is restored as it is needed for stopping unhealthy consumers. Swallowing the interrupt by consume or any of its dependencies will result in consumer being marked as unhealthy and will prevent commits despite messages being sent to subscribers.
      Specified by:
      consume in interface Consumer
    • initialize

      public void initialize()
      Specified by:
      initialize in interface Consumer
    • tearDown

      public void tearDown()
      Specified by:
      tearDown in interface Consumer
    • updateSubscription

      public void updateSubscription(pl.allegro.tech.hermes.api.Subscription subscription)
      Specified by:
      updateSubscription in interface Consumer
    • updateTopic

      public void updateTopic(pl.allegro.tech.hermes.api.Topic newTopic)
      Specified by:
      updateTopic in interface Consumer
    • commit

      public void commit(Set<SubscriptionPartitionOffset> offsetsToCommit)
      Specified by:
      commit in interface Consumer
    • moveOffset

      public pl.allegro.tech.hermes.common.kafka.offset.PartitionOffsets moveOffset(pl.allegro.tech.hermes.common.kafka.offset.PartitionOffsets partitionOffsets)
      Specified by:
      moveOffset in interface Consumer
    • getSubscription

      public pl.allegro.tech.hermes.api.Subscription getSubscription()
      Specified by:
      getSubscription in interface Consumer
    • getAssignedPartitions

      public Set<Integer> getAssignedPartitions()
      Specified by:
      getAssignedPartitions in interface Consumer