Package io.levysworks.beans
Class PollManager
java.lang.Object
io.levysworks.beans.PollManager
Bean used for sending
add and remove key messages to the agent servers-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyForAgent(String agentName, String key) Publishes a new key to the specified agent's.addqueue on thepollexchangeexchange.booleancheckAgentExists(String agentName) Checks whether an agent exists in theAgentsConfigvoidinit()Initializes the RabbitMQ connection and declares necessary messaging infrastructure.voidremoveKeyFromAgent(String agentName, String uid) Publishes a key removal request to the specified agent's.removequeue on thepollexchangeexchange.
-
Constructor Details
-
PollManager
public PollManager()
-
-
Method Details
-
init
@PostConstruct public void init()Initializes the RabbitMQ connection and declares necessary messaging infrastructure.Connects to the configured RabbitMQ server, declares the
pollexchangetopic exchange, and creates.addand.removequeues for each agent defined inAgentsConfig. This method is called automatically after bean construction. -
addKeyForAgent
Publishes a new key to the specified agent's.addqueue on thepollexchangeexchange.- Parameters:
agentName- the target agent's namekey- the key to be added- Throws:
IOException- if a RabbitMQ I/O error occursTimeoutException- if the operation times out
-
removeKeyFromAgent
Publishes a key removal request to the specified agent's.removequeue on thepollexchangeexchange.- Parameters:
agentName- the target agent's nameuid- the UID of the key to be removed- Throws:
IOException- if a RabbitMQ I/O error occursTimeoutException- if the operation times out
-
checkAgentExists
Checks whether an agent exists in theAgentsConfig- Parameters:
agentName- The agent to look for- Returns:
trueif the agent exists,falseotherwise
-