On Tue, May 13, 2008 at 10:03 AM, James Strachan
<[EMAIL PROTECTED]> wrote:
> Another thing I've wanted for a while is for folks who like using
> spring.xml to configure things, a nicer way to create endpoint
> instances in the spring.xml.
>
> I raised a JIRA to track this...
> https://issues.apache.org/activemq/browse/CAMEL-505
>
> I've added a bunch more constructors so most endpoints are a bit
> easier to create as a stand alone bean (without necessarily using the
> component as a factory) and a little example of it in use - see
> SpringFileRouteTest.java.
> http://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java
>
> the spring XML is here
> http://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileRouteTest-context.xml
>
>
> I've tinkered with the File endpoint so that it can be created with no
> constructor parameters then configured via properties which makes it a
> bit easier to work with in spring.xml.
>
> Its gonna be a bit of work to extend this to all endpoints. Plus some
> endpoints will require a component too. Its gonna be even harder to
> then add the endpoints into the XSD easily (without loads of error
> prone hand coding), so that we can do things like
>
> <fileEndpoint file="/tmp/foo" noop="true"/>
> <jmsQueueEndpoint destination="foo.bar"/>
>

I think what would be ideal is the components implemented spring
namespace handlers so that we could do stuff like:

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>
    <template id="camelTemplate"/>

    <route>
      <from ref="inputFile"/>
        <to uri="activemq:foo"/>
    </route>
  </camelContext>

  <activemq:component brokerUrl="tcp://foo:61616">
    <endpoint name="foo" file="queue:foo/>
  </activemq:component>

  <file:component>
    <endpoint name="inputFile" file="target/test-default-inbox"/>
  </file:component>


Not sure about the element names.. having them standardize to
component / endpoint  might be confusing to folks but it would make
the configuration look more consistent across components.  And yeah
each component would need it's own namespace definition which make
setting up xml a bit hard if your using alot of components...
Thoughts?

-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Open Source SOA
http://open.iona.com

Reply via email to