java.lang.Object
org.axonframework.axonserver.connector.event.axon.EventBuffer
All Implemented Interfaces:
AutoCloseable, org.axonframework.common.stream.BlockingStream<org.axonframework.eventhandling.TrackedEventMessage<?>>, org.axonframework.eventhandling.TrackingEventStream

public class EventBuffer extends Object implements org.axonframework.eventhandling.TrackingEventStream
Client-side buffer of messages received from the server. Once consumed from this buffer, the client is notified of a permit being consumed, potentially triggering a permit refresh, if flow control is enabled.

This class is intended for internal use. Be cautious.

Since:
4.0
Author:
Marc Gathier, Allard Buijze
  • Constructor Summary

    Constructors
    Constructor
    Description
    EventBuffer(io.axoniq.axonserver.connector.event.EventStream delegate, org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain, org.axonframework.serialization.Serializer serializer, boolean disableIgnoredEventFiltering)
    Initializes an Event Buffer, passing messages through given upcasterChain and deserializing events using given serializer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
    hasNextAvailable(int timeout, TimeUnit timeUnit)
     
    org.axonframework.eventhandling.TrackedEventMessage<?>
     
    Optional<org.axonframework.eventhandling.TrackedEventMessage<?>>
     
    boolean
     
    void
    skipMessagesWithPayloadTypeOf(org.axonframework.eventhandling.TrackedEventMessage<?> ignoredMessage)

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.axonframework.common.stream.BlockingStream

    asStream, hasNextAvailable
  • Constructor Details

    • EventBuffer

      public EventBuffer(io.axoniq.axonserver.connector.event.EventStream delegate, org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain, org.axonframework.serialization.Serializer serializer, boolean disableIgnoredEventFiltering)
      Initializes an Event Buffer, passing messages through given upcasterChain and deserializing events using given serializer.
      Parameters:
      delegate - the EventStream to delegate operations to
      upcasterChain - the upcasterChain to translate serialized representations before deserializing
      serializer - the serializer capable of deserializing incoming messages
      disableIgnoredEventFiltering - specifying whether events should or should not be included in the buffer
  • Method Details

    • skipMessagesWithPayloadTypeOf

      public void skipMessagesWithPayloadTypeOf(org.axonframework.eventhandling.TrackedEventMessage<?> ignoredMessage)

      This implementation removes events from the stream based on the payload type of the given message.

      Specified by:
      skipMessagesWithPayloadTypeOf in interface org.axonframework.common.stream.BlockingStream<org.axonframework.eventhandling.TrackedEventMessage<?>>
    • peek

      public Optional<org.axonframework.eventhandling.TrackedEventMessage<?>> peek()
      Specified by:
      peek in interface org.axonframework.common.stream.BlockingStream<org.axonframework.eventhandling.TrackedEventMessage<?>>
    • hasNextAvailable

      public boolean hasNextAvailable(int timeout, TimeUnit timeUnit) throws InterruptedException
      Specified by:
      hasNextAvailable in interface org.axonframework.common.stream.BlockingStream<org.axonframework.eventhandling.TrackedEventMessage<?>>
      Throws:
      InterruptedException
    • nextAvailable

      public org.axonframework.eventhandling.TrackedEventMessage<?> nextAvailable() throws InterruptedException
      Specified by:
      nextAvailable in interface org.axonframework.common.stream.BlockingStream<org.axonframework.eventhandling.TrackedEventMessage<?>>
      Throws:
      InterruptedException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.axonframework.common.stream.BlockingStream<org.axonframework.eventhandling.TrackedEventMessage<?>>
    • setOnAvailableCallback

      public boolean setOnAvailableCallback(Runnable callback)
      Specified by:
      setOnAvailableCallback in interface org.axonframework.common.stream.BlockingStream<org.axonframework.eventhandling.TrackedEventMessage<?>>