- All Implemented Interfaces:
public enum TopicOverloadPolicy extends Enum<TopicOverloadPolicy>
This policy can only be used in combination with the
The reliable topic uses a
store the messages. A ringbuffer doesn't track where readers are, so
it has no concept of a slow consumers. This provides many advantages like
high performance reads, but it also gives the ability to the reader to
re-read the same message multiple times in case of an error.
A ringbuffer has a limited, fixed capacity. A fast producer may overwrite
old messages that are still being read by a slow consumer. To prevent
this, we may configure a time-to-live on the ringbuffer (see
Once the time-to-live is configured, the
controls how the publisher is going to deal with the situation that a
ringbuffer is full and the oldest item in the ringbuffer is not old
enough to get overwritten.
Keep in mind that this retention period (time-to-live) can keep messages from being overwritten, even though all readers might have already completed reading.
Nested Class Summary
Enum Constant Summary
Enum Constants Enum Constant DescriptionThe caller will wait till there space in the ringbuffer.The message that was to be published is discarded.Using this policy, a message that has not expired can be overwritten.The publish call immediately fails.
Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Enum Constant Details
DISCARD_OLDESTpublic static final TopicOverloadPolicy DISCARD_OLDESTUsing this policy, a message that has not expired can be overwritten. No matter the retention period set, the overwrite will just overwrite the item.
This can be a problem for slow consumers because they were promised a certain time window to process messages. But it will benefit producers and fast consumers since they are able to continue. This policy sacrifices the slow producer in favor of fast producers/consumers.
DISCARD_NEWESTpublic static final TopicOverloadPolicy DISCARD_NEWESTThe message that was to be published is discarded.
BLOCKpublic static final TopicOverloadPolicy BLOCKThe caller will wait till there space in the ringbuffer.
ERRORpublic static final TopicOverloadPolicy ERRORThe publish call immediately fails.
valuespublic static TopicOverloadPolicy values()Returns an array containing the constants of this enum type, in the order they are declared.
- an array containing the constants of this enum type, in the order they are declared
valueOfReturns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)