You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by JacobS <ja...@gmail.com> on 2011/02/25 14:06:30 UTC

java DSL to spring DSL

Hi
I need some help converting some java DSL code to spring DSL

java code:

from(EndPointHelper.getURI("ComponentXTopic") + "&selector=COMPID='" +
PropertiesProvider.GetCompId() + "'") //
...
.onRedelivery(new RedeliveryProcessor())//
...
.end();

Thanks
Jacob
-- 
View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3400066.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java DSL to spring DSL

Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, Feb 27, 2011 at 2:06 PM, JacobS <ja...@gmail.com> wrote:
> Thanks, I will try the onRedeliveryRef.
>
> About the Properties component. I am using spring-dm and I am constantly
> getting an exception when camel tries to build the route because it cannot
> find the properties, I think it is because I am using osgi and the
> ConfigurationAdmin service is not yet available. Although it is more of an
> spring-dm question do you know how I can make spring wait for
> ConfigurationAdmin service to becomes available ?
>

No I don't.

For Camel 2.7 onwards Camel supports OSGi blueprint placeholders, so
that would work out of the box.
Even directly inside the routes. That of course requires you to use
OSGi blueprint instead of spring-dm.


> Jacob.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3402192.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: java DSL to spring DSL

Posted by JacobS <ja...@gmail.com>.
Thanks, I will try the onRedeliveryRef.

About the Properties component. I am using spring-dm and I am constantly
getting an exception when camel tries to build the route because it cannot
find the properties, I think it is because I am using osgi and the
ConfigurationAdmin service is not yet available. Although it is more of an
spring-dm question do you know how I can make spring wait for
ConfigurationAdmin service to becomes available ?

Jacob.

-- 
View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3402192.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java DSL to spring DSL

Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, Feb 27, 2011 at 10:40 AM, JacobS <ja...@gmail.com> wrote:
> Thanks for you reply,
>
> a. I will try out the property placeholders
>
> b. I didn't see an onRedelivery tag, how do I use onRedelivery in xml ?
>

Check the XML Schema. There is a onRedeliveryRef attribute to refer to
the processor by its spring <bean> id.
In fact it should be available on the <onException> so you can set it there



> Thanks
> Jacob
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3402066.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: java DSL to spring DSL

Posted by JacobS <ja...@gmail.com>.
Thanks for you reply,

a. I will try out the property placeholders

b. I didn't see an onRedelivery tag, how do I use onRedelivery in xml ?

Thanks 
Jacob

-- 
View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3402066.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java DSL to spring DSL

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

On Sat, Feb 26, 2011 at 6:41 PM, JacobS <ja...@gmail.com> wrote:
> Hi Claus, thanks for your help.
>
> My question is very basic ( I am new to spring )
>
>> from(EndPointHelper.getURI("ComponentXTopic") + "&selector=COMPID='" +
>> PropertiesProvider.GetCompId() + "'") //
>
> a. How do I create the xml's  "<camel:from uri=" so it will refer to values
> that are set at load-time (PropertiesProvider.GetCompId()) ?.
> In this case I want to add a selector to the uri with the component ID which
> will be created only at run-time.
>

Yeah thats a bit harder in XML because you dont have a real
programming language underneath. Its just XML.

If the PropertiesProvider is something thats reads from a .properties
file etc. Then you can use Camel's support for property placeholders
http://camel.apache.org/properties

You can also use Spring property placeholders, but mind this FAQ
http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html


> b. Is this correct :
> <camel:onException>
>    <camel:to uri="bean:redeliveryProcessor?method=process" />
> </camel:onException>
>
> How would camel know that the processor should be processed before a
> redelivery attempt ?
>

If you want to do some work before any redelivery attempt, you have to
use onRedelivery instead.
onException is being triggered AFTER all redeliveries (we call that
when its exhausted)




> Jacob
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3401588.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: java DSL to spring DSL

Posted by JacobS <ja...@gmail.com>.
Hi Claus, thanks for your help.

My question is very basic ( I am new to spring )

> from(EndPointHelper.getURI("ComponentXTopic") + "&selector=COMPID='" +
> PropertiesProvider.GetCompId() + "'") // 

a. How do I create the xml's  "<camel:from uri=" so it will refer to values
that are set at load-time (PropertiesProvider.GetCompId()) ?.
In this case I want to add a selector to the uri with the component ID which
will be created only at run-time.

b. Is this correct :
<camel:onException>
    <camel:to uri="bean:redeliveryProcessor?method=process" />
</camel:onException>

How would camel know that the processor should be processed before a
redelivery attempt ? 

Jacob

-- 
View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3401588.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java DSL to spring DSL

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

So where is your problem with the XML DSL?

For the onRedelivery you must use define the RedeliveryProcessor as a bean
<bean id="xxx" class="xxx"/>
And then refer to xxx.




On Fri, Feb 25, 2011 at 2:06 PM, JacobS <ja...@gmail.com> wrote:
>
> Hi
> I need some help converting some java DSL code to spring DSL
>
> java code:
>
> from(EndPointHelper.getURI("ComponentXTopic") + "&selector=COMPID='" +
> PropertiesProvider.GetCompId() + "'") //
> ...
> .onRedelivery(new RedeliveryProcessor())//
> ...
> .end();
>
> Thanks
> Jacob
> --
> View this message in context: http://camel.465427.n5.nabble.com/java-DSL-to-spring-DSL-tp3400066p3400066.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/