0

I am new to Camel and am looking for patterns or strategies to manage the availability of a target system in a Camel route.

For example, say I want: - to read input data from an file server - process the data (data -> targetData) - to send the target data (TargetData) to a target web site using Rest services (call it TargetSystem)

My question is what is the best strategy if the TargetSytem is down?

I understand that if a route fails it is possible to rollback the overall process. But in case TargetSystem is an external system and can be down for hours, I don't think trying to rollback the process untill the target system is up is a good approach.

Is there any pattern or strategy that fits well with this issue?

Regards

Gilles

Gilles
  • 357
  • 3
  • 20

1 Answers1

0

This is the pattern I use with a couple of systems.

  • Persist your TargetData somewhere (Database table, JMS queue, Redis, ...)
  • Create a route that reads unsent TargetData and sends it to TargetSystem
    • If transfer is OK, mark TargetData accordingly (eg: set a flag in the table row, remove from Queue, etc...)
  • Trigger such route periodically from a timer and/or other routes. You can even trigger it with a shell command to manually "force" a resend of unsent data.

You can customize this to your needs and for example add logging where appropriate, keep track in a DB table when each tentative send occurs, how many times it failed, how many retries and so on...

You can now modularize your application in 2 modules: one that receives Data and process it to TargetData and another that manages the transfer of TargetData to TargetSystem.
Module can mean 2 CamelContextes, 2 OSGi bundles, 2 totally separate Java applications.

Alessandro Da Rugna
  • 4,571
  • 20
  • 40
  • 64