use of org.apache.airavata.model.messaging.event.JobIdentifier in project airavata by apache.
the class MessagingFactory method statusRoutingkey.
private static String statusRoutingkey(MessageContext msgCtx) {
String gatewayId = msgCtx.getGatewayId();
String routingKey = null;
if (msgCtx.getType() == MessageType.EXPERIMENT) {
ExperimentStatusChangeEvent event = (ExperimentStatusChangeEvent) msgCtx.getEvent();
routingKey = gatewayId + "." + event.getExperimentId();
} else if (msgCtx.getType() == MessageType.TASK) {
TaskStatusChangeEvent event = (TaskStatusChangeEvent) msgCtx.getEvent();
routingKey = gatewayId + "." + event.getTaskIdentity().getExperimentId() + "." + event.getTaskIdentity().getProcessId() + "." + event.getTaskIdentity().getTaskId();
} else if (msgCtx.getType() == MessageType.PROCESSOUTPUT) {
TaskOutputChangeEvent event = (TaskOutputChangeEvent) msgCtx.getEvent();
routingKey = gatewayId + "." + event.getTaskIdentity().getExperimentId() + "." + event.getTaskIdentity().getProcessId() + "." + event.getTaskIdentity().getTaskId();
} else if (msgCtx.getType() == MessageType.PROCESS) {
ProcessStatusChangeEvent event = (ProcessStatusChangeEvent) msgCtx.getEvent();
ProcessIdentifier processIdentifier = event.getProcessIdentity();
routingKey = gatewayId + "." + processIdentifier.getExperimentId() + "." + processIdentifier.getProcessId();
} else if (msgCtx.getType() == MessageType.JOB) {
JobStatusChangeEvent event = (JobStatusChangeEvent) msgCtx.getEvent();
JobIdentifier identity = event.getJobIdentity();
routingKey = gatewayId + "." + identity.getExperimentId() + "." + identity.getProcessId() + "." + identity.getTaskId() + "." + identity.getJobId();
}
return routingKey;
}
use of org.apache.airavata.model.messaging.event.JobIdentifier in project airavata by apache.
the class EventData method process.
private void process(MessageContext event) {
this.messageId = event.getMessageId();
if (event.getType() == MessageType.EXPERIMENT) {
ExperimentStatusChangeEvent experimentStatusChangeEvent = (ExperimentStatusChangeEvent) event.getEvent();
this.status = experimentStatusChangeEvent.getState().toString();
this.experimentId = experimentStatusChangeEvent.getExperimentId();
this.workflowNodeId = "";
this.message = "Received experiment event , expId : " + experimentStatusChangeEvent.getExperimentId() + ", status : " + experimentStatusChangeEvent.getState().toString();
} else if (event.getType() == MessageType.WORKFLOWNODE) {
WorkflowNodeStatusChangeEvent wfnStatusChangeEvent = (WorkflowNodeStatusChangeEvent) event.getEvent();
WorkflowIdentifier wfIdentifier = wfnStatusChangeEvent.getWorkflowNodeIdentity();
this.status = wfnStatusChangeEvent.getState().toString();
this.experimentId = wfIdentifier.getExperimentId();
this.workflowNodeId = wfIdentifier.getWorkflowNodeId();
this.message = "Received workflow status change event, expId : " + wfIdentifier.getExperimentId() + ", nodeId : " + wfIdentifier.getWorkflowNodeId() + " , status : " + wfnStatusChangeEvent.getState().toString();
} else if (event.getType() == MessageType.TASK) {
TaskStatusChangeEvent taskStatusChangeEvent = (TaskStatusChangeEvent) event.getEvent();
TaskIdentifier taskIdentifier = taskStatusChangeEvent.getTaskIdentity();
this.status = taskStatusChangeEvent.getState().toString();
this.experimentId = taskIdentifier.getExperimentId();
this.workflowNodeId = taskIdentifier.getWorkflowNodeId();
this.message = "Received task event , expId : " + taskIdentifier.getExperimentId() + ",taskId : " + taskIdentifier.getTaskId() + ", wfNodeId : " + taskIdentifier.getWorkflowNodeId() + ", status : " + taskStatusChangeEvent.getState().toString();
} else if (event.getType() == MessageType.JOB) {
JobStatusChangeEvent jobStatusChangeEvent = (JobStatusChangeEvent) event.getEvent();
JobIdentifier jobIdentifier = jobStatusChangeEvent.getJobIdentity();
this.status = jobStatusChangeEvent.getState().toString();
this.experimentId = jobIdentifier.getExperimentId();
this.workflowNodeId = jobIdentifier.getWorkflowNodeId();
this.message = "Received task event , expId : " + jobIdentifier.getExperimentId() + " ,taskId : " + jobIdentifier.getTaskId() + ", wfNodeId : " + jobIdentifier.getWorkflowNodeId() + ", status : " + jobStatusChangeEvent.getState().toString();
}
}
Aggregations