質問

I have the following interesting situation. I have one path with three verbs: GET, DELETE, POST. They correspond to three routes in Camel context. My observation is that if the three routes are in the same Camel Context, every works well. But if the routes are in different camel contexts, only one of them works. So far, I noticed that DELETE wworks and the two others stop working. My example context is below:

<camel:camelContext  id="get-test" autoStartup="true">

        <camel:route>
            <camel:from uri="restlet:/path?restletMethod=DELETE"></camel:from>
            <camel:transform>
                <camel:constant>Hi Delete</camel:constant>
             </camel:transform>
        </camel:route>
        <camel:route>
            <camel:from uri="restlet:/path?restletMethod=GET"></camel:from>
            <camel:transform>
                <camel:constant>Hi Get</camel:constant>
             </camel:transform>
        </camel:route>
        <camel:route>
            <camel:from uri="restlet:/path?restletMethod=POST"></camel:from>
            <camel:transform>
                <camel:constant>Hi Post</camel:constant>
             </camel:transform>
        </camel:route>
</camel:camelContext>

So, the above is the working scenario. The scenario that does not work is below with three different contexts:

<camel:camelContext  id="delete-test" autoStartup="true">

        <camel:route>
            <camel:from uri="restlet:/path?restletMethod=DELETE"></camel:from>
            <camel:transform>
                <camel:constant>Hi Delete</camel:constant>
             </camel:transform>
        </camel:route>
</camel:camelContext>

<camel:camelContext  id="get-test" autoStartup="true">

        <camel:route>
            <camel:from uri="restlet:/path?restletMethod=GET"></camel:from>
            <camel:transform>
                <camel:constant>Hi Get</camel:constant>
             </camel:transform>
        </camel:route>

</camel:camelContext>

<camel:camelContext  id="post-test" autoStartup="true">


        <camel:route>
            <camel:from uri="restlet:/path?restletMethod=POST"></camel:from>
            <camel:transform>
                <camel:constant>Hi Post</camel:constant>
             </camel:transform>
        </camel:route>
</camel:camelContext>

Maybe I am missing something in the camel spec that forbid this kind of configuration?

役に立ちましたか?

解決

Yes this is not supported. The logic that selects the route to process the message only uses the context path as part of the logic.

Not sure how easy it would be to add restletMethod as well as part of that selection logic. Feel free to log a JIRA ticket, and dive into the code to contribute. We love contributions: http://camel.apache.org/contributing

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top