in serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/java/org/acme/serverless/loanbroker/aggregator/resources/QuotesCloudEventsResource.java [55:71]
public Response consumeQuoteEvent(CloudEvent cloudEvent) {
LOGGER.info("Aggregator just received an event \n {}", cloudEvent);
if (cloudEvent == null || cloudEvent.getData() == null) {
LOGGER.warn("Bad Event Received, no data. Ignoring. See: \n {}", cloudEvent);
return Response.status(400).entity(ResponseError.NO_DATA_EVENT_ERROR).build();
}
if (cloudEvent.getExtension(IntegrationConstants.KOGITO_FLOW_ID_HEADER) == null) {
LOGGER.warn("Bad Event Received, no Kogito header. Ignoring. See: \n {}", cloudEvent);
return Response.status(400).entity(ResponseError.NO_DATA_EVENT_ERROR).build();
}
aggregatorProducer.sendBodyAndHeader(
"direct:aggregator",
PojoCloudEventDataMapper.from(mapper, BankQuote.class).map(cloudEvent.getData()).getValue(),
IntegrationConstants.KOGITO_FLOW_ID_HEADER,
cloudEvent.getExtension(IntegrationConstants.KOGITO_FLOW_ID_HEADER).toString());
return Response.ok().build();
}