Sounds like you're programming in your routes rather than integrating processes/systems. I think the simplest solution would be using feature flags in choice blocks.
On Sat, Apr 17, 2021 at 8:00 AM ski n <raymondmees...@gmail.com> wrote: > > Hi all, > > I have a question how to load (add or remove) route steps dynamically with > Java/Java DSL. > > For example, I have a route with around 20 steps. The users can configure > which steps are used and which not. > > Now the creating of the route has the following steps: > > 1) Write code (Java DSL) > 2) Compile code > 3) Load (Add) Route > 4) Start Route > 5) Run Route > > I have the option to write multiple routes and load the route based on user > preferences. But this is not desirable because I need to maintain tens of > routes (instead of a few). The other possibility is that I add a choice > step and let it happen in runtime (but this takes unneeded performance, as > it already known on load if these steps are needed or not. > > What are my options of add/remove steps on loading a route? > > Things I came up with (but I am not sure if they are possible): > > 1) Change from Java to XML and manipulate the XML (Preferable not) > > 2) Add construction in route to load or not. For example: > > split("mySplit").loadStep(true/false) > > When false this step is removed on load. > > 3) Create the route as string and load it dynamically on start (something > like RouteLoader). Of course there are multiple instances running with > different configuration. > > 4) Use a RouteTemplate and somehow configure if a step is used or not based > on parameters. > > 5) Use some aspect programming, just like unit tests: weaveById(id).remove() > > So I liked to avoid the first option (using XML), because and then need to > rewrite several routes. Is one of the other possible? Or is there another > possibility where I am unaware of? > > Greets, > > Raymond