Search code examples
apache-camelspring-camelcamel-ftpcamel-sqlapache-camel-cdi

Apache Camel: Is creating multiple Routes costly operation?


Following is just requirement:

  1. Read from DB
  2. Create 3 files from data with only small setter addition on if statement
  3. Deliever 3 to same sftp

Coding:

1 Route Timer which to(direct)
1 Route trigger which call same (direct)
1 ROUTE - from(direct) then calls DB and fetches data and assign it to Bean and multicast to 3 transformation routes
3 routes - from(direct:transform) where similar transformation and ofr 3rd route a small different transformation and put to SFTP Route
1 Route to SFTP

This could be done in 3 routes only i.e timer route, trigger route and single route from 3 to last.

Just want to ask if Creating multiple route considered as costly operation where 50 project of similar types are deployed?


Solution

  • From a resource operation, it doesn't appear to make a huge difference. I've setup some scenarios that have many small routes, and some with larger routes. In general, the cost is in the work performed by the processors and such. And smaller routes are often more reusable (compose-able) and easier to test. So that's my preference, given that the performance doesn't seem impacted in any significant way.