Interface CommunicationTransport
- All Known Implementing Classes:
LocalTransport
public interface CommunicationTransport
Abstraction for the underlying message transport mechanism.
Enables switching between in-memory (local) and distributed (Redis, RabbitMQ) communication.
-
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcast(AgentMessage message) Broadcasts a message to all subscribed agents (optional support).voidregister(String agentId, Consumer<AgentMessage> messageHandler) Registers an agent with the transport layer to receive messages.voidsend(AgentMessage message) Sends a message to a specific receiver.default voidshutdown()Stops the transport layer and releases resources.voidunregister(String agentId) Unregisters an agent from the transport layer.
-
Method Details
-
register
Registers an agent with the transport layer to receive messages.- Parameters:
agentId- The ID of the agent to registermessageHandler- The callback to invoke when a message is received for this agent
-
unregister
Unregisters an agent from the transport layer.- Parameters:
agentId- The ID of the agent to unregister
-
send
Sends a message to a specific receiver.- Parameters:
message- The message to send
-
broadcast
Broadcasts a message to all subscribed agents (optional support).- Parameters:
message- The message to broadcast
-
shutdown
default void shutdown()Stops the transport layer and releases resources.
-