Package de.otto.synapse.edison.trace
Class MessageTrace
java.lang.Object
de.otto.synapse.edison.trace.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
per channel with a configurable capacity per channel.
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 capacityPerChannel)Creates a new instance with specified capacity per channel. -
Method Summary
Modifier and Type Method Description voidadd(TraceEntry traceEntry)Adds a Message to the MessageStore.intgetCapacityPerChannel()java.util.SortedSet<java.lang.String>getReceiverChannels()java.util.SortedSet<java.lang.String>getSenderChannels()java.util.stream.Stream<TraceEntry>stream()Returns a Stream oftraceEntriescontained in the RegisteredEndpoints.java.util.stream.Stream<TraceEntry>stream(java.lang.String channelName, de.otto.synapse.endpoint.EndpointType endpointType)
-
Constructor Details
-
MessageTrace
public MessageTrace(int capacityPerChannel)Creates a new instance with specified capacity per channel.- Parameters:
capacityPerChannel- the size of the underlying ring buffers.
-
-
Method Details
-
getSenderChannels
public java.util.SortedSet<java.lang.String> getSenderChannels() -
getReceiverChannels
public java.util.SortedSet<java.lang.String> getReceiverChannels() -
getCapacityPerChannel
public int getCapacityPerChannel() -
add
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
Returns a Stream oftraceEntriescontained in the RegisteredEndpoints.The stream will maintain the per-channel insertion order of the traceEntries, but not overall insertion order.
- Returns:
- Stream of traceEntries
-
stream
public java.util.stream.Stream<TraceEntry> stream(java.lang.String channelName, de.otto.synapse.endpoint.EndpointType endpointType)
-