Quantcast
Channel: Gigaspaces XAP forum - RSS feed
Viewing all articles
Browse latest Browse all 1486

Throttling with circuit breaking in Camel

$
0
0
Is there a way to open circuit of a route until the aggregate batch transfer is complete? I have checked Camel's [route policy](http://camel.apache.org/routepolicy.html), but this works for a number of inflight exchanges. Also, I checked [RouteBuilder's source code](https://zgrepcode.com/apache-camel/2.23.1/org/apache/camel/builder/routebuilder.java) but looks like there is no such option. I have the following route: routeBuilders.add(new RouteBuilder() { @Override public void configure() throws Exception { from("rabbitmq://localhost:5672/abc?queue=a1&username=XXX&password=XXX&autoAck=false&durable=true&exchangeType=direct&autoDelete=false") .to("rabbitmq://locahost:5672/abc?queue=a2&username=XXX&password=XXX&autoAck=false&durable=true&exchangeType=direct&autoDelete=false"); } }); Now my use case is that I want to transfer 500 messages between these routes, and I use .throttle(500). But I also want to control that when the next batch of 500 messages should be routed. I want to route the next 500 messages only when the queue a2 becomes empty. For example, messages are getting routed from queue a1 to a2. Say 500 messages have been routed successfully, now I want to suspend (or open circuit) of my route so that it won't transfer messages any further until the queue a2 becomes empty (there is a consumer which is pulling messages from queue a2) Is there a way to achieve this in Apache Camel?

Viewing all articles
Browse latest Browse all 1486

Trending Articles