You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Doug Douglass <do...@gmail.com> on 2009/06/18 21:11:02 UTC

configure SEDA URI/options with Spring PropertyPlaceholderConfigurer?

I'd like to move some SEDA endpoint options out of the Camel XML
configuration and into a Spring PropertyPlaceholderConfigurer, but I'm
struggling a bit.

Here's a snip of the current Camel XML with the URIs I'm trying to configure
marked with "-->":

<camelContext>
    <route>
      <from uri="timer://poller?period=300000" />
      <to uri="bean:customerChangeEventService?methodName=getEvents" />
      <splitter>
        <el>${in.body}</el>
        <idempotentConsumer messageIdRepositoryRef="eventIdRepository">
          <el>${in.body.eventId}</el>
-->      <to uri="seda:customerChangeEvent?size=6000" />
        </idempotentConsumer>
      </splitter>
      <onException>
        <exception>java.lang.Throwable</exception>
        <to uri="seda:eventProcessingErrors"/>
      </onException>
    </route>

    <route>
-->  <from uri="seda:customerChangeEvent?size=6000" />
      ...
    </route>

    ...
</camelContext>

In practice, the configuration may also include the concurrentConsumers
option.

Optimistically, I configured a PropertyPlaceholderConfigurer and tried
changing the URIs to
"seda:customerChangeEvent?size=${camel.customer.event.queue.size}", but the
property isn't replaced, and camel complains when it tries to
convert ${camel.customer.event.queue.size} into an integer.

Now I'm struggling trying to configure/instantiate a SedaComponent directly
via Spring beans XML.

Any pointers to examples?

Anyone care to provide a quick example?

If it helps, this project is using Camel 1.6.1.

TIA,
Doug

Re: configure SEDA URI/options with Spring PropertyPlaceholderConfigurer?

Posted by Doug Douglass <do...@gmail.com>.
Thanks for the links Willem. I hadn't seen/used the endpoint element before
-- it seems like a much "cleaner" solution than the one I had arrived at.
Cheers!

On Sat, Jun 20, 2009 at 9:56 PM, Willem Jiang <wi...@gmail.com>wrote:

