How do I force an event-driven consumer in Apache Camel to delete expended messages?

I have a recreation service that sends messages to my queue and they are redirected to a file:

from("test-jms:queue:test.queue").to("file://test");

In addition, the end user has an event driven. So far this is only logged if the 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);
        }
    });

Everything is working fine. In the folder, /testI get a new file for each message I receive, and the consumer also creates a marker file added with .camelLock. Using the option readLock=nonedoes not allow the consumer to create these marker files as expected.

However, neither message files nor marker files are deleted after consumption. Is it possible that I lost something in my consumer implementation?

+4
2

, , , UnitOfWork (UoW). :

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);

        ConsumerTemplate consumerTemplate = camelContext.createConsumerTemplate();
        consumerTemplate.doneUoW(exchange);
    }
});

, delete=true:

Endpoint endpoint = camelContext.getEndpoint("file://test?delete=true");
+3

, UoW Exchange, , / ..

exchange.getUnitOfWork().done(exchange);

UnitOfWorkProducer, UnitOfWork.

+3

All Articles