...
The consumer needs to be consuming from an endpoint so we grab the endpoint from Camel we want to consume. It's file://target/subfolder
. Don't be fooled this endpoint doesn't have to 100% identical to the producer, i.e. the endpoint we used in the previous part to create and store the files. We could change the URL to include some options, and to make it more clear that it's possible we setup a delay value to 10 seconds, and the first poll starts after 2 seconds. This is done by adding ?consumer.delay=10000&consumer.initialDelay=2000
to the URL.
...
Then we prepare our integration to run with or without the consumer enabled. We do this to separate the route into the two parts:
- receive the webservice, transform and save mail file and return OK as repose
- the consumer that listen for mail files and send them as emails
So we change the constructor code a bit:
...
From part 1 to 3 we touched concepts such as::
- Endpoint
- URI configuration
- Consumer
- Producer
- Event Driven Consumer
- Component
- CamelContext
- ProducerTemplate
- Processor
- Type Converter