Skip to content

Instantly share code, notes, and snippets.

@mgyongyosi
Created May 11, 2017 11:13
Show Gist options
  • Save mgyongyosi/0d4c89b0dc405673af0680dd7f6d5758 to your computer and use it in GitHub Desktop.
Save mgyongyosi/0d4c89b0dc405673af0680dd7f6d5758 to your computer and use it in GitHub Desktop.
Apache Camel stop route when all file processed from the folder
from("file:{{csv.import.directory}}?sendEmptyMessageWhenIdle=true&include=.*.csv").routeId("route1")
.autoStartup(false)
.choice()
.when(body().isEqualTo(null))
.log("Stopping route")
.to("controlbus:route?async=true&routeId=route1&action=stop")
.otherwise()
.log("File with the following name processed: ${header.CamelFileName}")
.end()
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment