Class MessageTrace


  • @ThreadSafe
    public class MessageTrace
    extends java.lang.Object
    Thread-safe in-memory implementation of a circular MessageStore that is storing all traceEntries in insertion order with a configurable capacity.

    Each time an element is added to a full message store, the message store automatically removes its head element.

    • Constructor Summary

      Constructors 
      Constructor Description
      MessageTrace​(int capacity)
      Creates a new instance with specified capacity.
    • Method Summary

      Modifier and Type Method Description
      void add​(TraceEntry traceEntry)
      Adds a Message to the MessageStore.
      int getCapacity()  
      java.util.SortedSet<java.lang.String> getReceiverChannels()  
      java.util.SortedSet<java.lang.String> getSenderChannels()  
      java.util.stream.Stream<TraceEntry> stream()
      Returns a Stream of traceEntries contained in the RegisteredEndpoints.
      java.util.stream.Stream<TraceEntry> stream​(java.lang.String channelName, de.otto.synapse.endpoint.EndpointType endpointType)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MessageTrace

        public MessageTrace​(int capacity)
        Creates a new instance with specified capacity.
        Parameters:
        capacity - the size of the underlying ring buffer.
    • Method Detail

      • getSenderChannels

        public java.util.SortedSet<java.lang.String> getSenderChannels()
      • getReceiverChannels

        public java.util.SortedSet<java.lang.String> getReceiverChannels()
      • getCapacity

        public int getCapacity()
      • add

        public void add​(TraceEntry traceEntry)
        Adds a Message to the MessageStore.

        If the capacity of the ring buffer is reached, the oldest message is removed

        Parameters:
        traceEntry - the message to add
      • stream

        public java.util.stream.Stream<TraceEntry> stream()
        Returns a Stream of traceEntries contained in the RegisteredEndpoints.

        The stream will maintain the insertion order of the traceEntries.

        Returns:
        Stream of traceEntries
      • stream

        public java.util.stream.Stream<TraceEntry> stream​(java.lang.String channelName,
                                                          de.otto.synapse.endpoint.EndpointType endpointType)