-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Improve Workflow api #29
Comments
@dbwiddis I have raised a draft PR to handle the above cases except the 2nd one. Can you elaborate more on the input and output method of the interface? Map<String, Object> input();
CompletableFuture<WorkflowStep> output(); |
Without having looked at your PR yet, what I had in mind was something like this for the interface signature (please don't let this constrain what you do, haven't tried it, but think it might work): CompletableFuture<WorkflowOutput> execute(WorkflowInput input); And the WorkflowOutput / Input classes (or possibly just one class WorkflowData representing both) would have some internal representation of JSON (or XContent in general, thus the |
And since we might just feed one output to the input of the other this may be preferred. So CompletableFuture<WorkflowData> execute(@Nullable WorkflowData data); |
Is your feature request related to a problem?
I implemented the
Workflow
API committed in #25 as part of my draft PR #26 and identified a few needed improvements.What solution would you like?
Looking up and executing these should conceptually be similar to OpenSearch
TransportAction
s. They all have anActionType
(fancy wrapper for a string), and then an action taking aRequest
argument and aResponse
type, which is used internally to return the results asynchronously. We need counterparts of these same 4 components here:<Workflow>
is not the appropriate return type as all we can do with the returned future is execute it... we need two new interfaces here representing input and output. I think accepting input as an argument and a completable future for the output is probably the best way to do it.Map<String, Object>
is probably a good internal representation for these input/output objects (to ease going to/from JSON) but there may be a better one. It's probably very analogous to XContent.execute()
method to throw anException
. This requires calling code to catch the exception. We're already returning aCompletableFuture
, just complete the future exceptionally on error.Workflow
is the right class name as that seems to imply the highest level, while this corresponds either to individual process steps, or sub-workflows. I thinkWorkflowStep
might be a good option but there may be better ones.What alternatives have you considered?
I think these suggestions are open-ended enough to allow lots of alternatives, I'm just requesting functionality.
Do you have any additional context?
Somewhere we'll need a way of finding these java objects to iterate over them to get their names. This requires some level of object "registration" via an extension point somewhere. Handling via
createComponents()
is a possibility.The text was updated successfully, but these errors were encountered: