Package net.blakez.bppmq.core.queue
Class PushPullQueueCore
java.lang.Object
net.blakez.bppmq.core.queue.PushPullQueueCore
Core domain object for push-pull queue operations.
Manages message persistence and retrieval through the MessageRecordRepository.
- Author:
- Peter Blakeley : @pblakez pb@blakez.org
-
Constructor Summary
ConstructorsConstructorDescriptionPushPullQueueCore
(MessageRecordRepository repository) Constructor for PushPullQueueCore. -
Method Summary
Modifier and TypeMethodDescriptionclearBefore
(String topic, long index) Clears messages in the specified topic before the given index.Counts the number of messages available from a specific index onwards.Retrieves metadata information for the specified topic.Pulls a single message from the specified topic at the given index.Pulls a batch of messages from the specified topic starting at the given index.Pulls messages from the specified topic starting from the given index.Pushes a single message to the specified topic.Pushes a batch of messages to the specified topic.
-
Constructor Details
-
PushPullQueueCore
Constructor for PushPullQueueCore.- Parameters:
repository
- The repository for message persistence.
-
-
Method Details
-
push
Pushes a single message to the specified topic. Thread-safe: Operations on the same topic are serialized to prevent race conditions.- Parameters:
topic
- The topic to push the message to.message
- The message content to push.- Returns:
- A Result containing the created MessageRecord or errors.
-
pull
Pulls a single message from the specified topic at the given index.- Parameters:
topic
- The topic to pull from.index
- The index of the message to pull.- Returns:
- A Result containing the MessageRecord or errors.
-
pullBatch
Pulls a batch of messages from the specified topic starting at the given index.- Parameters:
topic
- The topic to pull from.index
- The starting index for the batch.batchSize
- The number of messages to pull.- Returns:
- A Result containing a list of MessageRecords or errors.
-
pullFrom
Pulls messages from the specified topic starting from the given index. This method retrieves available messages at or after the specified index, up to the batch size limit.- Parameters:
topic
- The topic to pull from.from
- The minimum index to start searching from.batchSize
- The maximum number of messages to retrieve.- Returns:
- A Result containing a list of MessageRecords found or errors.
-
pushBatch
Pushes a batch of messages to the specified topic. Thread-safe: Operations on the same topic are serialized to prevent race conditions.- Parameters:
topic
- The topic to push messages to.messages
- The list of message contents to push.- Returns:
- A Result containing the MetaRecord with updated topic information or errors.
-
meta
Retrieves metadata information for the specified topic.- Parameters:
topic
- The topic to get metadata for.- Returns:
- A Result containing the MetaRecord or errors.
-
countFrom
Counts the number of messages available from a specific index onwards.- Parameters:
topic
- The topic to count messages from.from
- The starting index to count from (inclusive).- Returns:
- A Result containing the count of messages from the specified index or errors.
-
clearBefore
Clears messages in the specified topic before the given index.- Parameters:
topic
- The topic to clear messages from.index
- The index before which to clear messages (exclusive).- Returns:
- A Result containing the updated MetaRecord or errors.
-