IClient.ListenerCommand| Constructor and Description |
|---|
RabbitMqClientDm() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeConnection()
Closes the connection with the message server.
|
void |
deleteMessagingServerArtifacts(net.roboconf.core.model.beans.Application application)
Deletes all the server artifacts related to this application.
|
boolean |
isConnected() |
void |
listenToAgentMessages(net.roboconf.core.model.beans.Application application,
IClient.ListenerCommand command)
Configures the listener for messages sent by agents.
|
void |
listenToTheDm(IClient.ListenerCommand command)
Configures the listener for messages from the DM.
|
void |
openConnection()
Opens a connection with the message server.
|
void |
propagateAgentTermination(net.roboconf.core.model.beans.Application application,
net.roboconf.core.model.beans.Instance rootInstance)
Propagates to all the agents the fact that a given agent is not here anymore.
|
void |
sendMessageToAgent(net.roboconf.core.model.beans.Application application,
net.roboconf.core.model.beans.Instance instance,
Message message)
Sends a message to an agent.
|
void |
sendMessageToTheDm(Message msg)
Sends a message to the DM.
|
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.
|
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 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 sendMessageToAgent(net.roboconf.core.model.beans.Application application,
net.roboconf.core.model.beans.Instance instance,
Message message)
throws IOException
IDmClientsendMessageToAgent in interface IDmClientapplication - the application associated with the given agentinstance - an instance managed on the agent (used to find the root instance name)message - the message to sendIOException - if something went wrongpublic void listenToAgentMessages(net.roboconf.core.model.beans.Application application,
IClient.ListenerCommand command)
throws IOException
IDmClientlistenToAgentMessages in interface IDmClientapplication - the application associated with the given agentscommand - ListenerCommand#START to start listening, ListenerCommand#STOP to stop listeningIOException - if something went wrongpublic void sendMessageToTheDm(Message msg) throws IOException
IClientsendMessageToTheDm in interface IClientmsg - 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 wrongpublic void deleteMessagingServerArtifacts(net.roboconf.core.model.beans.Application application)
throws IOException
IDmClientThis method must be called when ALL the agents have closed their connection and BEFORE the DM's connection is closed.
deleteMessagingServerArtifacts in interface IDmClientapplication - the application whose messaging artifacts must be deletedIOException - if something went wrongpublic void propagateAgentTermination(net.roboconf.core.model.beans.Application application,
net.roboconf.core.model.beans.Instance rootInstance)
throws IOException
IDmClientGenerally, when an agent undeploys something, it sends notifications to other agents, which themselves invoke their "update" method. However, when the DM terminates a virtual machine, the agent does not always send these notifications to the other agents. Therefore, the DM has to do it. Since it has the application model, it can do it.
The DM should notify all the potential agents that may be concerned. Roughly, it is equivalent to unpublishing all the exports of all the instances that were available on the terminated machine.
propagateAgentTermination in interface IDmClientapplication - the application the agent is associated withrootInstance - the root instance associated with the agentIOException - if something went wrongCopyright © 2015. All rights reserved.