You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pratibhaG <pr...@finicity.com> on 2010/03/17 14:11:26 UTC

How to fix code which was working in camel 1.4 but now not in 2.1.0

Hi all,

I have following configuration in my camel component which I use in
servicemix3.3.1. I have upgraded my camel component in servicemix to 2.1.0.
When I try to build this custom operation I get error for following methods:
 1. deadLetterChannel
 2. intercept
 3. initialRedeliveryDelay

There was also for method exception which now I have changed to onException.
But for above how should I move ahead? What are the alternative methods in
2.1.0 so that the functionality does not break. 

My requirement is that if my message flow fails during the path due to any
other exception than connection then reply back with system error. If the
exception is Connection exception then try redelivery of message with
exponential delay starting with 5 seconds end at 1 hour. 

How to achieve it in 2.1.0

Please help......

package com.in2m.servicemix.operations.updateprofile;

import org.apache.camel.builder.RouteBuilder;

import com.in2m.servicemix.common.errorhandling.CustomDelegateProcessor;
import com.in2m.servicemix.common.errorhandling.ErrorConstants;


public class MessageRouting extends RouteBuilder {

    public void configure() {
    	
    	errorHandler(deadLetterChannel().maximumRedeliveryDelay(3600000L));
    	
    	onException(java.lang.Throwable.class)
        .intercept(new
CustomDelegateProcessor(ErrorConstants.SYSTEM_ERROR));                
       
    	onException(java.net.SocketException.class)
        .maximumRedeliveries(5)
        .useExponentialBackOff()
        .initialRedeliveryDelay(300000L)
        .backOffMultiplier(2.0)
        .intercept(new
CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));
            
       
from("jbi:service:http://servicemix.in2m.com/operations/updateprofile/RoutingService")
       
.to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/JMSProviderService?mep=in-only")
       
.to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/ResponseGeneratorService?mep=in-out");
       
       
from("jbi:service:http://servicemix.in2m.com/operations/updateprofile/DirectorConsumerService")
       
.setHeader(ErrorConstants.APPLICATION_NAME,constant("DirectorService"))
        .intercept(new CustomDelegateProcessor())         
       
.to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/DirectorService?mep=in-out");
       
       
from("jbi:service:http://servicemix.in2m.com/operations/updateprofile/PortalConsumerService")
       
.setHeader(ErrorConstants.APPLICATION_NAME,constant("PortalService"))
        .intercept(new CustomDelegateProcessor())     
       
.to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/PortalService?mep=in-out");
    }
}

Thanks,
Pratibha

-- 
View this message in context: http://old.nabble.com/How-to-fix-code-which-was-working-in-camel-1.4-but-now-not-in-2.1.0-tp27931823p27931823.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to fix code which was working in camel 1.4 but now not in 2.1.0

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

You could consider professional support to help with your upgrade as
upgrading SMX 3.x to use a Camel 2.x may not be that easy.
SMX 4.2 is the only officially that uses Camel 2.x.

Otherwise the compiler will help you with the change of method names
etc in the RouteBuilder.

And instead of intercept just use a process which is what you are
actually doing.


On Wed, Mar 17, 2010 at 2:11 PM, pratibhaG
<pr...@finicity.com> wrote:
>
> Hi all,
>
> I have following configuration in my camel component which I use in
> servicemix3.3.1. I have upgraded my camel component in servicemix to 2.1.0.
> When I try to build this custom operation I get error for following methods:
>  1. deadLetterChannel
>  2. intercept
>  3. initialRedeliveryDelay
>
> There was also for method exception which now I have changed to onException.
> But for above how should I move ahead? What are the alternative methods in
> 2.1.0 so that the functionality does not break.
>
> My requirement is that if my message flow fails during the path due to any
> other exception than connection then reply back with system error. If the
> exception is Connection exception then try redelivery of message with
> exponential delay starting with 5 seconds end at 1 hour.
>
> How to achieve it in 2.1.0
>
> Please help......
>
> package com.in2m.servicemix.operations.updateprofile;
>
> import org.apache.camel.builder.RouteBuilder;
>
> import com.in2m.servicemix.common.errorhandling.CustomDelegateProcessor;
> import com.in2m.servicemix.common.errorhandling.ErrorConstants;
>
>
> public class MessageRouting extends RouteBuilder {
>
>    public void configure() {
>
>        errorHandler(deadLetterChannel().maximumRedeliveryDelay(3600000L));
>
>        onException(java.lang.Throwable.class)
>        .intercept(new
> CustomDelegateProcessor(ErrorConstants.SYSTEM_ERROR));
>
>        onException(java.net.SocketException.class)
>        .maximumRedeliveries(5)
>        .useExponentialBackOff()
>        .initialRedeliveryDelay(300000L)
>        .backOffMultiplier(2.0)
>        .intercept(new
> CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));
>
>
> from("jbi:service:http://servicemix.in2m.com/operations/updateprofile/RoutingService")
>
> .to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/JMSProviderService?mep=in-only")
>
> .to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/ResponseGeneratorService?mep=in-out");
>
>
> from("jbi:service:http://servicemix.in2m.com/operations/updateprofile/DirectorConsumerService")
>
> .setHeader(ErrorConstants.APPLICATION_NAME,constant("DirectorService"))
>        .intercept(new CustomDelegateProcessor())
>
> .to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/DirectorService?mep=in-out");
>
>
> from("jbi:service:http://servicemix.in2m.com/operations/updateprofile/PortalConsumerService")
>
> .setHeader(ErrorConstants.APPLICATION_NAME,constant("PortalService"))
>        .intercept(new CustomDelegateProcessor())
>
> .to("jbi:service:http://servicemix.in2m.com/operations/updateprofile/PortalService?mep=in-out");
>    }
> }
>
> Thanks,
> Pratibha
>
> --
> View this message in context: http://old.nabble.com/How-to-fix-code-which-was-working-in-camel-1.4-but-now-not-in-2.1.0-tp27931823p27931823.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus