First of all, if there is already such a question like mine on the stackoverflow, sorry for that, but I haven't managed to find it. Actually I don't know what tags could I use to search for a solution which I need.
Basically, I need a tool/software which can manage a data(objects) flow using several tools/actions during the whole process. Of course one of the existing BPM/workflow platform tool can probably do that, but they seem to be too complicated for my requirements.
I have a "static" data model built with JPA/Hibernate. Then I need to change that static model in order to use different processing functions over it. That function could be some java classes, web service or external application (which support batch mode). After that I need to catch the output from these functions and make some visualisations, draw some charts etc. I can assume that all these processing functions have access to the static model and they can change it to that specific one so there is no need to pass input to them. On the other hand the output of them should be caught by the main "workflow manager".
One more thing, the whole process should run automatically without any user interactions (maybe it will change in the future, but look and present for now). Before process starts, administrator should define which "processing function" is used and that's it. And another thing... the best would be if the whole process was triggered when database state was changed, but it is not crucial, I can start it for example by calling a web service.
The question is: should I use one of the existing BPM/Workflow tool such as jBPM or Activiti, write a simple "workflow manager" on my own or use an existing tool which is much simpler then jBPM/Activiti (is there any?). Of course I prefer the easiest approach...
Thanks a lot for any feedback.
Apache Camel is an open source integration framework which will help you in this.
You can use Apache Camel to build your own simple workflow manager, where each process implements Processor. Your data can passed through processors using camel Exchange. Check out camel examples for more information.
For information on how to write custom processor, please read here.
You can add Processors to a Camel RouteBuilder dynamically, schedule it using Quartz Scheduler etc., which will more or less address all your requirements.
Here is good introduction to Camel : http://www.kai-waehner.de/blog/2012/05/04/apache-camel-tutorial-introduction/
A simple implementation of Workflow Manager using Camel:
WorkflowManager.java
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class WorkflowManager {
DefaultCamelContext camelContext;
public WorkflowManager() {
camelContext = new DefaultCamelContext();
RouteBuilder routeBuilder = new RouteBuilder() {
@Override
public void configure() throws Exception {
from("timer:schedule?period=1s&daemon=true").process(new ProcessOne()).process(new ProcessTwo());
}
};
try {
camelContext.addRoutes(routeBuilder);
} catch (Exception e) {
e.printStackTrace();
}
}
public void start() throws Exception {
camelContext.start();
}
public void stop() throws Exception {
camelContext.stop();
}
public static void main(String[] args) {
WorkflowManager workflowManager = new WorkflowManager();
try {
workflowManager.start();
while(true) {
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
ProcessOne.java
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
public class ProcessOne implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("In ProcessOne");
}
}
ProcessTwo.java
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
public class ProcessTwo implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("In ProcessTwo");
}
}
I used Camel version 2.9.0 to compile this code. Please note that I've used an infinite loop in main method to keep the main thread alive.
This code will run a route having ProcessOne and ProcessTwo, with a period of 1 second. You can see the period in from(...) method where I add processors to route builder. Hence, this route will run repeatedly. Also, I am not trying to flow any data. You can use exchange in the process method of each processor to flow data.
Output will be:
In ProcessOne
In ProcessTwo
In ProcessOne
In ProcessTwo
You can use camel components to make your WorkflowManager robust.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With