Class LocalTransport
java.lang.Object
com.tnsai.communication.transport.LocalTransport
- All Implemented Interfaces:
CommunicationTransport
Default in-memory transport implementation.
Used for single-process applications.
-
Constructor Summary
Constructors -
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.voidunregister(String agentId) Unregisters an agent from the transport layer.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.communication.transport.CommunicationTransport
shutdown
-
Constructor Details
-
LocalTransport
public LocalTransport()
-
-
Method Details
-
register
Description copied from interface:CommunicationTransportRegisters an agent with the transport layer to receive messages.- Specified by:
registerin interfaceCommunicationTransport- Parameters:
agentId- The ID of the agent to registermessageHandler- The callback to invoke when a message is received for this agent
-
unregister
Description copied from interface:CommunicationTransportUnregisters an agent from the transport layer.- Specified by:
unregisterin interfaceCommunicationTransport- Parameters:
agentId- The ID of the agent to unregister
-
send
Description copied from interface:CommunicationTransportSends a message to a specific receiver.- Specified by:
sendin interfaceCommunicationTransport- Parameters:
message- The message to send
-
broadcast
Description copied from interface:CommunicationTransportBroadcasts a message to all subscribed agents (optional support).- Specified by:
broadcastin interfaceCommunicationTransport- Parameters:
message- The message to broadcast
-