public class AgentMessagingClient extends Object implements MessagingClient
AgentMessagingClient
enables message handling (send, receive) for agents.
The class is not thread-safe.Constructor and Description |
---|
AgentMessagingClient(CommunicativeAgent agent,
Inbox inbox,
MessageTransportService mts) |
Modifier and Type | Method and Description |
---|---|
UniqueIdentifier |
generateUniqueIdentifier()
Generates an identifier that is globally
unique throughout the whole multiagent system.
|
AgentIdentifier |
getAddress()
Returns the identifier of the agent itself.
|
boolean |
hasMessages()
Checks whether messages are available.
|
boolean |
hasMessages(MessagePattern pattern)
Checks whether messages matching a given pattern are available.
|
Message |
receive()
Receives a message if one is available.
|
Message |
receive(MessagePattern pattern)
Returns a message matching a given pattern if one is available.
|
Message |
send(Message message)
Sets the sender of the message and passes the message to the message
transport system.
|
public AgentMessagingClient(CommunicativeAgent agent, Inbox inbox, MessageTransportService mts)
public AgentIdentifier getAddress()
MessagingClient
getAddress
in interface MessagingClient
public Message send(Message message)
MessagingClient
send
in interface MessagingClient
message
- the message to be sentpublic boolean hasMessages()
MessagingClient
hasMessages
in interface MessagingClient
true
if messages are available, false
otherwisepublic boolean hasMessages(MessagePattern pattern)
MessagingClient
hasMessages
in interface MessagingClient
pattern
- the pattern the messages should matchtrue
if messages match the given pattern,
false
otherwisepublic Message receive() throws NoSuchMessageException
MessagingClient
receive
in interface MessagingClient
NoSuchMessageException
- if no message is availablepublic Message receive(MessagePattern pattern) throws NoSuchMessageException
MessagingClient
receive
in interface MessagingClient
pattern
- the pattern the message should matchNoSuchMessageException
- if no matching message is availablepublic UniqueIdentifier generateUniqueIdentifier()
MessagingClient
Generates an identifier that is globally unique throughout the whole multiagent system. Such unique identifiers can be employed in order to identify messages in terms of the current conversation and the original message they reply to.
Without coordination with other agents, globally unique message identifiers can be created based on the agent identifier which is guaranteed to be unique.
generateUniqueIdentifier
in interface MessagingClient
Copyright © Aimpulse Intelligent Systems GmbH
All rights reserved.