Hi Bruno, Your original question was: "Should I call a certain method in order to correctly build the Endpoint after setting the options ?". The answer to that is now.
On your disagreement, what James meant (I think) is that we could for instance do a better job at resetting an endpoint url, but that's not an easy task. We could for instance add all the parameters that change the default. Then you still have the problem of an uri for an endpoint that define a param with the same value as the default, so we'd have to strip those. We'd have to know what the default is, but we could use annotations for this. Or you could just add all the params on the logged uri, but then they can get fairly long. This is an inconsistency, but it wasn't reported as a major issue until now. You seem to think that this is a major issue, correct? Hadrian On Oct 28, 2010, at 9:59 AM, Bruno Dusausoy wrote: > 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.
