Package net.solarnetwork.ocpp.service
Class SimpleActionMessageQueue
java.lang.Object
net.solarnetwork.ocpp.service.SimpleActionMessageQueue
- All Implemented Interfaces:
ActionMessageQueue
Simple in-memory implementation of
ActionMessageQueue.- Version:
- 1.0
- Author:
- matt
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.SimpleActionMessageQueue(Map<ChargePointIdentity, Deque<PendingActionMessage>> pendingMessages) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.ocpp.service.ActionMessageQueue
addPendingMessage
-
Constructor Details
-
SimpleActionMessageQueue
public SimpleActionMessageQueue()Constructor. -
SimpleActionMessageQueue
public SimpleActionMessageQueue(Map<ChargePointIdentity, Deque<PendingActionMessage>> pendingMessages) Constructor.- Parameters:
pendingMessages- the pending message queue map
-
-
Method Details
-
pendingMessageQueue
Description copied from interface:ActionMessageQueueGet the pending message queue for a specific client.- Specified by:
pendingMessageQueuein interfaceActionMessageQueue- Parameters:
clientId- the client ID- Returns:
- the queue, never null
-
addPendingMessage
Description copied from interface:ActionMessageQueueAdd a message to the pending message queue.The pending message's
ActionMessage.getClientId()will determine the client queue the message is added to.- Specified by:
addPendingMessagein interfaceActionMessageQueue- Parameters:
msg- the message to addfn- an optional function to apply synchronously
-
pollPendingMessage
Description copied from interface:ActionMessageQueueFind and remove the first available message from the pending message queue.- Specified by:
pollPendingMessagein interfaceActionMessageQueue- Parameters:
clientId- the ID of the client- Returns:
- the found message, or null if no messages available
-
pollPendingMessage
Description copied from interface:ActionMessageQueueFind 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.
- Specified by:
pollPendingMessagein interfaceActionMessageQueue- Parameters:
clientId- the ID of the clientmessageId- the ID to find- Returns:
- the found message, or null if not found
-
allQueues
Description copied from interface:ActionMessageQueueGet an iterable for all available queues.- Specified by:
allQueuesin interfaceActionMessageQueue- Returns:
- the iterable, never null
-