Skip to content

Commit

Permalink
Fixes getMergeEvent's payload to return structs instead of entities
Browse files Browse the repository at this point in the history
  • Loading branch information
mightycox committed Sep 4, 2024
1 parent 959e7f6 commit aa553a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,33 @@ public void handleEvent(final Event event, final Message message) {
try {
switch (event.getEventType()) {
case VALIDATE_STUDENT_DEMOGRAPHICS:
log.info("received validate student demographics event :: ");
log.debug("received validate student demographics event :: ");
log.trace(PAYLOAD_LOG, event.getEventPayload());
response = this.getEventHandlerService().handleValidateStudentDemogDataEvent(event);
this.publishToNATS(event, message, isSynchronous, response);
break;
case GET_NEXT_PEN_NUMBER:
log.info("received get next pen number event :: ");
log.debug("received get next pen number event :: ");
log.trace(PAYLOAD_LOG, event.getEventPayload());
response = this.getEventHandlerService().handleGetNextPenNumberEvent(event);
this.publishToNATS(event, message, isSynchronous, response);
break;
case CREATE_MERGE:
log.info("received create merge data :: {}", event.getSagaId());
log.debug("received create merge data :: {}", event.getSagaId());
log.trace(PAYLOAD_LOG, event.getEventPayload());
pairedResult = this.getEventHandlerService().handleCreateMergeEvent(event);
this.publishToNATS(event, message, isSynchronous, pairedResult.getLeft());
pairedResult.getRight().ifPresent(this::publishToJetStream);
break;
case DELETE_MERGE:
log.info("received delete merge data :: {}", event.getSagaId());
log.debug("received delete merge data :: {}", event.getSagaId());
log.trace(PAYLOAD_LOG, event.getEventPayload());
pairedResult = this.getEventHandlerService().handleDeleteMergeEvent(event);
this.publishToNATS(event, message, isSynchronous, pairedResult.getLeft());
pairedResult.getRight().ifPresent(this::publishToJetStream);
break;
case GET_MERGES:
log.info("received get merge data :: {}", event.getSagaId());
log.debug("received get merge data :: {}", event.getSagaId());
log.trace(PAYLOAD_LOG, event.getEventPayload());
response = this.getEventHandlerService().handleGetMergeEvent(event);
this.publishToNATS(event, message, isSynchronous, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public byte[] handleGetMergeEvent(@NonNull final Event event) throws JsonProcess
.sagaId(event.getSagaId())
.eventType(event.getEventType())
.eventOutcome(MERGE_FOUND)
.eventPayload(JsonUtil.getJsonStringFromObject(mergeEntities)).build();
.eventPayload(JsonUtil.getJsonStringFromObject(mergeEntities.stream().map(StudentMergeMapper.mapper::toStructure).toList())).build();
if (log.isDebugEnabled()) {
log.debug(RESPONDING_BACK, newEvent);
}
Expand Down

0 comments on commit aa553a6

Please sign in to comment.