You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Sergey Zhemzhitsky (Created) (JIRA)" <ji...@apache.org> on 2011/12/09 13:58:39 UTC

[jira] [Created] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
----------------------------------------------------------------------------------------------

                 Key: CAMEL-4760
                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.8.3
            Reporter: Sergey Zhemzhitsky


The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.

{code:title=LoggingErrorHandler}
<errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
{code}

{code:title=DefaultErrorHandler}
<errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
{code}

{code:title=StackTrace}
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
	... 42 more
Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Claus Ibsen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-4760:
-------------------------------

      Component/s:     (was: camel-core)
                   camel-spring
         Priority: Minor  (was: Major)
    Fix Version/s: 2.9.0
                   2.8.4
       Issue Type: Improvement  (was: Bug)

This is working as designed. The logging error handler should only support the logName and level options.

I have improved the validation in camel-spring to better detect that.
                
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Sergey Zhemzhitsky (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166209#comment-13166209 ] 

Sergey Zhemzhitsky commented on CAMEL-4760:
-------------------------------------------

Here is the unit test that proves asyncDelayedRedelivery can be used with logging error handler.

{code:title=AsyncDelayedRedeliveryLogErrorHandlerTest.java}
package org.foo.bar;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.processor.RedeliveryPolicy;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

import javax.naming.Context;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

public class AsyncDelayedRedeliveryLogErrorHandlerTest extends CamelTestSupport {

    @Test
    public void asyncRedeliveryTimer() throws Exception {
        context().addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .to("seda:next?waitForTaskToComplete=Never&size=10");

                from("seda:next")
                    .errorHandler(loggingErrorHandler())
                    .onException(Exception.class)
                        .redeliveryPolicyRef("redeliveryPolicy")
                        .handled(true)
                        .to("mock:exception")
                    .end()
                    .process(new Processor() {
                        private AtomicInteger counter = new AtomicInteger();
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            if (counter.compareAndSet(1, 2)) {
                                exchange.setProperty("ThrowException", Boolean.TRUE);
                                exchange.getIn().setBody(counter.get() - 1);
                            } else {
                                exchange.getIn().setBody(counter.getAndIncrement());
                            }
                        }
                    })
                    .process(new Processor() {
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            if (Boolean.TRUE.equals(exchange.getProperty("ThrowException", Boolean.class))) {
                                exchange.removeProperty("ThrowException");
                                throw new RuntimeException("Test Exception!");
                            }
                        }
                    })
                    .to("mock:result");
            }
        });

        MockEndpoint result = getMockEndpoint("mock:result");
        result.expectedMessageCount(5);
        result.allMessages().property("ThrowException").isNull();

        // the 2nd sent message must be delivered 5th
        result.message(4).body().isEqualTo(1);
        // ensure there is no delay between the 1st and the 3rd sent messages
        result.message(1).arrives().noLaterThan(100).millis().afterPrevious();

        startCamelContext();

        for(int i = 0; i < 5; i++) {
            sendBody("direct:start", i);
        }

        assertMockEndpointsSatisfied(10, TimeUnit.SECONDS);
    }

    @Override
    protected Context createJndiContext() throws Exception {
        Context jndiContext = super.createJndiContext();

        RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
        redeliveryPolicy.setAsyncDelayedRedelivery(true);
        redeliveryPolicy.setMaximumRedeliveries(1);
        redeliveryPolicy.setRedeliveryDelay(5000);
        jndiContext.bind("redeliveryPolicy", redeliveryPolicy);

        return jndiContext;
    }

    @Override
    public boolean isUseRouteBuilder() {
        return false;
    }

}
{code}

Please take a loot at assertions:

{code}
// the 2nd sent message must be delivered 5th
result.message(4).body().isEqualTo(1);
// ensure there is no delay between the 1st and the 3rd sent messages
result.message(1).arrives().noLaterThan(100).millis().afterPrevious();
{code}

The 2nd sent message is delivered 5th because of redelivery and the 2nd delivered message which is equal to 3rd sent message arrives no later than 100 millis after the first delivered message although _redeliveryDelay_ is equal to 5 seconds. That means I can configure async. redelivery with logging error handler, so I have two questions:

# If I can configure async. redelivery with logging error handler why I cannot specify custom executor service, although logging error handler extends default error handler?
# Is it possible to specify logName for default error handler, because it seems that spring dsl does not allow to specify logName for loggers although java dsl does?
                
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Claus Ibsen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4760.
--------------------------------

    Resolution: Fixed
    
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166195#comment-13166195 ] 

