[ 
https://issues.apache.org/activemq/browse/CAMEL-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-2360:
-------------------------------

    Description: 
summary:
the bean gets intialized but it looks like the method retryUntil is never 
called, could it be an error of implementation? am I doing something wrong?

using following route:
{code}
from("jms-test:queue:queue.delivery.notification.test") 
.process(processor) 
.onException(Exception.class).retryUntil(bean("myRetryBean")).end() 
.recipientList(header("recipientListHeader").tokenize(",")) 
.parallelProcessing().executorService(customThreadPoolExecutor) 
.aggregationStrategy(new RecipientAggregationStrategy()) 
.to("direct:chunk.completed"); 
{code}

bean is registered in such way: 
{code}
JndiRegistry jndi = new JndiRegistry(new JndiContext()); 
jndi.bind("myRetryBean", new RetryBean()); 
{code}

bean class is: 
{code}
public class RetryBean { 

        private int _invoked; 
        private Logger _logger; 
        
    public RetryBean() { 
    this._logger = Logger.getLogger(RetryBean.class); 
    this._invoked = 0; 
    _logger.debug("BEAN INITIALIZED " + _invoked); 
    } 
        
    // using bean binding we can bind the information from the exchange to the 
types we have in our method signature 
    public boolean retryUntil(@Header(Exchange.REDELIVERY_COUNTER) Integer 
counter, @Body String body, @ExchangeException Exception causedBy) { 
        // NOTE: counter is the redelivery attempt, will start from 1 
    _invoked++; 
    
    
    _logger.debug("invoked" + _invoked); 
    _logger.debug("counter" + counter); 
    _logger.debug("result" + (counter < 2)); 
    
        // we can of course do what ever we want to determine the result but 
this is a unit test so we end after 3 attempts 
        return counter < 7; 
    } 
{code}


  was:
summary:
the bean gets intialized but it looks like the method retryUntil is never 
called, could it be an error of implementation? am I doing something wrong?

using following route:
from("jms-test:queue:queue.delivery.notification.test") 
.process(processor) 
.onException(Exception.class).retryUntil(bean("myRetryBean")).end() 
.recipientList(header("recipientListHeader").tokenize(",")) 
.parallelProcessing().executorService(customThreadPoolExecutor) 
.aggregationStrategy(new RecipientAggregationStrategy()) 
.to("direct:chunk.completed"); 


bean is registered in such way: 
JndiRegistry jndi = new JndiRegistry(new JndiContext()); 
jndi.bind("myRetryBean", new RetryBean()); 


bean class is: 
public class RetryBean { 

        private int _invoked; 
        private Logger _logger; 
        
    public RetryBean() { 
    this._logger = Logger.getLogger(RetryBean.class); 
    this._invoked = 0; 
    _logger.debug("BEAN INITIALIZED " + _invoked); 
    } 
        
    // using bean binding we can bind the information from the exchange to the 
types we have in our method signature 
    public boolean retryUntil(@Header(Exchange.REDELIVERY_COUNTER) Integer 
counter, @Body String body, @ExchangeException Exception causedBy) { 
        // NOTE: counter is the redelivery attempt, will start from 1 
    _invoked++; 
    
    
    _logger.debug("invoked" + _invoked); 
    _logger.debug("counter" + counter); 
    _logger.debug("result" + (counter < 2)); 
    
        // we can of course do what ever we want to determine the result but 
this is a unit test so we end after 3 attempts 
        return counter < 7; 
    } 






> recipientList retryUntil not working
> ------------------------------------
>
>                 Key: CAMEL-2360
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2360
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Marco Crivellaro
>            Assignee: Claus Ibsen
>
> summary:
> the bean gets intialized but it looks like the method retryUntil is never 
> called, could it be an error of implementation? am I doing something wrong?
> using following route:
> {code}
> from("jms-test:queue:queue.delivery.notification.test") 
> .process(processor) 
> .onException(Exception.class).retryUntil(bean("myRetryBean")).end() 
> .recipientList(header("recipientListHeader").tokenize(",")) 
> .parallelProcessing().executorService(customThreadPoolExecutor) 
> .aggregationStrategy(new RecipientAggregationStrategy()) 
> .to("direct:chunk.completed"); 
> {code}
> bean is registered in such way: 
> {code}
> JndiRegistry jndi = new JndiRegistry(new JndiContext()); 
> jndi.bind("myRetryBean", new RetryBean()); 
> {code}
> bean class is: 
> {code}
> public class RetryBean { 
>         private int _invoked; 
>         private Logger _logger; 
>         
>     public RetryBean() { 
>     this._logger = Logger.getLogger(RetryBean.class); 
>     this._invoked = 0; 
>     _logger.debug("BEAN INITIALIZED " + _invoked); 
>     } 
>         
>     // using bean binding we can bind the information from the exchange to 
> the types we have in our method signature 
>     public boolean retryUntil(@Header(Exchange.REDELIVERY_COUNTER) Integer 
> counter, @Body String body, @ExchangeException Exception causedBy) { 
>         // NOTE: counter is the redelivery attempt, will start from 1 
>     _invoked++; 
>     
>     
>     _logger.debug("invoked" + _invoked); 
>     _logger.debug("counter" + counter); 
>     _logger.debug("result" + (counter < 2)); 
>     
>         // we can of course do what ever we want to determine the result but 
> this is a unit test so we end after 3 attempts 
>         return counter < 7; 
>     } 
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to