Hi @Sibok666,
I would like to help with development of this feature.
Please let me know If I can be of any help.
Thanks,
Harsha
Hi @Sibok666,
I would like to help with development of this feature.
Please let me know If I can be of any help.
Thanks,
Harsha
hi @h7kanna for sure you can help, please take a look at my repo for seeing the changes i have maded to the code.
I think that if we can code all the feature with the
callRestService(String protocol,String host, Integer port, String restPath, Map<String,String> inputParameters)
tha its a very simple aproach to the rest call, after that it will be more easy to implement the specification that youre saying.
Tell me if you have doubt about my code and the changes in my repo.
Hi @Sibok666,
Thank you, will start looking into the changes.
Harsha
Hi @tijs, I do a lot of changes, maybe Im nod doing the things correctly, I think the most important thibg that I do in my latest commit to my repo was add the next class:
/**
@author Alfredo Suarez
*/
public class RestTaskJsonConverter extends BaseBpmnJsonConverter {
public static void fillTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap, Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {
fillJsonTypes(convertersToBpmnMap);
fillBpmnTypes(convertersToJsonMap);
}
public static void fillJsonTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap) {
convertersToBpmnMap.put(STENCIL_TASK_RESTCALL, RestTaskJsonConverter.class);
}
public static void fillBpmnTypes(Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {
}
protected String getStencilId(BaseElement baseElement) {
return STENCIL_TASK_RESTCALL;
}
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
// done in service task
}
protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
ServiceTask task = new ServiceTask();
task.setType(ârestâ);
addField(âprotocolâ, PROPERTY_RESTTASK_HOST, elementNode, task);
addField(âhostâ, PROPERTY_RESTTASK_HOST, elementNode, task);
addField(âportâ, PROPERTY_RESTTASK_PORT, elementNode, task);
addField(âpathâ, PROPERTY_RESTTASK_PATH, elementNode, task);
addField(âinputParametersâ, PROPERTY_RESTTASK_INPUT_PARAMETERS, elementNode, task);
addField(âresultVariableâ, PROPERTY_RESTTASK_RESULT_VARIABLE, elementNode, task);
return task;
}
}
Where I get the properties that the user is going to put on the modeler app.
How can I get thesse values in the RestCallActivityBehavior?
So If I can get thesse values, the input pĂĄrameters, on Behavior activity will be no more hardcoded.
In general terms, I have modified the classes where exist a mule task call to add a rest call here are the classe I have modified until now.
Please give a clue of whats next?
Hi @h7kanna any suggestions?
Ok thanks. From what I see on your Github fork, the RestCallActivityBehavior implementation is still a bit empty. I think we first need a full implementation of the RestCallActivityBehavior class with a good amount of unit tests, testing the REST task behavior, also when used in BPMN XML. So I think that would be my suggestion as the next steps.
Best regards,
Tijs
Thanks @tijs Ill work on them.
So I need to start to look at some test.
Harsha and me are talking about the changes needed to be done.
When we have any advance we will update you.
Best regards.
Is the REST service task run asynchronously or as some type of blocking call?
Hi @jchayes,
Implementation I am working on is synchronous( will block the thread running the service task), because it will be part of the transaction.
Iâm not sure how this could be asynchronous. Any ideas?
Thanks,
Harsha
Hi @tijs,
Planning to use Jetty as mock server for unit tests.
Do you have any suggestion/conditions?
Thanks,
Harsha
Hi @h7kanna,
I would suggest to use the unit tests of the flowable-rest module as a starting point.
Itâs also using Jetty.
Best regards,
Tijs
Hi @tijs,
Need a clarification on this.
Should the HTTP Task/Behavior be in a separate project like flowable-mule and flowable-camel?
Is it ok to have it in flowable-engine module itself. This would lead to hard dependency for flowable-engine on apache http client?
Also thinking if it is a separate module like flowable-mule, multiple implementations based on different type of http clients(apache, jetty, okhttp, java9) libraries can be possible without hard dependency for flowable-engine.
Thanks,
Harsha
Hi Harsha,
Having a separate module makes a lot of sense I think.
Best regards,
Tijs
Thanks @tijs,
Creating a separate module for it called âflowable-httpâ.
Also the HTTP service task is of type âhttpâ
serviceTask id=âsimpleGetâ flowable:type=âhttpâ
@Sibok666 Will commit changes to my fork this week, we can coordinate further on this.
Thanks,
Harsha
Hello @tijs,
Before moving forward with my commits.
I want to confirm if the below HTTP Task spec is good.
Please review, so that I can go ahead, commit and raise pull request for implementation specific commits.
Thanks,
Harsha
Hi Harsha,
Thanks, itâs looking very good. Couple of points:
These are not all points for a version 1 implementation, but just stuff that crossed my mind.
Best regards,
Tijs
Hi @tijs,
Will change HTTPClientConfig to httpClientConfig.
expressions are allowed as mentioned.
Retry feature would be Http Client retrying the request( we can set this by configuring retry handler on apache client). This is just for resiliency for temporary network issues. As sync job is concerned, I am planning to throw Flowable exception based on ignore,retry settings so that Job Executor retries based on âflowable:failedJobRetryTimeCycleâ. I am not sure if this can be implemented like Camel receive task.
Updated resultVariables handling. Needed a clarification though. I am using a prefix value to give variables unique names in the execution. Will âtaskId.fieldNameâ suffice to make it unique? User can override this by âvariableNamePrefixâ
Will start working on Authentication, Request parsing once version 1 is done and reviewed.
Thanks,
Harsha
Hi Harsha,
Great thanks. Letâs say you are getting back a JSON object like:
{âcustomerâ: {ânameâ:âJohn Doeâ, âaddressâ: âSome streetâ, âhouseNumberâ: â34aâ}}
How would that translate in execution variables?
Best regards,
Tijs
Hi,
taskId.responseBody = {âcustomerâ: {ânameâ:âJohn Doeâ, âaddressâ: âSome
streetâ, âhouseNumberâ: â34aâ}}
Next we can have âresponseFilterâ field expression which evaluates to say
something like
jsonProcessor.extractAddress(taskId.responseBody)
Thanks,
Harsha