0

I need to save the details of my route in DB including the details between each patterns in camel route . I planned to use intercept (which will be defined in my CamelContext so all routes will in the context will be intercepted before each pattern process) to save details in DB. But as I understood this will impact my applications performance as routes will be intercepted before each pattern processing.Is there any way to make intercept in camel to process parallel? As another way I thought about using WireTap pattern in apache camel but I can't define it in context level So while writing every route I would need to explicitly write the WireTap pattern.This is little bit hectic as I am trying to reduce the complexity of developers who write the routes.As they only need to write routes and the other things that are needed will be done via what I defined in the CamelContext .Is there any way to write WireTap at context level and not in route level?. Or some one please help with any other way which will help me to make this possible

Thanks in advance

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
Abhi
  • 101
  • 6

1 Answers1

0

Intercept with seda or try global OnCompletion

You could use intercept to call separate seda endpoint which is basically fire and forget asynchronous version of direct.

You could also try using global OnCompletion to get message history from complete exchanges.

But to be honest all this will affect performance and increase complexity for developers.

JMX

More conventional way to monitor routes would be to use jmx or jmx through jolokia. This allows you to monitor your camel application(s) using external application that could even access the application remotely. For example your spring application(s) might run in container(s) and so you could have another container to monitor all these applications and write data to your database.

Through jmx you could call your route to dumpRouteAsXml() to form a route diagram you mentioned here then you could poll dumpRouteStatsAsXml(true, true) periodically to get bunch of information about the route and each of its endpoint like endpoint id and exchangesCompleted that you can use in your database.

This doesn't require any changes to routes, but needs one to provide JVM some parameters to enable JVM, possibly some authentication and SSL configurations for security depending on the environment and some camel dependencies. Much of this can be done with project templates, docker images however.

Maven dependencies

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-management</artifactId>
  <version>${camel.version}</version>
</dependency>

<!-- For Camel 3.x Spring boot -->
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-jmx-starter</artifactId>
    <version>${camel.version}</version>
</dependency>

<!-- For Camel 2.x Spring boot -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-jmx-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
Pasi Österman
  • 2,002
  • 1
  • 6
  • 13