> Sorry , I forgot to past the FAQ URL before click the send button.
>
> Here is the link.
> [1]
>
> http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html
>
> Willem
>
> Willem Jiang wrote:
> > Thanks for sharing the solution with us.
> > Current Camel doesn't support the Spring PropertyPlaceHolderConfigurer.
> > Here is a FAQ[1] for this, we will support it with coming up Spring 3.0.
> >
> > Willem
> >
> > Doug Douglass wrote:
> >> Well, I've got something working, but it doesn't quite feel like "The
> Camel
> >> Way":
> >> <beans:bean id="_sedaComponent"
> >> class="org.apache.camel.component.seda.SedaComponent">
> >> <beans:property name="camelContext" ref="camel" />
> >> </beans:bean>
> >>
> >> <beans:bean id="customerEventQueue" factory-bean="_sedaComponent"
> >> factory-method="createEndpoint">
> >> <beans:constructor-arg
> >>
> value="seda:customerChangeEvent?size=${camel.customer.event.queue.size}&amp;concurrentConsumers=${camel.customer.event.queue.concurrentConsumers}"
> >> />
> >> <beans:constructor-arg value="" />
> >> <beans:constructor-arg>
> >> <beans:map>
> >> <beans:entry key="size" value="${camel.customer.event.queue.size}" />
> >> <beans:entry key="concurrentConsumers"
> >> value="${camel.customer.event.queue.concurrentConsumers}" />
> >> </beans:map>
> >> </beans:constructor-arg>
> >> </beans:bean>
> >>
> >>
> >> Comments/suggestions are definitely welcome!
> >>
> >> Doug
> >>
> >> On Thu, Jun 18, 2009 at 1:11 PM, Doug Douglass <douglass.doug@gmail.com
> >wrote:
> >>
> >>> I'd like to move some SEDA endpoint options out of the Camel XML
> >>> configuration and into a Spring PropertyPlaceholderConfigurer, but I'm
> >>> struggling a bit.
> >>>
> >>> Here's a snip of the current Camel XML with the URIs I'm trying to
> >>> configure marked with "-->":
> >>>
> >>> <camelContext>
> >>>     <route>
> >>>       <from uri="timer://poller?period=300000" />
> >>>       <to uri="bean:customerChangeEventService?methodName=getEvents" />
> >>>       <splitter>
> >>>         <el>${in.body}</el>
> >>>         <idempotentConsumer messageIdRepositoryRef="eventIdRepository">
> >>>           <el>${in.body.eventId}</el>
> >>> -->      <to uri="seda:customerChangeEvent?size=6000" />
> >>>         </idempotentConsumer>
> >>>       </splitter>
> >>>       <onException>
> >>>         <exception>java.lang.Throwable</exception>
> >>>         <to uri="seda:eventProcessingErrors"/>
> >>>       </onException>
> >>>     </route>
> >>>
> >>>     <route>
> >>> -->  <from uri="seda:customerChangeEvent?size=6000" />
> >>>       ...
> >>>     </route>
> >>>
> >>>     ...
> >>> </camelContext>
> >>>
> >>> In practice, the configuration may also include the concurrentConsumers
> >>> option.
> >>>
> >>> Optimistically, I configured a PropertyPlaceholderConfigurer and tried
> >>> changing the URIs to
> >>> "seda:customerChangeEvent?size=${camel.customer.event.queue.size}", but
> the
> >>> property isn't replaced, and camel complains when it tries to
> >>> convert ${camel.customer.event.queue.size} into an integer.
> >>>
> >>> Now I'm struggling trying to configure/instantiate a SedaComponent
> directly
> >>> via Spring beans XML.
> >>>
> >>> Any pointers to examples?
> >>>
> >>> Anyone care to provide a quick example?
> >>>
> >>> If it helps, this project is using Camel 1.6.1.
> >>>
> >>> TIA,
> >>> Doug
> >>>
> >
> >
>
>

Re: configure SEDA URI/options with Spring PropertyPlaceholderConfigurer?

Posted by Willem Jiang <wi...@gmail.com>.
Sorry , I forgot to past the FAQ URL before click the send button.

Here is the link.
[1]
http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html

Willem

Willem Jiang wrote:
> Thanks for sharing the solution with us.
> Current Camel doesn't support the Spring PropertyPlaceHolderConfigurer.
> Here is a FAQ[1] for this, we will support it with coming up Spring 3.0.
> 
> Willem
> 
> Doug Douglass wrote:
>> Well, I've got something working, but it doesn't quite feel like "The Camel
>> Way":
>> <beans:bean id="_sedaComponent"
>> class="org.apache.camel.component.seda.SedaComponent">
>> <beans:property name="camelContext" ref="camel" />
>> </beans:bean>
>>
>> <beans:bean id="customerEventQueue" factory-bean="_sedaComponent"
>> factory-method="createEndpoint">
>> <beans:constructor-arg
>> value="seda:customerChangeEvent?size=${camel.customer.event.queue.size}&amp;concurrentConsumers=${camel.customer.event.queue.concurrentConsumers}"
>> />
>> <beans:constructor-arg value="" />
>> <beans:constructor-arg>
>> <beans:map>
>> <beans:entry key="size" value="${camel.customer.event.queue.size}" />
>> <beans:entry key="concurrentConsumers"
>> value="${camel.customer.event.queue.concurrentConsumers}" />
>> </beans:map>
>> </beans:constructor-arg>
>> </beans:bean>
>>
>>
>> Comments/suggestions are definitely welcome!
>>
>> Doug
>>
>> On Thu, Jun 18, 2009 at 1:11 PM, Doug Douglass <do...@gmail.com>wrote:
>>
>>> I'd like to move some SEDA endpoint options out of the Camel XML
>>> configuration and into a Spring PropertyPlaceholderConfigurer, but I'm
>>> struggling a bit.
>>>
>>> Here's a snip of the current Camel XML with the URIs I'm trying to
>>> configure marked with "-->":
>>>
>>> <camelContext>
>>>     <route>
>>>       <from uri="timer://poller?period=300000" />
>>>       <to uri="bean:customerChangeEventService?methodName=getEvents" />
>>>       <splitter>
>>>         <el>${in.body}</el>
>>>         <idempotentConsumer messageIdRepositoryRef="eventIdRepository">
>>>           <el>${in.body.eventId}</el>
>>> -->      <to uri="seda:customerChangeEvent?size=6000" />
>>>         </idempotentConsumer>
>>>       </splitter>
>>>       <onException>
>>>         <exception>java.lang.Throwable</exception>
>>>         <to uri="seda:eventProcessingErrors"/>
>>>       </onException>
>>>     </route>
>>>
>>>     <route>
>>> -->  <from uri="seda:customerChangeEvent?size=6000" />
>>>       ...
>>>     </route>
>>>
>>>     ...
>>> </camelContext>
>>>
>>> In practice, the configuration may also include the concurrentConsumers
>>> option.
>>>
>>> Optimistically, I configured a PropertyPlaceholderConfigurer and tried
>>> changing the URIs to
>>> "seda:customerChangeEvent?size=${camel.customer.event.queue.size}", but the
>>> property isn't replaced, and camel complains when it tries to
>>> convert ${camel.customer.event.queue.size} into an integer.
>>>
>>> Now I'm struggling trying to configure/instantiate a SedaComponent directly
>>> via Spring beans XML.
>>>
>>> Any pointers to examples?
>>>
>>> Anyone care to provide a quick example?
>>>
>>> If it helps, this project is using Camel 1.6.1.
>>>
>>> TIA,
>>> Doug
>>>
> 
> 


