I have a rest service that sends messages to my queue, and these are routed to file:
from("test-jms:queue:test.queue").to("file://test");
Also, I have an event-driven consumer on the endpoint. For now this only writes to the log if a message is consumed:
final Consumer consumer = endpoint.createConsumer(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
String message = exchange.getIn().getBody(String.class);
LOG.info("Message processed: " + message);
}
});
This is all working fine. In the /test
folder I am getting a new file for every message I recieve, and additionally the consumer creates a marker file appended with .camelLock
. Using the readLock=none
option prevents the consumer from making these marker files, as expected.
However, neither the message files nor the marker files are deleted after consumption. Am I perhaps missing something in my consumer implementation?
When you manually create a consumer like that with an inlined processor, you need to manually done the UoW of the Exchange when you are done to trigger work that would delete/move the file etc.
exchange.getUnitOfWork().done(exchange);
You can also try wrapping your processor with the UnitOfWorkProducer
that should do the done of the UnitOfWork for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With