Package net.solarnetwork.ocpp.service
Interface ActionMessageQueue
- All Known Implementing Classes:
SimpleActionMessageQueue
public interface ActionMessageQueue
API for thread-safe management of action message queues partitioned by client
identifiers.
The operations in this API are all thread-safe. Any method that gives access
a Deque, like
addPendingMessage(PendingActionMessage, Consumer) or
allQueues() should synchronize on those instances for thread
safety.
- Version:
- 1.0
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidAdd a message to the pending message queue.voidAdd a message to the pending message queue.Get an iterable for all available queues.pendingMessageQueue(ChargePointIdentity clientId) Get the pending message queue for a specific client.pollPendingMessage(ChargePointIdentity clientId) Find and remove the first available message from the pending message queue.pollPendingMessage(ChargePointIdentity clientId, String messageId) Find and remove a message from the pending message queue, based on its message ID.
-
Method Details
-
pendingMessageQueue
Get the pending message queue for a specific client.- Parameters:
clientId- the client ID- Returns:
- the queue, never null
-
addPendingMessage
Add a message to the pending message queue.The pending message's
ActionMessage.getClientId()will determine the client queue the message is added to.- Parameters:
msg- the message to add
-
addPendingMessage
Add a message to the pending message queue.The pending message's
ActionMessage.getClientId()will determine the client queue the message is added to.- Parameters:
msg- the message to addfn- an optional function to apply synchronously
-
pollPendingMessage
Find and remove the first available message from the pending message queue.- Parameters:
clientId- the ID of the client- Returns:
- the found message, or null if no messages available
-
pollPendingMessage
Find and remove a message from the pending message queue, based on its message ID.This method will search the pending messages queue and return the first message found with the matching message ID, after first removing that message from the queue.
- Parameters:
clientId- the ID of the clientmessageId- the ID to find- Returns:
- the found message, or null if not found
-
allQueues
Iterable<Map.Entry<ChargePointIdentity,Deque<PendingActionMessage>>> allQueues()Get an iterable for all available queues.- Returns:
- the iterable, never null
-