Re: configure SEDA URI/options with Spring PropertyPlaceholderConfigurer?

Posted by Willem Jiang <wi...@gmail.com>.
Thanks for sharing the solution with us.
Current Camel doesn't support the Spring PropertyPlaceHolderConfigurer.
Here is a FAQ[1] for this, we will support it with coming up Spring 3.0.

Willem

Doug Douglass wrote:
> Well, I've got something working, but it doesn't quite feel like "The Camel
> Way":
> <beans:bean id="_sedaComponent"
> class="org.apache.camel.component.seda.SedaComponent">
> <beans:property name="camelContext" ref="camel" />
> </beans:bean>
> 
> <beans:bean id="customerEventQueue" factory-bean="_sedaComponent"
> factory-method="createEndpoint">
> <beans:constructor-arg
> value="seda:customerChangeEvent?size=${camel.customer.event.queue.size}&amp;concurrentConsumers=${camel.customer.event.queue.concurrentConsumers}"
> />
> <beans:constructor-arg value="" />
> <beans:constructor-arg>
> <beans:map>
> <beans:entry key="size" value="${camel.customer.event.queue.size}" />
> <beans:entry key="concurrentConsumers"
> value="${camel.customer.event.queue.concurrentConsumers}" />
> </beans:map>
> </beans:constructor-arg>
> </beans:bean>
> 
> 
> Comments/suggestions are definitely welcome!
> 
> Doug
> 
> On Thu, Jun 18, 2009 at 1:11 PM, Doug Douglass <do...@gmail.com>wrote:
> 
>> I'd like to move some SEDA endpoint options out of the Camel XML
>> configuration and into a Spring PropertyPlaceholderConfigurer, but I'm
>> struggling a bit.
>>
>> Here's a snip of the current Camel XML with the URIs I'm trying to
>> configure marked with "-->":
>>
>> <camelContext>
>>     <route>
>>       <from uri="timer://poller?period=300000" />
>>       <to uri="bean:customerChangeEventService?methodName=getEvents" />
>>       <splitter>
>>         <el>${in.body}</el>
>>         <idempotentConsumer messageIdRepositoryRef="eventIdRepository">
>>           <el>${in.body.eventId}</el>
>> -->      <to uri="seda:customerChangeEvent?size=6000" />
>>         </idempotentConsumer>
>>       </splitter>
>>       <onException>
>>         <exception>java.lang.Throwable</exception>
>>         <to uri="seda:eventProcessingErrors"/>
>>       </onException>
>>     </route>
>>
>>     <route>
>> -->  <from uri="seda:customerChangeEvent?size=6000" />
>>       ...
>>     </route>
>>
>>     ...
>> </camelContext>
>>
>> In practice, the configuration may also include the concurrentConsumers
>> option.
>>
>> Optimistically, I configured a PropertyPlaceholderConfigurer and tried
>> changing the URIs to
>> "seda:customerChangeEvent?size=${camel.customer.event.queue.size}", but the
>> property isn't replaced, and camel complains when it tries to
>> convert ${camel.customer.event.queue.size} into an integer.
>>
>> Now I'm struggling trying to configure/instantiate a SedaComponent directly
>> via Spring beans XML.
>>
>> Any pointers to examples?
>>
>> Anyone care to provide a quick example?
>>
>> If it helps, this project is using Camel 1.6.1.
>>
>> TIA,
>> Doug
>>
> 


