Discussion:
Camel spring DSL validaiton
Gandhi, Vineet
2018-11-20 09:49:37 UTC
Permalink
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
2018-11-20 10:46:34 UTC
Permalink
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
Post by Gandhi, Vineet
Hi,
I have a use case where clients can send route xml files to my service which I add to camelContext
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
Gandhi, Vineet
2018-11-21 06:30:25 UTC
Permalink
Hi Zoran,

Thanks for prompt reply.
This works for me.

Regards,
Vineet

On 20/11/18, 4:17 PM, "Zoran Regvart" <***@regvart.com> 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
Post by Gandhi, Vineet
Hi,
I have a use case where clients can send route xml files to my service which I add to camelContext
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 th

Loading...