Created
May 31, 2016 17:46
-
-
Save ikus060/e26c3086a42cab11730db03050682dcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from("timer://actionrequests?period=1&delay=" + period) | |
// HTTP GET | |
.to(value + "actionrequests/" + queueName + "/pop?httpClient.soTimeout=5000") | |
// If empty, wait | |
.choice() | |
.when(header(Exchange.HTTP_RESPONSE_CODE).isEqualTo(204)) | |
.log(LoggingLevel.TRACE, "actionrequests route idle") | |
.delay(period) | |
.endChoice() | |
// Else process | |
.otherwise() | |
.log(LoggingLevel.TRACE, LOG, "receiving incomming action request ${body}") | |
.unmarshal(gsonActionRequestFormat) | |
.log(LoggingLevel.INFO, LOG, "receiving incomming action request [${body.actionid}]") | |
.process(actionRequestProcessor) | |
// Finnaly, Delete action | |
.log(LoggingLevel.INFO, LOG, "sending action request delete [${body.actionid}]") | |
.setHeader(Exchange.HTTP_METHOD, constant("DELETE")) | |
.setHeader(Exchange.HTTP_PATH, simple("actionrequests/" + queueName + "/${body.actionid}")) | |
.setBody(constant(null)) | |
.to(value); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment