Camel spring DSL validaiton

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel spring DSL validaiton

Gandhi, Vineet
Hi,

I have a use case where clients can send route xml files to my service which I add to camelContext

Code for adding route looks like :

public void createRoute(InputStream xmlRouteDefinition) throws Exception {



              RoutesDefinition routesDefinition = camelContext.loadRoutesDefinition(xmlRouteDefinition);

              camelContext.addRouteDefinitions(routesDefinition.getRoutes());

       }

Client can pass the following routes too –

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="route13" autoStartup="false">
    <from uri="anystring:start13"/>
    <to uri="aaaaaaaaaaa:result13"/>
</route>
</routes>

Is there any way of validating whether the components and their corresponding URI’s are correctly passed without calling the startRoute API in DefaultCamelContext?

Regards,
Vineet


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
Reply | Threaded
Open this post in threaded view
|

Re: Camel spring DSL validaiton

Zoran Regvart-2
Hi Vineet,
you could gather all `RouteDefinition` objects from that
`RoutesDefinition` you get from `CamelContext::loadRoutesDefinition`,
use `RouteDefinitionHelper::gatherAllEndpointUris` to fetch all
endpoint URIs of that `RouteDefinition` and then try to resolve those
endpoints via `CamelContextHelper::getMandatoryEndpoint`.

Not sure if there is a more straightforward way of doing that,

zoran
On Tue, Nov 20, 2018 at 10:51 AM Gandhi, Vineet <[hidden email]> wrote:

>
> Hi,
>
> I have a use case where clients can send route xml files to my service which I add to camelContext
>
> Code for adding route looks like :
>
> public void createRoute(InputStream xmlRouteDefinition) throws Exception {
>
>
>
>               RoutesDefinition routesDefinition = camelContext.loadRoutesDefinition(xmlRouteDefinition);
>
>               camelContext.addRouteDefinitions(routesDefinition.getRoutes());
>
>        }
>
> Client can pass the following routes too –
>
> <?xml version="1.0" encoding="UTF-8"?>
> <routes xmlns="http://camel.apache.org/schema/spring">
> <route id="route13" autoStartup="false">
>     <from uri="anystring:start13"/>
>     <to uri="aaaaaaaaaaa:result13"/>
> </route>
> </routes>
>
> Is there any way of validating whether the components and their corresponding URI’s are correctly passed without calling the startRoute API in DefaultCamelContext?
>
> Regards,
> Vineet
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
> that any dissemination, distribution or copying of this e-mail is
> prohibited. If you have received this e-mail in error, please notify the
> sender by replying to this message and delete this e-mail immediately.



--
Zoran Regvart
Reply | Threaded
Open this post in threaded view
|

Re: Camel spring DSL validaiton

Gandhi, Vineet
Hi Zoran,

Thanks for prompt reply.
This works for me.

Regards,
Vineet

On 20/11/18, 4:17 PM, "Zoran Regvart" <[hidden email]> wrote:

    Hi Vineet,
    you could gather all `RouteDefinition` objects from that
    `RoutesDefinition` you get from `CamelContext::loadRoutesDefinition`,
    use `RouteDefinitionHelper::gatherAllEndpointUris` to fetch all
    endpoint URIs of that `RouteDefinition` and then try to resolve those
    endpoints via `CamelContextHelper::getMandatoryEndpoint`.
   
    Not sure if there is a more straightforward way of doing that,
   
    zoran
    On Tue, Nov 20, 2018 at 10:51 AM Gandhi, Vineet <[hidden email]> wrote:
    >
    > Hi,
    >
    > I have a use case where clients can send route xml files to my service which I add to camelContext
    >
    > Code for adding route looks like :
    >
    > public void createRoute(InputStream xmlRouteDefinition) throws Exception {
    >
    >
    >
    >               RoutesDefinition routesDefinition = camelContext.loadRoutesDefinition(xmlRouteDefinition);
    >
    >               camelContext.addRouteDefinitions(routesDefinition.getRoutes());
    >
    >        }
    >
    > Client can pass the following routes too –
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <routes xmlns="http://camel.apache.org/schema/spring">
    > <route id="route13" autoStartup="false">
    >     <from uri="anystring:start13"/>
    >     <to uri="aaaaaaaaaaa:result13"/>
    > </route>
    > </routes>
    >
    > Is there any way of validating whether the components and their corresponding URI’s are correctly passed without calling the startRoute API in DefaultCamelContext?
    >
    > Regards,
    > Vineet
    >
    >
    > This e-mail, including attachments, may include confidential and/or
    > proprietary information, and may be used only by the person or entity
    > to which it is addressed. If the reader of this e-mail is not the intended
    > recipient or his or her authorized agent, the reader is hereby notified
    > that any dissemination, distribution or copying of this e-mail is
    > prohibited. If you have received this e-mail in error, please notify the
    > sender by replying to this message and delete this e-mail immediately.
   
   
   
    --
    Zoran Regvart
   


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.