Discussion:
Camel Tracer
Ercan Canlıer
2018-08-29 17:02:10 UTC
Permalink
Hi,
I am using the latest version of *Apache Camel, 2.22.0.*
I have seen that tracer is deprecated so far. However, the docs say that we
are able to enable tracing by setting the boolean value
*camelContext.setTracing(true)*
I configured the CAMEL_MESSAGETRACED entity to be auto scanned by spring
and the table is created successfully but there is no record in the
database.
I didn't even see tracing logs.
What is the best way to do this? If tracer is deprecated, which interceptor
should be used?
That was really helpful to get whatever you request and get response
through routes.
Thanks,
Best regards,
Ercan CANLIER
Claus Ibsen
2018-08-30 07:00:18 UTC
Permalink
Hi

Since you mention CAMEL_MESSAGETRACED then I assume you are talking
about the camel-jpa component has a tracer JPA interceptor.

There is some bits of documentation on this at
http://camel.apache.org/tracer-example.html

To make this work, you need to configure the JPA part and whatnot
correctly, so I suggest to look at the doc, and also you can find some
details by looking into the unit tests of camel-jpa.
Post by Ercan Canlıer
Hi,
I am using the latest version of *Apache Camel, 2.22.0.*
I have seen that tracer is deprecated so far. However, the docs say that we
are able to enable tracing by setting the boolean value
*camelContext.setTracing(true)*
I configured the CAMEL_MESSAGETRACED entity to be auto scanned by spring
and the table is created successfully but there is no record in the
database.
I didn't even see tracing logs.
What is the best way to do this? If tracer is deprecated, which interceptor
should be used?
That was really helpful to get whatever you request and get response
through routes.
Thanks,
Best regards,
Ercan CANLIER
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Ercan Canlıer
2018-09-08 06:38:19 UTC
Permalink
Thanks Claus for the answer. I tried to configure the tracer but no luck.
I asked also a question on StackOverflow and here is the details.
On the other hand, what is the preferred way to audit? To write your own
interceptor or logging mechanism?
Apache Camel does not have any audit mechanism with the latest version?
There is also BacklogTracer but i am confused with the components.
If none of them works, i will write my own interceptor or try to send each
message to wire i guess.

After all, my current situation is like below:
I am using the latest version of *Apache Camel 2.22.0*.
The tracer is deprecated at the moment. However, according to the
documentation, we can use it.
In order to store messages, i am using camel-jpa and facing with the
following exception. I have already set camel tracing for the context to
true but didn't work.
*Exception:*

[DEBUG] 2018-09-06 10:29:00.093 [scheduler_Worker-1]
TransactionTemplate - Initiating transaction rollback on application
exception
javax.persistence.TransactionRequiredException: no transaction is in progress
at org.hibernate.internal.SessionImpl.checkTransactionNeeded(SessionImpl.java:3467)
~[hibernate-core-5.2.12.Final.jar:5.2.12.Final]
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1427)
~[hibernate-core-5.2.12.Final.jar:5.2.12.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1423)
~[hibernate-core-5.2.12.Final.jar:5.2.12.Final]
at org.apache.camel.component.jpa.JpaProducer$2.doInTransaction(JpaProducer.java:246)
~[camel-jpa-2.22.0.jar:2.22.0]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
[spring-tx-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at org.apache.camel.component.jpa.JpaProducer.processEntity(JpaProducer.java:209)
[camel-jpa-2.22.0.jar:2.22.0]
at org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:161)
[camel-jpa-2.22.0.jar:2.22.0]
at org.apache.camel.processor.interceptor.DefaultTraceEventHandler.traceExchange(DefaultTraceEventHandler.java:118)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.interceptor.TraceInterceptor.traceExchange(TraceInterceptor.java:309)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:167)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:406)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:176)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:220)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:101)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:114)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:181)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:220)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:183)
[camel-spring-2.22.0.jar:2.22.0]
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:36)
[spring-tx-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
[spring-tx-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:176)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:136)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:105)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:114)
[camel-spring-2.22.0.jar:2.22.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:44)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.processor.loadbalancer.LoadBalancerSupport.process(LoadBalancerSupport.java:97)
[camel-core-2.22.0.jar:2.22.0]
at org.apache.camel.component.quartz2.CamelJob.execute(CamelJob.java:58)
[camel-quartz2-2.22.0.jar:2.22.0]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
[quartz-2.3.0.jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
[quartz-2.3.0.jar:?]<br/>

*Code:*

@Override
public void configure() {
camelContext.setTracing(true);
from(CamelComponent.QUARTZ2 + COLON + DOUBLE_SLASH + timerName
+ QUESTION_MARK + "cron=" + cronExpression)
.transacted()
.to(CamelComponent.SQL + COLON + sqlFile)
.bean(mapper, "map")
.bean(xStreamWriter, "toXml")
.to(buildFileUrl());
}<br/>

What might be the possible cause? It somehow does not work with the
transactions.
Thanks in advance,
Best regards,
Ercan
Post by Ercan Canlıer
Hi,
I am using the latest version of *Apache Camel, 2.22.0.*
I have seen that tracer is deprecated so far. However, the docs say that
we are able to enable tracing by setting the boolean value
*camelContext.setTracing(true)*
I configured the CAMEL_MESSAGETRACED entity to be auto scanned by spring
and the table is created successfully but there is no record in the
database.
I didn't even see tracing logs.
What is the best way to do this? If tracer is deprecated, which
interceptor should be used?
That was really helpful to get whatever you request and get response
through routes.
Thanks,
Best regards,
Ercan CANLIER
--
Ercan CANLIER
Loading...