[ https://issues.apache.org/jira/browse/CAMEL-5466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423119#comment-13423119 ]
Hadrian Zbarcea commented on CAMEL-5466: ---------------------------------------- That's because it took me all of 5 mins to write that :). I mentioned I see many ways to improve it. One I didn't mention is to use pass an Expression to the constructor of the TemplateRouteBuilder. That alone would address both your issues. My code has another limitation: it only supports one template. One simple improvement is support multiple templates (identified by a String). You can make a convention then that the first String in the array is the template id. There are other solutions, this is a simple one, probably the one I would go with. There's also the possibility of leaving one template per TemplateRouteBuilder and have TemplateBuilderCollection (or something). More than one way to skin a camel. You can have support for xml dsl as well. You'd only need to define your own namespace and reuse the camel xsd types. Implement a namespace handler for your namespace and use it to configure your templates. Something like: {code} <yourns:templates> <yourns:template> <camel:route ... /> </yourns:template> </yourns:templates> {code} Your solution would require a lot more work to become viable. It only supports polling consumers for once, but just by looking at the code, there are scenarios already supported by Camel that I don't think would work. Not that it can't be fixed, but it'll require work. As I said, not my approach to solving the problem you described. > new virtual endpoint component > ------------------------------ > > Key: CAMEL-5466 > URL: https://issues.apache.org/jira/browse/CAMEL-5466 > Project: Camel > Issue Type: Improvement > Affects Versions: 2.9.2 > Reporter: Ari Mando > Fix For: 2.9.3 > > Attachments: camel-virtual.tar.gz > > > I had the recurring need for a virtual endpoint in camel routes. Often I need > to define the same route, but just with different endpoint locations, > typically queues. > The supplied component allows for: > <route> > <from uri="virtual://source-queue?real=amq://@?"/> > <to uri="virtual://destination-queue?real=amq2://@?"/> > </route> > Then in a virtual.properties file: > *source-queue,destination-queue > queue1,queue4 > queue2,queue5 > queue3,queue6 > The above properties file would be like adding 3 routes. > The supplied impl is a bit rough, it needs some more work. The first cut was > sufficient for the usecase I needed it for. > I already thought it should be really like: > <virtual id="test" uri="file://queues.xml"> > <route> > <from uri="virtual://source-queue?real=amq://@?"/> > <to uri="virtual://destination-queue?real=amq2://@?"/> > </route> > </virtual> > then an xml file: > <endpointValues> > <header> > <value>source-queue</value> > <value>destination-queue</value> > </headers> > <entry> > <value>queue1,queue4</value> > <value>queue5,queue6</value> > </entry> > </endpointValues> > Using the DSL would allow multiple virtual routes with different config being > pulled from other camel endpoints. > Dynamic routing! Call it virtual routing or template routing. > Tasks to be finished on it: > * implement threading (concurrentConsumers) > * move to high level dsl model > * unit tests > * source configuration from enrichment uri call > * more robust error handling -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira