Unable to call "direct" route used by REST DSL from separate route

Solution Verified - Updated -

Issue

  • Given a the following (example) route definition where both the REST route and a separate route (Route02) try to call the same direct endpoint (direct:hello):

    <camel>
        <rest id="Rest01">
            <post path="/rest01">
                <to uri="direct:hello" />
            </post>
        </rest>
        <route id="Route01">
            <from uri="direct:hello" />
            <setBody>
                <simple>Hello ${body}</simple>
            </setBody>
            <log message="R01: ${body}" />
        </route>
        <route id="Route02">
            <from uri="timer:Route02?period=2000" />
            <setBody>
                <simple>Hello</simple>
            </setBody>
            <log message="R02: ${body}" />
            <to uri="direct:hello" />
        </route>
    </camel>
    

    An error like the following occurs from Route02 when it tries to call direct:hello:

    Failed delivery for (<message>). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: direct://hello.
    
  • How to call a "direct" endpoint that is used by a REST route from another route?

Environment

  • Red Hat build of Apache Camel 4.5+

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content