use of cbit.vcell.message.VCMessage in project vcell by virtualcell.
the class SimulationTaskMessage method toMessage.
/**
* Insert the method's description here.
* Creation date: (12/31/2003 11:08:17 AM)
* @return javax.jms.Message
* @param session cbit.vcell.messaging.VCellSession
* @throws VCMessagingException
*/
private VCMessage toMessage(VCMessageSession session) throws VCMessagingException {
VCMessage message;
try {
message = session.createTextMessage(XmlHelper.simTaskToXML(simTask));
} catch (XmlParseException e) {
e.printStackTrace(System.out);
throw new VCMessagingException("failed to restore Simulation Task from XML", e);
}
// must have
message.setStringProperty(VCMessagingConstants.MESSAGE_TYPE_PROPERTY, MessageConstants.MESSAGE_TYPE_SIMULATION_JOB_VALUE);
// must have
message.setIntProperty(MessageConstants.JOBINDEX_PROPERTY, simTask.getSimulationJob().getJobIndex());
// must have
message.setIntProperty(MessageConstants.TASKID_PROPERTY, simTask.getTaskID());
// might be used to remove from the job queue when do stopSimulation
message.setStringProperty(VCMessagingConstants.USERNAME_PROPERTY, simTask.getUserName());
// might be used to remove from the job queue when do stopSimulation
message.setLongProperty(MessageConstants.SIMKEY_PROPERTY, Long.parseLong(simTask.getSimKey() + ""));
// for worker message filter
message.setDoubleProperty(MessageConstants.SIZE_MB_PROPERTY, simTask.getEstimatedMemorySizeMB());
if (simTask.getComputeResource() != null) {
// for worker message filter
message.setStringProperty(MessageConstants.COMPUTE_RESOURCE_PROPERTY, simTask.getComputeResource());
}
FieldDataIdentifierSpec[] fieldDataIDs = simTask.getSimulationJob().getFieldDataIdentifierSpecs();
if (fieldDataIDs != null && fieldDataIDs.length > 0) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < fieldDataIDs.length; i++) {
sb.append(fieldDataIDs[i].toCSVString() + "\n");
}
message.setStringProperty(MessageConstants.FIELDDATAID_PROPERTY, sb.toString());
}
return message;
}
use of cbit.vcell.message.VCMessage in project vcell by virtualcell.
the class StatusMessage method toMessage.
/**
* Insert the method's description here.
* Creation date: (2/5/2004 1:59:04 PM)
* @return javax.jms.Message
* @param session cbit.vcell.messaging.VCellSession
*/
private VCMessage toMessage(VCMessageSession session) {
VCMessage message = session.createObjectMessage(jobStatus);
message.setStringProperty(VCMessagingConstants.MESSAGE_TYPE_PROPERTY, MessageConstants.MESSAGE_TYPE_SIMSTATUS_VALUE);
message.setStringProperty(VCMessagingConstants.USERNAME_PROPERTY, userName);
if (progress != null) {
message.setDoubleProperty(MessageConstants.SIMULATION_STATUS_PROGRESS_PROPERTY, progress.doubleValue());
}
if (timePoint != null) {
message.setDoubleProperty(MessageConstants.SIMULATION_STATUS_TIMEPOINT_PROPERTY, timePoint.doubleValue());
}
return message;
}
use of cbit.vcell.message.VCMessage in project vcell by virtualcell.
the class StatusMessage method sendToClient.
/**
* Insert the method's description here.
* Creation date: (2/5/2004 1:59:04 PM)
* @return javax.jms.Message
* @param session cbit.vcell.messaging.VCellSession
* @throws VCMessagingException
*/
public void sendToClient(VCMessageSession session) throws VCMessagingException {
VCMessage message = toMessage(session);
session.sendTopicMessage(VCellTopic.ClientStatusTopic, message);
}
use of cbit.vcell.message.VCMessage in project vcell by virtualcell.
the class VCellServices method dataJobMessage.
public void dataJobMessage(cbit.rmi.event.DataJobEvent event) {
synchronized (dataSession) {
try {
// VCMessageSession dataSession = vcMessagingService.createProducerSession();
VCMessage dataEventMessage = dataSession.createObjectMessage(event);
dataEventMessage.setStringProperty(VCMessagingConstants.MESSAGE_TYPE_PROPERTY, MessageConstants.MESSAGE_TYPE_DATA_EVENT_VALUE);
dataEventMessage.setStringProperty(VCMessagingConstants.USERNAME_PROPERTY, event.getUser().getName());
dataSession.sendTopicMessage(VCellTopic.ClientStatusTopic, dataEventMessage);
// dataSession.close();
} catch (VCMessagingException ex) {
lg.error(ex.getMessage(), ex);
}
}
}
use of cbit.vcell.message.VCMessage in project vcell by virtualcell.
the class VCellServices method exportMessage.
public void exportMessage(cbit.rmi.event.ExportEvent event) {
synchronized (exportSession) {
try {
// VCMessageSession dataSession = vcMessagingService.createProducerSession();
VCMessage exportEventMessage = exportSession.createObjectMessage(event);
exportEventMessage.setStringProperty(VCMessagingConstants.MESSAGE_TYPE_PROPERTY, MessageConstants.MESSAGE_TYPE_EXPORT_EVENT_VALUE);
exportEventMessage.setStringProperty(VCMessagingConstants.USERNAME_PROPERTY, event.getUser().getName());
exportSession.sendTopicMessage(VCellTopic.ClientStatusTopic, exportEventMessage);
// dataSession.close();
} catch (VCMessagingException ex) {
lg.error(ex.getMessage(), ex);
}
}
}
Aggregations