public class RabbitMqClientAgent extends Object implements IAgentClient
IClient.ListenerCommand| Modifier and Type | Field and Description |
|---|---|
static String |
THOSE_THAT_IMPORT |
| Constructor and Description |
|---|
RabbitMqClientAgent() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeConnection()
Closes the connection with the message server.
|
boolean |
isConnected() |
void |
listenToExportsFromOtherAgents(IClient.ListenerCommand command,
net.roboconf.core.model.beans.Instance instance)
Configures the listener for the exports from other agents.
|
void |
listenToRequestsFromOtherAgents(IClient.ListenerCommand command,
net.roboconf.core.model.beans.Instance instance)
Configures the listener for requests from other agents.
|
void |
listenToTheDm(IClient.ListenerCommand command)
Configures the listener for messages from the DM.
|
void |
openConnection()
Opens a connection with the message server.
|
void |
publishExports(net.roboconf.core.model.beans.Instance instance)
Publishes the exports for a given instance.
|
void |
publishExports(net.roboconf.core.model.beans.Instance instance,
String facetOrComponentName)
Publishes specific exports for a given instance.
|
void |
requestExportsFromOtherAgents(net.roboconf.core.model.beans.Instance instance)
Requests other agents to export their variables on the messaging server.
|
void |
sendMessageToTheDm(Message message)
Sends a message to the DM.
|
void |
setApplicationName(String applicationName)
Sets the application name.
|
void |
setMessageQueue(LinkedBlockingQueue<Message> messageQueue)
Sets the message queue where the client can store the messages to process.
|
void |
setParameters(String messageServerIp,
String messageServerUsername,
String messageServerPassword)
Sets the connection parameters.
|
void |
setRootInstanceName(String rootInstanceName)
Sets the name of the root instance associated with the agent.
|
void |
unpublishExports(net.roboconf.core.model.beans.Instance instance)
Un-publishes the exports for a given instance.
|
public static final String THOSE_THAT_IMPORT
public void setParameters(String messageServerIp, String messageServerUsername, String messageServerPassword)
IClientsetParameters in interface IClientmessageServerIp - the IP address of the messaging servermessageServerUsername - the user name to connect to the servermessageServerPassword - the password to connect to the serverpublic void setMessageQueue(LinkedBlockingQueue<Message> messageQueue)
IClientsetMessageQueue in interface IClientmessageQueue - the message queuepublic boolean isConnected()
isConnected in interface IClientpublic void setRootInstanceName(String rootInstanceName)
IAgentClientsetRootInstanceName in interface IAgentClientpublic void openConnection()
throws IOException
IClientopenConnection in interface IClientIOExceptionpublic void closeConnection()
throws IOException
IClient
There is no need to check IClient.isConnected() before invoking this method.
closeConnection in interface IClientIOExceptionpublic void setApplicationName(String applicationName)
IAgentClientsetApplicationName in interface IAgentClientpublic void publishExports(net.roboconf.core.model.beans.Instance instance)
throws IOException
IAgentClientThis method indicates to other instances that they can use the variables exported by THIS instance.
publishExports in interface IAgentClientinstance - the instance whose exports must be publishedIOException - if something went wrongpublic void publishExports(net.roboconf.core.model.beans.Instance instance,
String facetOrComponentName)
throws IOException
IAgentClientpublishExports in interface IAgentClientinstance - the instance whose exports must be publishedfacetOrComponentName - the prefix of the variables to publishIOException - if something went wrongpublic void unpublishExports(net.roboconf.core.model.beans.Instance instance)
throws IOException
IAgentClientThis method indicates to other instances that the variables exported by THIS instance cannot be used anymore.
unpublishExports in interface IAgentClientinstance - the instance whose exports must be publishedIOException - if something went wrongpublic void listenToRequestsFromOtherAgents(IClient.ListenerCommand command, net.roboconf.core.model.beans.Instance instance) throws IOException
IAgentClientSuch requests aim at asking an agent to publish its exports. The agent will do so only if it exports a variable prefixed that is required by THIS instance.
listenToRequestsFromOtherAgents in interface IAgentClientcommand - ListenerCommand#START to start listening, ListenerCommand#STOP to stop listeninginstance - the instance that need exports from other agentsIOException - if something went wrongpublic void requestExportsFromOtherAgents(net.roboconf.core.model.beans.Instance instance)
throws IOException
IAgentClientThis should be called when a new instance is registered on the agent. It guarantees that any new instance can be notified about the instances located on other agents.
requestExportsFromOtherAgents in interface IAgentClientinstance - the instance that need exports from other agentsIOException - if something went wrongpublic void listenToExportsFromOtherAgents(IClient.ListenerCommand command, net.roboconf.core.model.beans.Instance instance) throws IOException
IAgentClientlistenToExportsFromOtherAgents in interface IAgentClientcommand - ListenerCommand#START to start listening, ListenerCommand#STOP to stop listeninginstance - the instance that determine which exports must be listened toIOException - if something went wrongpublic void sendMessageToTheDm(Message message) throws IOException
IClientsendMessageToTheDm in interface IClientmessage - the message to sendIOException - if something went wrongpublic void listenToTheDm(IClient.ListenerCommand command) throws IOException
IClientlistenToTheDm in interface IClientcommand - IClient.ListenerCommand.START to stop listening, IClient.ListenerCommand.STOP to stop listeningIOException - if something went wrongCopyright © 2015. All rights reserved.