Neron
Neron

Reputation: 1578

Interrupt camel route flow based on a condition

I have an application and two application servers. I deployed the same application to each of my application server but I also made them run as active-passive. To do this, I am using a lock.

Now I am coding my application with apache camel. In route, I want my code to be intercepted by a control which looks up a that if the lock released or not. According to the result, route will go on or not.

How can I do this with xml definition of camel?

Upvotes: 2

Views: 1316

Answers (1)

Petter Nordlander
Petter Nordlander

Reputation: 22279

There is a <stop/> tag you can use.

<choice>
    <when>
        <simple>${bean:controller?method=isLocked} eq 'true'</simple>
        <stop/>
    </when>
    <otherwise>
        <to uri="direct:continueProcessing"/>
    </otherwise>
</choice>

Upvotes: 1

Related Questions