Thank you for that information. I have a couple of questions to that though.
This is the java code I came up with to call API1.
package org.camunda.bpm.orch;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import java.util.logging.Logger;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.ParseException;
import org.json.simple.parser.JSONParser;
import org.camunda.bpm.client.ExternalTaskClient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URLConnection;
import java.util.ArrayList;
import java.net.;
import java.io.;
import java.util.*;
import javax.inject.Named;
@Named(“api1call”)
public class orchDelegate implements JavaDelegate{
public void execute(DelegateExecution execution) throws Exception {
try(InputStream is=new URL("https://qrng.anu.edu.au/API/jsonI.php?length=1&type=uint16").openStream()) {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
StringBuilder sb=new StringBuilder();
int cp;
while((cp=rd.read())!=-1) {
sb.append((char)cp);
}
String jsonText = sb.toString();
JSONObject json = new JSONObject();
json.put("jsonText", jsonText);
System.out.println(json.toString());
Object retVal=json.get(2);
System.out.println(retVal);
is.close();
}
catch(Exception e){
e.printStackTrace();
}
}
}
I’m basically calling the API in this code, and have 2 more classes orchDelegate2 and orchDelegate3 to call API 2 and API3 in similar manners.
-
I’m a little confused about where exactly I access the return value of API1 and where I apply the conditional logic? Can I basically do this on the camunda modeler, or do I need additional code for it in my java program?
-
I also didn’t really get any resources for actually communicating variables between the program and the modeler. I need to basically be able to input and output stuff on the cockpit, and I’m not sure how to.
Thanks for any help once again!