Skip to content

Commit

Permalink
fixed if/else ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
lepsalex committed Sep 11, 2020
1 parent 7d62f5f commit f4ea3bf
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,7 @@ public SplitterService(SplitStream splitStream) {

@StreamListener(SplitStream.WEBLOG)
public void split(JsonNode event) {
if (event.has("event") && event.path("event").asText().equals(FAILED.toString())) {
// WORKFLOW MANAGEMENT FAILED EVENT
val runName = event.path("runName").asText();
log.debug(format("Processing failed pod event for runName: { %s }", runName));
failedOutput.send(
// TODO:
// https://cwiki.apache.org/confluence/display/KAFKA/KIP-280%3A+Enhanced+log+compaction
// See above message
MessageBuilder.withPayload(event)
// workflow topic key == nextflow runName (our wes id ... e.g. wes-1234567890abcdefg)
.setHeader(KafkaHeaders.MESSAGE_KEY, runName.getBytes())
.build());
} else if (event.has("trace")) {
if (event.has("trace")) {
// NEXTFLOW TASK EVENT
val runId = event.path("runId").asText();
val runName = event.path("runName").asText();
Expand Down Expand Up @@ -102,6 +90,18 @@ public void split(JsonNode event) {
// workflow topic key == nextflow runName (our wes id ... e.g. wes-1234567890abcdefg)
.setHeader(KafkaHeaders.MESSAGE_KEY, runName.getBytes())
.build());
} else if (event.has("event") && event.path("event").asText().equals(FAILED.toString())) {
// WORKFLOW MANAGEMENT FAILED EVENT
val runName = event.path("runName").asText();
log.debug(format("Processing failed pod event for runName: { %s }", runName));
failedOutput.send(
// TODO:
// https://cwiki.apache.org/confluence/display/KAFKA/KIP-280%3A+Enhanced+log+compaction
// See above message
MessageBuilder.withPayload(event)
// workflow topic key == nextflow runName (our wes id ... e.g. wes-1234567890abcdefg)
.setHeader(KafkaHeaders.MESSAGE_KEY, runName.getBytes())
.build());
} else {
log.error("Unhandled event: {}", event.toString());
throw new RuntimeException("Cannot handle event, please see DLQ for event information");
Expand Down

0 comments on commit f4ea3bf

Please sign in to comment.