Re: configure SEDA URI/options with Spring PropertyPlaceholderConfigurer?

Posted by Doug Douglass <do...@gmail.com>.
Well, I've got something working, but it doesn't quite feel like "The Camel
Way":
<beans:bean id="_sedaComponent"
class="org.apache.camel.component.seda.SedaComponent">
<beans:property name="camelContext" ref="camel" />
</beans:bean>

<beans:bean id="customerEventQueue" factory-bean="_sedaComponent"
factory-method="createEndpoint">
<beans:constructor-arg
value="seda:customerChangeEvent?size=${camel.customer.event.queue.size}&amp;concurrentConsumers=${camel.customer.event.queue.concurrentConsumers}"
/>
<beans:constructor-arg value="" />
<beans:constructor-arg>
<beans:map>
<beans:entry key="size" value="${camel.customer.event.queue.size}" />
<beans:entry key="concurrentConsumers"
value="${camel.customer.event.queue.concurrentConsumers}" />
</beans:map>
</beans:constructor-arg>
</beans:bean>


Comments/suggestions are definitely welcome!

Doug

On Thu, Jun 18, 2009 at 1:11 PM, Doug Douglass <do...@gmail.com>wrote:

> I'd like to move some SEDA endpoint options out of the Camel XML
> configuration and into a Spring PropertyPlaceholderConfigurer, but I'm
> struggling a bit.
>
> Here's a snip of the current Camel XML with the URIs I'm trying to
> configure marked with "-->":
>
> <camelContext>
>     <route>
>       <from uri="timer://poller?period=300000" />
>       <to uri="bean:customerChangeEventService?methodName=getEvents" />
>       <splitter>
>         <el>${in.body}</el>
>         <idempotentConsumer messageIdRepositoryRef="eventIdRepository">
>           <el>${in.body.eventId}</el>
> -->      <to uri="seda:customerChangeEvent?size=6000" />
>         </idempotentConsumer>
>       </splitter>
>       <onException>
>         <exception>java.lang.Throwable</exception>
>         <to uri="seda:eventProcessingErrors"/>
>       </onException>
>     </route>
>
>     <route>
> -->  <from uri="seda:customerChangeEvent?size=6000" />
>       ...
>     </route>
>
>     ...
> </camelContext>
>
> In practice, the configuration may also include the concurrentConsumers
> option.
>
> Optimistically, I configured a PropertyPlaceholderConfigurer and tried
> changing the URIs to
> "seda:customerChangeEvent?size=${camel.customer.event.queue.size}", but the
> property isn't replaced, and camel complains when it tries to
> convert ${camel.customer.event.queue.size} into an integer.
>
> Now I'm struggling trying to configure/instantiate a SedaComponent directly
> via Spring beans XML.
>
> Any pointers to examples?
>
> Anyone care to provide a quick example?
>
> If it helps, this project is using Camel 1.6.1.
>
> TIA,
> Doug
>