Class SimpleMessageStore

All Implemented Interfaces:
Iterable<MessageGroup>, BasicMessageGroupStore, ChannelMessageStore, MessageGroupStore, MessageStore

public class SimpleMessageStore extends AbstractMessageGroupStore implements MessageStore, ChannelMessageStore
Map-based in-memory implementation of MessageStore and MessageGroupStore. Enforces a maximum capacity for the store.
Since:
2.0
Author:
Iwein Fuld, Mark Fisher, Dave Syer, Oleg Zhurakousky, Gary Russell, Ryan Barker, Artem Bilan, Youbin Wu
  • Constructor Details

    • SimpleMessageStore

      public SimpleMessageStore(int individualCapacity, int groupCapacity)
      Creates a SimpleMessageStore with a maximum size limited by the given capacity, or unlimited size if the given capacity is less than 1. The capacities are applied independently to messages stored via addMessage(Message) and to those stored via AbstractMessageGroupStore.addMessageToGroup(Object, Message). In both cases the capacity applies to the number of messages that can be stored, and once that limit is reached attempting to store another will result in an exception.
      Parameters:
      individualCapacity - The message capacity.
      groupCapacity - The capacity of each group.
    • SimpleMessageStore

      public SimpleMessageStore(int individualCapacity, int groupCapacity, long upperBoundTimeout)
      Create a SimpleMessageStore with a maximum size limited by the given capacity and the timeout in millisecond to wait for the empty slot in the store.
      Parameters:
      individualCapacity - The message capacity.
      groupCapacity - The capacity of each group.
      upperBoundTimeout - The time to wait if the store is at max capacity.
      Since:
      4.3
      See Also:
    • SimpleMessageStore

      public SimpleMessageStore(int individualCapacity, int groupCapacity, LockRegistry lockRegistry)
      Creates a SimpleMessageStore with a maximum size limited by the given capacity and LockRegistry for the message group operations concurrency.
      Parameters:
      individualCapacity - The message capacity.
      groupCapacity - The capacity of each group.
      lockRegistry - The lock registry.
      See Also:
    • SimpleMessageStore

      public SimpleMessageStore(int individualCapacity, int groupCapacity, long upperBoundTimeout, LockRegistry lockRegistry)
      Creates a SimpleMessageStore with a maximum size limited by the given capacity, the timeout in millisecond to wait for the empty slot in the store and LockRegistry for the message group operations concurrency.
      Parameters:
      individualCapacity - The message capacity.
      groupCapacity - The capacity of each group.
      upperBoundTimeout - The time to wait if the store is at max capacity
      lockRegistry - The lock registry.
      Since:
      4.3
    • SimpleMessageStore

      public SimpleMessageStore(int capacity)
      Creates a SimpleMessageStore with the same capacity for individual and grouped messages.
      Parameters:
      capacity - The capacity.
    • SimpleMessageStore

      public SimpleMessageStore()
      Create a SimpleMessageStore with unlimited capacity.
  • Method Details