On Tue, Dec 27, 2022 at 9:14 PM Burcu Egri <burcu.e...@aerlingus.com.invalid> wrote:
> Thank you, Claus, for this important caution but we didn't notice this in > Camel documentation. > We are newly developing our projects with Camel, and it is important for > us to use most promising ways. > Which DSL is most valuable for future use cases? > Is there any roadmap for Camel? I found some old roadmaps. > > Camel v4 will be posted as a blog next month. And there is JIRA which has fix-version assigned to tickets so you can follow what comes in next release(s). > My other question is about your DLQ route suggestion. > We found a way for logging in errorHandler by using onPrepareFailureRef > attribute. > Which way is good a new DLQ route or onPrepareFailureRef? > > onPrepare is very good, but it requires you to write a Camel Java processor and do the logging via java code. A route allows you to use Camel DSL and you can do a lot more. But its often overkill, and you also should keep the route small and simple as you want to ensure the message gets routed to the DLQ. > Thanks again, > Burcu > > -----Original Message----- > From: Claus Ibsen <claus.ib...@gmail.com> > Sent: Tuesday, December 27, 2022 3:44 PM > To: users@camel.apache.org > Subject: Re: Camel errorHandler doesn't log before or after sending > message to the dead letter channel > > CAUTION: This email originated from outside of the organisation. Do not > click links or open attachments unless you recognise the sender and know > the content is safe. > > > Hi > > Just a caution that using camel-spring-xml with Spring XML is becoming > legacy/deprecated. > It is the very old XML DSL in Camel v1/v2. > > So what you can do is to use a route as DLQ that uses direct where you can > then do > > from direct myDLQ > log bla blah > to jms:dead > > And then configure the error handler to use direct myDLQ > > Then you can do anything you like in the route > > > On Tue, Dec 27, 2022 at 12:58 PM Burcu Egri <burcu.e...@aerlingus.com.invalid> > wrote: > > > Hi, > > Thank you for your reply... > > > > Yes, I refer the <log> inside errorHandler. > > Do you mean that > > org.apache.camel.spring.xml.handler.ErrorHandlerDefinitionParser.doPar > > se > > should parse <log>? > > > > I checked your suggestions, but the first 2 parameters are related > > with the redeliveryPolicy and our aim is to log just after errorHandler > started. > > In the future we are planning to remove redeliveryPolicy part... > > > > I tried to set logName attribute in errorHandler but I am getting > > below error message. > > > > Caused by: org.springframework.beans.NotWritablePropertyException: > > Invalid property 'logName' of bean class > > [org.apache.camel.builder.LegacyDeadLetterChannelBuilder]: 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? > > > > In addition to this I tried to set name from Java inside > > CamelContextConfiguration. beforeApplicationStart > > camelContext.getGlobalOptions().put(Exchange.LOG_EIP_NAME, " > > com.mypackage "); > > > > but I am not sure how to set message because <log> is not parsed in > > errorHandler. We need to find a way to set log message. > > > > Do you have any other suggestion? > > > > Best regards, > > Burcu > > > > -----Original Message----- > > From: Claus Ibsen <claus.ib...@gmail.com> > > Sent: Tuesday, December 27, 2022 1:44 PM > > To: users@camel.apache.org > > Subject: Re: Camel errorHandler doesn't log before or after sending > > message to the dead letter channel > > > > CAUTION: This email originated from outside of the organisation. Do > > not click links or open attachments unless you recognise the sender > > and know the content is safe. > > > > > > Hi > > > > If you refer to <log> > > > > <log id="logIncomingMsg" logName="com.mypackage" > > loggingLevel="ERROR" message="Pushing to backout > > queue"/> > > > > As something that is supposed to be parsed by that spring code, then > > that is not. > > The <log> is Log EIP and not really part of the error handler. > > > > The following options is what configures how "verbose" the error > > handler is when it executes and what it logs > > > > retryAttemptedLogLevel="WARN" > > retriesExhaustedLogLevel="ERROR"/> > > > > You can use logName to use a custom logger instead of the default > > > > <camel:errorHandler id="myErrorHandler" type="DeadLetterChannel" > > useOriginalBody="true" > > logName="xxxx" > > deadLetterUri="jms:queue:mybackoutq"> > > > > > > > > > > On Tue, Dec 27, 2022 at 11:35 AM Burcu Egri > > <burcu.e...@aerlingus.com.invalid> > > wrote: > > > > > After some investigation in Apache-Camel sources, we see that parser > > > do not parse log line in errorHandler section (see > > > https://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi > > > th > > > ub.com%2Fapache%2Fcamel%2Fblob%2Fmain%2Fcomponents%2Fcamel-spring-xm > > > l% > > > 2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcamel%2Fspring%2Fxml%2Fhandler% > > > 2F > > > ErrorHandlerDefinitionParser.java%23L77&data=05%7C01%7CBurcu.Egri%40 > > > ae > > > rlingus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9ad > > > ef > > > 72b859bc5c0%7C0%7C0%7C638077346559845038%7CUnknown%7CTWFpbGZsb3d8eyJ > > > WI > > > joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000 > > > %7 > > > C%7C%7C&sdata=fIYP0Tn5BAOOBt26v3YSpMkTNcCHZs5QGDhYuuhPKXk%3D&reserve > > > d= > > > 0] > > > ). > > > > > > It seems it is a bug. > > > > > > Are there anybody to confirm this bug? > > > > > > -----Original Message----- > > > From: Burcu Egri <burcu.e...@aerlingus.com.INVALID> > > > Sent: Tuesday, December 27, 2022 12:28 AM > > > To: users@camel.apache.org > > > Subject: Camel errorHandler doesn't log before or after sending > > > message to the dead letter channel > > > > > > CAUTION: This email originated from outside of the organisation. Do > > > not click links or open attachments unless you recognise the sender > > > and know the content is safe. > > > > > > > > > We have a simple Camel route like below. But we have noticed that > > > errorHandler log is not working. After some investigation, we > > > understood that errorHandler has different log parameters then other > > > logs(like in route or onException). > > > > > > We haven't succeeded to use errorHandler log. Yes, there are so many > > > options to log but we want to learn how to use this one. Our aim is > > > to log some texts before or after sending messages to deadletter queue. > > > How can we use errorHandler log? > > > > > > apache-camel : 3.19.0 > > > > > > spring-boot : 2.7.5 > > > > > > <beans xmlns=" > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww > > > .s%2F&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7C6e72746ec2fa43869b > > > db08dae80805ee%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C63807741 > > > 8405187878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM > > > zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uwo8INIjYylV > > > 2SNY111fo0xFXRIMbu3jOSlAKouR5rI%3D&reserved=0 > > > pringframework.org%2Fschema%2Fbeans&data=05%7C01%7CBurcu.Egri%40aerl > > > in > > > gus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72 > > > b8 > > > 59bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjo > > > iM > > > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C% > > > 7C > > > %7C&sdata=yGykqDG7w4AqrLqfXYQEYHvjypP1ptoIxkE30nHFY3Q%3D&reserved=0 > > > " > > > xmlns:xsi=" > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww > > > .w%2F&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7C6e72746ec2fa43869b > > > db08dae80805ee%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C63807741 > > > 8405187878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM > > > zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=btkr%2FGW4Kn > > > 8V9q5BgMJmoOauwfmnltbd1GSDbQG0gsI%3D&reserved=0 > > > 3.org%2F2001%2FXMLSchema-instance&data=05%7C01%7CBurcu.Egri%40aerlin > > > gu > > > s.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b8 > > > 59 > > > bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM > > > C4 > > > wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C > > > %7 > > > C&sdata=fi8vX7Ux0XJCExlRN%2F187r0zaVmZwNF1oMD6waMcoMw%3D&reserved=0 > > > " > > > xmlns:camel=" > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcam > > > el > > > .apache.org%2Fschema%2Fspring&data=05%7C01%7CBurcu.Egri%40aerlingus. > > > co > > > m%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b859bc > > > 5c > > > 0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL > > > jA > > > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C& > > > sd > > > ata=PpfTX%2BBYwEZIPEb41ld4f9Ot8GNN0sopA0czE2LBnHU%3D&reserved=0 > > > " > > > xsi:schemaLocation=" > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww > > > .s%2F&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7C6e72746ec2fa43869b > > > db08dae80805ee%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C63807741 > > > 8405187878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM > > > zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uwo8INIjYylV > > > 2SNY111fo0xFXRIMbu3jOSlAKouR5rI%3D&reserved=0 > > > pringframework.org%2Fschema%2Fbeans&data=05%7C01%7CBurcu.Egri%40aerl > > > in > > > gus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72 > > > b8 > > > 59bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjo > > > iM > > > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C% > > > 7C > > > %7C&sdata=yGykqDG7w4AqrLqfXYQEYHvjypP1ptoIxkE30nHFY3Q%3D&reserved=0 > > > > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww > > > .s%2F&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7C6e72746ec2fa43869b > > > db08dae80805ee%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C63807741 > > > 8405187878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM > > > zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uwo8INIjYylV > > > 2SNY111fo0xFXRIMbu3jOSlAKouR5rI%3D&reserved=0 > > > pringframework.org%2Fschema%2Fbeans%2Fspring-beans.xsd&data=05%7C01% > > > 7C > > > Burcu.Egri%40aerlingus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf > > > 76 > > > 36536c46bf9adef72b859bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7C > > > TW > > > FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVC > > > I6 > > > Mn0%3D%7C3000%7C%7C%7C&sdata=DdZ3l1f%2BMP2WWWYX%2FmICXJaCeNHPhge4FRl > > > Ui > > > 1A5w9w%3D&reserved=0 > > > > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcam > > > el > > > .apache.org%2Fschema%2Fspring&data=05%7C01%7CBurcu.Egri%40aerlingus. > > > co > > > m%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b859bc > > > 5c > > > 0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL > > > jA > > > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C& > > > sd > > > ata=PpfTX%2BBYwEZIPEb41ld4f9Ot8GNN0sopA0czE2LBnHU%3D&reserved=0 > > > > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcam > > > el > > > .apache.org%2Fschema%2Fspring%2Fcamel-spring.xsd&data=05%7C01%7CBurcu. > > > Egri%40aerlingus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf763653 > > > 6c > > > 46bf9adef72b859bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbG > > > Zs > > > b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% > > > 3D > > > %7C3000%7C%7C%7C&sdata=7pQoV7gMmG%2FSHuCcL8VmuRuySIqJF90UbZiOiJjGaNw > > > %3 > > > D&reserved=0 > > > "> > > > > > > <bean id="mdcEnricher" class="com.mycompany.MDCEnricher"/> > > > > > > <camel:camelContext id="mycontext" xmlns=" > > > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel > > .apache.org%2Fschema%2Fspring&data=05%7C01%7CBurcu.Egri%40aerlingus.co > > m%7C6e72746ec2fa43869bdb08dae80805ee%7C57bf7636536c46bf9adef72b859bc5c > > 0%7C0%7C0%7C638077418405187878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA > > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sd > > ata=U9QrXdGqJSnCRA9ilJyjpGUdBYKUE8irEHE8DV8Hv08%3D&reserved=0 > > " > > > useMDCLogging="true"> > > > > > > <camel:errorHandler id="myErrorHandler" > type="DeadLetterChannel" > > > useOriginalBody="true" > > > deadLetterUri="jms:queue:mybackoutq"> > > > <redeliveryPolicy > > > maximumRedeliveries="1" > > > redeliveryDelay="1" > > > retryAttemptedLogLevel="WARN" > > > retriesExhaustedLogLevel="ERROR"/> > > > <log id="logIncomingMsg" logName="com.mypackage" > > > loggingLevel="ERROR" message="Pushing to backout queue"/> > > > </camel:errorHandler> > > > > > > > > > <camel:route id="myRoute" errorHandlerRef="myErrorHandler"> > > > <from uri="jms:queue:myinputq"/> > > > <bean ref="mdcEnricher" method="enrich"/> > > > <log message="Received exchange with message id: > > > [${headers.JMSMessageID}], starting processing"/> > > > <process ref="#class:com.mycompany.processor.MyProcessor"/> > > > <to uri="jms:queue:myoutputq"/> > > > <log message="Finished the processing exchange with > > > message > > > id: [${headers.JMSMessageID}]"/> > > > </camel:route> > > > > > > Try to change log configuration and loggingLevel to DEBUG but > > > nothing changed. > > > > > > <springProfile name="local"> > > > <logger name="org.apache.camel" level="DEBUG"/> > > > <logger name="com.mycompany" level="DEBUG"/> > > > <root level="DEBUG"> > > > <appender-ref ref="LocalConsole"/> > > > </root> > > > </springProfile> > > > > > > > > > -- > > Claus Ibsen > > ----------------- > > @davsclaus > > Camel in Action 2: > > https://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww. > > manning.com%2Fibsen2&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7C6e727 > > 46ec2fa43869bdb08dae80805ee%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0 > > %7C638077418405187878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQ > > IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IWkuY > > ZcxX3dRaDERfufXTg01Hl%2F7kpZ6Ie%2BIglL1ji0%3D&reserved=0 > > > > > -- > Claus Ibsen > ----------------- > @davsclaus > Camel in Action 2: > https://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.manning.com%2Fibsen2&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7C6e72746ec2fa43869bdb08dae80805ee%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638077418405187878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IWkuYZcxX3dRaDERfufXTg01Hl%2F7kpZ6Ie%2BIglL1ji0%3D&reserved=0 > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2