Class ThrottlingMessageReceiver

java.lang.Object
pl.allegro.tech.hermes.consumers.consumer.receiver.ThrottlingMessageReceiver
All Implemented Interfaces:
MessageReceiver

public class ThrottlingMessageReceiver extends Object implements MessageReceiver
  • Constructor Details

    • ThrottlingMessageReceiver

      public ThrottlingMessageReceiver(MessageReceiver receiver, IdleTimeCalculator idleTimeCalculator, pl.allegro.tech.hermes.api.SubscriptionName subscriptionName, pl.allegro.tech.hermes.common.metric.MetricsFacade metrics)
  • Method Details

    • next

      public Optional<Message> next()
      Description copied from interface: MessageReceiver
      Retrieves the next available message from the queue.

      Depending on the context, the returned Optional can contain:

      • A Message that contains a valid message ready to be sent.
      • A Message with the `isFiltered` flag set, indicating that the message has been filtered and should be skipped during processing or sending.
      • null, indicating that there are no messages currently available in the queue.
      Specified by:
      next in interface MessageReceiver
      Returns:
      an Optional containing the next Message if available; an Optional containing a filtered message if it should be skipped; or an empty Optional if there are no messages in the queue.
    • commit

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

      public pl.allegro.tech.hermes.common.kafka.offset.PartitionOffsets moveOffset(pl.allegro.tech.hermes.common.kafka.offset.PartitionOffsets offsets)
      Specified by:
      moveOffset in interface MessageReceiver
    • getAssignedPartitions

      public Set<Integer> getAssignedPartitions()
      Specified by:
      getAssignedPartitions in interface MessageReceiver
    • stop

      public void stop()
      Specified by:
      stop in interface MessageReceiver
    • update

      public void update(pl.allegro.tech.hermes.api.Subscription newSubscription)
      Specified by:
      update in interface MessageReceiver