Claus Ibsen commented on CAMEL-4760:
------------------------------------

No the logging error handler does *not* support all those redelivery settings etc. It can only log.
                
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Sergey Zhemzhitsky (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166186#comment-13166186 ] 

Sergey Zhemzhitsky commented on CAMEL-4760:
-------------------------------------------

Hi Claus,

>> The logging error handler should only support the logName and level options.

As I understand I can configure redeliveryPolicy with asyncDelayedRedelivery for logging error handler and according to the [documentation|http://camel.apache.org/exception-clause.html#ExceptionClause-Asynchronousdelayedredelivery] for asyncDelayedRedelivery a custom executor service can be configured.
                
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Claus Ibsen (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-4760:
----------------------------------

    Assignee: Claus Ibsen
    
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Sergey Zhemzhitsky (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167386#comment-13167386 ] 

Sergey Zhemzhitsky edited comment on CAMEL-4760 at 12/12/11 7:12 AM:
---------------------------------------------------------------------

Hello Claus,

Thanks a lot for clarification, but I'm still wondering how to use _onException_ and custom executor service at the same time.
What I need is async. redelivery + logging every redelivery attempt using custom logName and logLevel.

I have tried to use DefaultErrorHandler, but Spring DSL does not allow to specify custom logName, although Java DSL does.
Here is an exception:

{code}
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'logName' of bean class [org.apache.camel.builder.DefaultErrorHandlerBuilder]: Bean property 'logName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowire
{code}


                
      was (Author: szhemzhitsky):
    Hello Clause,

Thanks a lot for clarification, but I'm still wondering how to use _onException_ and custom executor service at the same time.
What I need is async. redelivery + logging every redelivery attempt using custom logName and logLevel.

I have tried to use DefaultErrorHandler, but Spring DSL does not allow to specify custom logName, although Java DSL does.
Here is an exception:

{code}
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'logName' of bean class [org.apache.camel.builder.DefaultErrorHandlerBuilder]: Bean property 'logName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowire
{code}


                  
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Sergey Zhemzhitsky (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167386#comment-13167386 ] 

Sergey Zhemzhitsky commented on CAMEL-4760:
-------------------------------------------

Hello Clause,

Thanks a lot for clarification, but I'm still wondering how to use _onException_ and custom executor service at the same time.
What I need is async. redelivery + logging every redelivery attempt using custom logName and logLevel.

I have tried to use DefaultErrorHandler, but Spring DSL does not allow to specify custom logName, although Java DSL does.
Here is an exception:

{code}
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'logName' of bean class [org.apache.camel.builder.DefaultErrorHandlerBuilder]: Bean property 'logName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowire
{code}


                
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167394#comment-13167394 ] 

Claus Ibsen commented on CAMEL-4760:
------------------------------------

The logging error handler is not for logging redelivery attempts and stacktraces etc. All it can do is log the failed *message*, not the cause of the problem etc.

What you are asking for is to configure the log name on the redelivery based error handlers.
You can configure many options about which level to use and whether to log stack traces etc.

See the API
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/RedeliveryPolicy.html

What is missing is to configure the log name, as Camel will currently always use the class name of the error handler implementation.
                
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4760) Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166227#comment-13166227 ] 

Claus Ibsen commented on CAMEL-4760:
------------------------------------

The logging error handler is suppose to be a simple logger. The LoggingErrorHandlerBuilder does not offer any DSL for setting redelivery etc.
So you can only set the logName and log level on the loggingErrorHandler() in the DSL.

What you do is to configure redelivery settings using onException which supports that.
                
> Unable to set logName on DefaultErrorHandler as well as executorService on LoggingErrorHandler
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4760
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4760
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.8.3
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.4, 2.9.0
>
>
> The following snippets do not work, although each of the specified error handlers supports _logName_ and _executorServiceRef_. The issue is actual for the _DeadLetterChannel_ error handler too.
> {code:title=LoggingErrorHandler}
> <errorHandler id="errorHandler" type="LoggingErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=DefaultErrorHandler}
> <errorHandler id="errorHandler" type="DefaultErrorHandler" logName="${router.logger.name}" executorServiceRef="redeliveryExecutor"/>
> {code}
> {code:title=StackTrace}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camel-context.xml]; nested exception is java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:186)
> 	... 42 more
> Caused by: java.lang.IllegalArgumentException: Attribute executorServiceRef is not supported by error handler type: LoggingErrorHandler, in error handler with id: errorHandler
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira