JPA consumer component is not handling multiple server concurrent polling

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JPA consumer component is not handling multiple server concurrent polling

teikitel
Hi,

I am running the same Camel application on four different servers and JPA camel component is not properly managing exclusive locks on polled rows. This is how we configured our route :

@Override
    public void configure() throws Exception {
        // @formatter:off
                from("jpa://Toto?lockModeType=PESSIMISTIC_READ"
                        + "&consumeDelete=false"
                                + "&consumeLockEntity=true"
                                + "&consumer.SkipLockedEntity=true"
                                + "&maximumResults=10"
                                + "&sharedEntityManager=true"
                                + "&joinTransaction=false"
                                + "&delay=200"
                                + "&consumer.query=select t from Toto t where t.consumed = 0")
                    .bean(totoAction, "consumeToto")
                    .process(exchange-> System.out.println(exchange.getIn().getBody()));
                // @formatter:on
    }

Inserting 20 rows at the same time while 2 servers are running the app causes some entities to be processed by both servers.

Do you know a nice work around to fix my problem ?

I can easily share you my sources if you need to reproduce it.

Thanks for this great framework,

Loic
Loading...