publishAsyncEvent(topicName, requestId, resourceDataAsJson, status, code);
} else {
log.error("Error occurred with async request {}", throwable.getMessage());
- publishAsyncFailureEvent(topicName, requestId, operation, throwable);
+ publishAsyncFailureEvent(topicName, requestId, throwable);
}
});
log.info("Async task completed.");
dmiAsyncRequestResponseEventProducer.sendMessage(requestId, cpsAsyncRequestResponseEvent);
}
- protected void publishAsyncFailureEvent(final String topicName,
+ private void publishAsyncFailureEvent(final String topicName,
final String requestId,
- final DataAccessRequest.OperationEnum operation,
final Throwable throwable) {
HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
def 'Publish and Subscribe message - failure'() {
when: 'a failure event is published'
def exception = new HttpClientRequestException('some cm handle', 'Node not found', HttpStatus.INTERNAL_SERVER_ERROR)
- objectUnderTest.publishAsyncFailureEvent(TEST_TOPIC, '67890', DataAccessRequest.OperationEnum.READ, exception)
+ objectUnderTest.publishAsyncFailureEvent(TEST_TOPIC, '67890', exception)
and: 'the topic is polled'
def records = consumer.poll(Duration.ofMillis(1500))
then: 'the record received is the event sent'