Camel - fetching queue entry from Oracle DB via JPA component and updating said entry on exception

304 views Asked by At

We want to use a table as virtual queue on our Oracle DB. The queue should be processed with Apache Camel using the JPA component. Each entry contains the name of a JMS queue to which a payload has to be forwarded. Processing the queue item and forwarding it to another consumer works fine but I was thinking about what should happen, when the queue which is named in the entry does not exist. The idea is that when an error occurs we are updating said entry so we see the error on the database and the entry is ignored for further processing until the error is solved. I was playing around with some ways to handle exceptions using spring-dsl and a processor to prepare the body for the jpa-component used to update the entry.

    <route id="db-to-jms">
        <from
            uri="jpa://foo.bar.jpa.QueueMessageOutEntity?delay=1000&amp;maximumResults=20&amp;namedQuery=orderedByPriority" />
        <doTry>
            <process ref="queueMessageOutProcessor" />
            <recipientList>
                <simple>direct:${header.queueName}</simple>
            </recipientList>
            <doCatch>
                <exception>org.apache.camel.component.direct.DirectConsumerNotAvailableException</exception>
                <handled><constant>true</constant></handled>
                <process ref="queueMessageOutErrorHandler" />
                <to uri="jpa://foo.bar.jpa.QueueMessageOutEntity" />
            </doCatch>
        </doTry>
    </route>

So what actually happens is that is seems to be trying to update the table but it does not continue processing the queue. I am assuming that there is still a lock on the entry or something. Anyway I am pretty sure I am not doing it right because if I understand it correctly it would try to delete the entry anyway assuming it would continue as it is supposed to.

Thanks.

0

There are 0 answers