I need to see if there is a framework in Java (like Spring, etc) that has ability to configure/control a flow of data (for example HTTP request being data), also has ability to dynamically alter current flow based on results of operations performed on data.
Simply put, assume we have multiple components in an application that can handle data sequentially (from component A to component B to component C and so on). Requirement is to have components designed in a way that they are independent from one another and act on data itself. Data passed from component to component in some specific order. The order may be configured based on initial state of data or dynamically updated as necessary.
Trivial approach would be to have an interface MyDataHandler with method void handleData(MyData myData), then override the interface as necessary doing a specific operation by each component. Then somehow assemble all component in a list and iterate over that list calling each component:
// add components in some particular order
private List<MyDataHandler> allHandlers = ...;
...
for(MyDataHandler handler : allHandlers) {
handler.handleData(myData);
}
This trivial solution lacks ability to alter the order based on result of some operations on data. It also does not provide any actual means of configuring the order of implementations based on some initial state of data.
Any clues?
Thanks