...
The Tracer uses standard JPA configuration for setting the database. In the META-INF/persistence.xml
file we setup the service unit and the database configuration as: Wiki Markup JpaTraceEventMessage
as a class in the persistence.xml
file to register our data model:
...
...
In this example we use Hibernate JPA and a HSQLDB as database.
...
Here we show running with Maven:
...
When the application starts it start:
...
When the program was started a GUI application was started as well. Its a SQL prompt for the database. So try entering:
...
...
And it should return the list of trace events in the SQL.
We enter this SQL:
...
...
and get the output as the picture below:
...
In Camel you need to configure it to use JPA for tracing. We do this as by adding a tracer in the META-INF/camel-context.mxl
file: Wiki Markup
...
In this example we set the destintation to refer to an endpoint defined in the camel context: Wiki Markup org.apache.camel.processor.interceptor.JpaTraceEventMessage
as entity name and the persistenceUnit
as an option. In out example we use tracer.
Then the following is standard Spring JPA configuration: Wiki Markup persistenceUnitName
to the same unit name we defined in persistence.xml
, such as tracer
as we are using in this example.
And if you are wondering how the Camel route is defined then its here: Wiki Markup