Message ackMsg = new Message();
//echo the mode
String mode = MODE_WEB;
MessageElement modeMsgElement =
msg.getMessageElement(MESSAGE_MODE, MESSAGE_MODE);
if(modeMsgElement != null) {
mode = modeMsgElement.toString();
}
ackMsg.addMessageElement(MESSAGE_MODE,
new StringMessageElement(MESSAGE_MODE,
mode,
null));
ackMsg.addMessageElement(BULK_MESSAGE_MODE,
new StringMessageElement(BULK_MESSAGE_MODE,
"BULK",
null));
//echo the id
MessageElement idMsgElement =
msg.getMessageElement(MESSAGE_ID, MESSAGE_ID);
String id = idMsgElement.toString();
ackMsg.addMessageElement(MESSAGE_ID,
new StringMessageElement(MESSAGE_ID,
id,
null));
//echo the appid
MessageElement appidMsgElement =
msg.getMessageElement(MESSAGE_APPID, MESSAGE_APPID);
String appid = appidMsgElement.toString();
ackMsg.addMessageElement(MESSAGE_APPID,
new StringMessageElement(MESSAGE_APPID,
appid,
null));
//********** test begin**********************
//get the current command
MessageElement commandMsgElement =
msg.getMessageElement(MESSAGE_COMMAND, MESSAGE_COMMAND);
String previousCommand = commandMsgElement.toString();
String theCommand = RETURN_MSG_COMMAND;
if(previousCommand.equals(ReplicationState.HC_COMMAND)) {
theCommand = RETURN_HC_MSG_COMMAND;
}
//this is a return command