Skip to content

Commit 8d2fb30

Browse files
authored
[PHEE-522] Create Sync callback functionality in bulk (#137)
* callback if check * readable logs
1 parent 74ddf3a commit 8d2fb30

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/org/mifos/processor/bulk/camel/routes/SendCallbackRoute.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ public void configure() throws Exception {
4444
ObjectMapper objectMapper = new ObjectMapper();
4545
String jsonString = objectMapper.writeValueAsString(body);
4646
exchange.getIn().setBody(jsonString);
47-
}).setHeader(Exchange.HTTP_METHOD, constant("POST"))
47+
}).choice().when(exchangeProperty("X-CallbackURL").isNotNull()).setHeader(Exchange.HTTP_METHOD, constant("POST"))
4848
.toD("${exchangeProperty.X-CallbackURL}?bridgeEndpoint=true&throwExceptionOnFailure=false")
49-
.log(LoggingLevel.INFO, "Callback Response body: ${body}").choice()
50-
.when(header(Exchange.HTTP_RESPONSE_CODE).regex("^2\\d{2}$")).log(LoggingLevel.INFO, "Callback sending was successful")
49+
.log(LoggingLevel.INFO, "Callback Response body: ${body}").endChoice().otherwise()
50+
.log("Unable to send callback: callback url is null").choice().when(header(Exchange.HTTP_RESPONSE_CODE).regex("^2\\d{2}$"))
51+
.when(exchangeProperty("X-CallbackURL").isNotNull()).log(LoggingLevel.INFO, "Callback sending was successful")
5152
.process(exchange -> {
5253
List phases = exchange.getProperty(PHASES, List.class);
5354
exchange.setProperty(CALLBACK_RESPONSE_CODE, exchange.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE));

src/main/java/org/mifos/processor/bulk/zeebe/worker/BatchAccountLookupWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void setup() {
5252
String registeringInstituteId = variables.get(REGISTERING_INSTITUTE_ID).toString();
5353
logger.info("registeringInstituteId in worker {}", registeringInstituteId);
5454
variables.put(CACHED_TRANSACTION_ID, job.getKey());
55-
exchange.setProperty(HEADER_REGISTERING_INSTITUTE_ID, registeringInstituteId) ;
55+
exchange.setProperty(HEADER_REGISTERING_INSTITUTE_ID, registeringInstituteId);
5656
exchange.setProperty(SERVER_FILE_NAME, filename);
5757
exchange.setProperty(REQUEST_ID, job.getKey());
5858
exchange.setProperty(CALLBACK, identityMapperURL + batchAccountLookupCallback);

0 commit comments

Comments
 (0)