} catch (Exception ex) {}
long sendStartTime = state.getSendStartTime();
//String data = "Message #" + i;
msg.addMessageElement(MESSAGE_MODE,
new StringMessageElement(MESSAGE_MODE,
mode,
null));
if(mode != null && mode.equalsIgnoreCase(BULK_MESSAGE_MODE)) {
msg.addMessageElement(BULK_MESSAGE_MODE,
new StringMessageElement(BULK_MESSAGE_MODE,
"BULK",
null));
}
msg.addMessageElement(MESSAGE_ID,
new StringMessageElement(MESSAGE_ID,
id,
null));
msg.addMessageElement(MESSAGE_ID,
new StringMessageElement(MESSAGE_ID,
id,
null));
msg.addMessageElement(MESSAGE_APPID,
new StringMessageElement(MESSAGE_APPID,
appid,
null));
msg.addMessageElement(MESSAGE_VERSION,
new StringMessageElement(MESSAGE_VERSION,
version.toString(),
null));
String theCommand = command;
if(isResponse) {
theCommand = RETURN_MSG_COMMAND;
}
msg.addMessageElement(MESSAGE_COMMAND,
new StringMessageElement(MESSAGE_COMMAND,
theCommand,
null));
msg.addMessageElement(MESSAGE_LAST_ACCESS,
new StringMessageElement(MESSAGE_LAST_ACCESS,
lastAccess.toString(),
null));
msg.addMessageElement(MESSAGE_MAX_INACTIVE,
new StringMessageElement(MESSAGE_MAX_INACTIVE,
maxInactive.toString(),
null));
if(extraParam != null) {
msg.addMessageElement(MESSAGE_EXTRA_PARAM,
new StringMessageElement(MESSAGE_EXTRA_PARAM,
extraParam,
null));
}
if(queryResult != null) {
msg.addMessageElement(MESSAGE_QUERY_RESULT,
new StringMessageElement(MESSAGE_QUERY_RESULT,
queryResult.toString(),
null));
}
if(instanceName != null) {
msg.addMessageElement(MESSAGE_INSTANCE_NAME,
new StringMessageElement(MESSAGE_INSTANCE_NAME,
instanceName,
null));
}
if(data != null) {
msg.addMessageElement(MESSAGE_DATA,
new ByteArrayMessageElement(MESSAGE_DATA,
null,
data,
null));
}
if(trunkData != null) {
msg.addMessageElement(MESSAGE_TRUNK_DATA,
new ByteArrayMessageElement(MESSAGE_TRUNK_DATA,
null,
trunkData,
null));
}
if(containerExtraParamData != null) {
msg.addMessageElement(MESSAGE_CONTAINER_EXTRA_PARAMS_DATA,
new ByteArrayMessageElement(MESSAGE_CONTAINER_EXTRA_PARAMS_DATA,
null,
containerExtraParamData,
null));
}
if(propertiesState != null) {
msg.addMessageElement(MESSAGE_PROPERTIES_DATA,
new ByteArrayMessageElement(MESSAGE_PROPERTIES_DATA,
null,
propertiesState,
null));
}
//is ack required
String ackRequiredString = "N";
if(ackRequired) {
ackRequiredString = "Y";
}
msg.addMessageElement(MESSAGE_ACK_REQUIRED,
new StringMessageElement(MESSAGE_ACK_REQUIRED,
ackRequiredString,
null));
//a property not sent but available for quick-ack case
msg.setMessageProperty(MESSAGE_ACK_REQUIRED, ackRequiredString);
List ackIdsList = state.getAckIdsList();
if(state.getAckIdsList() != null) {
msg.setMessageProperty(MESSAGE_ACK_LIST_PROPERTY, ackIdsList);
}
//send start time for measurements
if(sendStartTime != -1) {
msg.addMessageElement(MESSAGE_SEND_START_TIME,
new StringMessageElement(MESSAGE_SEND_START_TIME,
"" + sendStartTime,
null));
msg.setMessageProperty(MESSAGE_SEND_START_TIME, ""+sendStartTime);
}
msg.addMessageElement(MESSAGE_BIDI_STYLE,
new StringMessageElement(MESSAGE_BIDI_STYLE,
"" + state.isBiDiStyle(),
null));
if(_logger.isLoggable(Level.FINE)) {
_logger.fine("ReplicationState:createMessage:Sending Message id:" + id + " appid:" + appid + " command:" + command);