I am new to BPMN and Camunda-bpm.I have a simple bpmn process in which i am using 1 service task.I want to execute my process by using processEngine.getRuntimeService().startProcessInstanceByKey(“Process_1”, variables);
where my variables is as follows:
Map<String,Object> variables = new HashMap<String, Object>();
variables.put(“a”, 2);
variables.put(“b”, 5);
Now my service task is implementing a java class in which i want to use process variable “a” and “b”?
How can i get same process variable “a” and “b” in that class?
Thanks for your prompt reply.Actually i am using karaf environment in which i created process engine by following this example(https://github.com/camunda/camunda-bpm-platform-osgi) so my service class is not implementing JavaDelegate.
I have a ExampleProcessApplication class which extends OSGiProcessApplication class and looks like as follows:
‘’’
public class ExampleProcessApplication extends OSGiProcessApplication {
I went through user guide again same problem arise that my implementation class is not implementing JavaDelegate interface.
Let me repeat my complete problem again.
I am using karaf environment in which i created process engine by following this example(https://github.com/camunda/camunda-bpm-platform-osgi) so my service class is not implementing JavaDelegate.
I have a ExampleProcessApplication class which extends OSGiProcessApplication class and looks like as follows:
‘’’
public class ExampleProcessApplication extends OSGiProcessApplication {
private RuntimeService runtimeService;
Map<String,Object> variables = new HashMap<String, Object>();
public ExampleProcessApplication(BundleContext ctx, BlueprintContainer blueprintContainer) {
super(ctx.getBundle(), blueprintContainer);
} @PostDeploy
public void sayHello(ProcessEngine processEngine) {
try {
variables.put(“a”, 2);
variables.put(“b”, 5);
processEngine.getRuntimeService().startProcessInstanceByKey(“Process_1”,variables);
} catch (Exception e) {
e.printStackTrace();
}
}
‘’’
I used blueprint service and using beans my service task is implementing this class as follows:
‘’’
public class Calculator {
public void Addition()
{
}
public void Multiply()
{
}
}
‘’’
How can i use my process variables here?
In the future, please submit any camunda-osgi-related questions in the Community Extensions category. You can select it when you create a new thread. camunda-bpm-platform-osgi is a community extension maintained by @rbraeunlich and therefore not part of the Camunda product. If you post questions in the correct category you are more likely to receive an answer by an expert and you help us keep the forum organized.