On Thu, 28 Oct 2010 09:34:54 +0100, James Strachan
<[email protected]> wrote:
[...]
>
> The only real difference is the 2nd version you specify the URI; the
> first case the URI is auto-generated. Typically the auto-generated
> URIs don't necessarily know which properties to add to the URI as
> query arguments (as many properties have smart defaults etc).
>
> You can always set the URI you want it to look like in log statements
> if you want; but typically its the same Endpoint object being used
> under the covers; so its more a logging issue rather than a
> functionality issue.
>
> e.g. you could replace...
>
> FileEndpoint input = new FileEndpoint();
>
> with
>
> FileEndpoint input = new FileEndpoint("file://c:/post?delete=true",
> new FileComponent());
>
> to get the same logging output
Well, I'm sorry but I tend to disagree about the problem being only a
logging issue.
Indeed, consider another simple example :
public class FileRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
from("file://c:/post?noop=true").to("file://c:/backup");
from("file://c:/post?readLock=none&delete=true").to("file://c:/backup2");
}
}
It works fine (even if there are better ways to express this, but
that's out of scope) :
[...]
INFO: Route: route1 started and consuming from:
Endpoint[file://c:/post?noop=true]
28 oct. 2010 10:59:02 org.apache.camel.impl.DefaultCamelContext start
INFO: Route: route2 started and consuming from:
Endpoint[file://c:/post?delete=true&readLock=none]
28 oct. 2010 10:59:02 org.apache.camel.impl.DefaultCamelContext start
INFO: Started 2 routes
[...]
But, when expressing the same programmatically :
public class FileRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
FileEndpoint input = new FileEndpoint();
input.setCamelContext(getContext());
input.setFile(new File("c:/post"));
input.setNoop(true);
FileEndpoint input2 = new FileEndpoint();
input2.setCamelContext(getContext());
input2.setFile(new File("c:/post"));
input2.setReadLock("none");
input2.setDelete(true);
FileEndpoint output = new FileEndpoint();
output.setCamelContext(getContext());
output.setFile(new File("c:/backup"));
FileEndpoint output2 = new FileEndpoint();
output2.setCamelContext(getContext());
output2.setFile(new File("c:/backup2"));
from(input).to(output);
from(input2).to(output2);
}
}
I get this exception :
Exception in thread "main"
org.apache.camel.FailedToStartRouteException: Failed to start route
route2 because of Multiple consumers for the same endpoint is not
allowed: Endpoint[file://c:\post]
So it seems options are really not taken into account, hence my
original question.
Regards.
--
Bruno Dusausoy
YP5 Software
--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.