External Storage Integration: Activity worker, client - #3020
Conversation
| public ListWorkflowExecutionsResponse listWorkflowExecutions( | ||
| ListWorkflowExecutionsRequest listRequest) { | ||
| return next.listWorkflowExecutions(listRequest); | ||
| } |
There was a problem hiding this comment.
Addressed the previous concern of eagerly fetching external payloads #2978 (comment). They are now loaded lazily.
37ae3c7 to
7069249
Compare
|
|
||
| try { | ||
| sendReply(taskToken, result, metricsScope); | ||
| sendReply(taskToken, result, metricsScope, activityStorageTarget(pollResponse)); |
There was a problem hiding this comment.
Previous comment about pivoting this target based on standalone vs workflow activity has been addressed #2978 (comment)
activityStorageTarget delegates to storageTargetForActivityTask (which can be seen above)
460bfbf to
b3804da
Compare
7069249 to
550e4f2
Compare
b3804da to
ca09b50
Compare
ffafefa to
69a8a3a
Compare
fad5ed3 to
8d1399c
Compare
| * <p>This This is an internal class that is not exposed to users or workflow code. The intent is to | ||
| * use this data converter to consolidate extstore usage within the SDK. | ||
| */ | ||
| public final class ExternalStorageDataConverter implements DataConverter { |
There was a problem hiding this comment.
This is the new abstraction that replaces the previous External Storage client decorator. It wraps the data converter supplied to the WorkflowClient in RootWorkflowClientInvoker
| public RootWorkflowClientInvoker( | ||
| GenericWorkflowClient genericClient, | ||
| WorkflowClientOptions clientOptions, | ||
| WorkerFactoryRegistry workerFactoryRegistry, | ||
| @Nullable ExternalStorageRunner externalStorage) { | ||
| this.externalStorage = externalStorage; |
There was a problem hiding this comment.
This class inherits the external storage runner from WorkflowClientInternalImpl and then uses it to create the new ExternalStorageDataConverter
| Stream<HistoryEvent> streamHistory(WorkflowExecution execution) { | ||
| Preconditions.checkNotNull(execution, "execution is required"); | ||
|
|
||
| GetWorkflowExecutionHistoryIterator iterator = | ||
| new GetWorkflowExecutionHistoryIterator( | ||
| options.getNamespace(), execution, null, genericClient); | ||
| iterator.init(); |
There was a problem hiding this comment.
This no longer runs through external storage as it was previously being handled by the client decorator. The worker still uses extstore when replaying it's own history (see https://github.com/temporalio/sdk-java/pull/3017/changes#diff-4928a50c4af33d91cd6b57a121d20ed2594cd314e118beb01c259d5e7427728c).
Is this just used for offline replay? Do we need to use extstore here?
There was a problem hiding this comment.
I think we discussed offline we don't need to? At least that is what other SDKs did so we should be consistent
8d1399c to
0c7b308
Compare
| throw new IllegalArgumentException("Either activity id or task token are required"); | ||
| } | ||
| RespondActivityTaskFailedByIdRequest request = | ||
| RespondActivityTaskFailedByIdRequest unstoredRequest = |
There was a problem hiding this comment.
nit: this request seems to follow a different pattern then all your others, may be cleaner to follow the convention of alway calling request = storeOutbound(builder.Build()), but just a nit feel free to ignore
|
|
||
| public RootWorkflowClientInvoker( | ||
| GenericWorkflowClient genericClient, | ||
| WorkflowClientOptions clientOptions, |
There was a problem hiding this comment.
nit: we could get rid of WorkflowClientOptions here so we know no one accidentally calls clientOptions.getDataConverter() now or in the future
| this.workflowServiceStubs = | ||
| WorkflowServiceStubs.newServiceStubs(serviceStubsOptionsBuilder.build()); | ||
|
|
||
| WorkflowClient client = |
There was a problem hiding this comment.
What is the change for?
There was a problem hiding this comment.
client.getInternal() is used below now so we needed to pull out a reference.
|
Couple nits, generally looks good. Going to do an AI review as well. Would want Justin to look as well of course |
|
Codex identified these two additional issues At a quick glance they look legit, but please let me know. |
2d2d90e to
504467c
Compare
0c7b308 to
f527885
Compare
…TestActivityEnvironment
…rator, address some feedback points.
f527885 to
2cedf19
Compare
…ly have one exposed path for getting the data converter.
|
The first issue that codex identified led me to do a little refactoring. I believe all the feedback has been addressed here. |
What was changed
WorkflowClientInternalImpl,HeartbeatContextImpl, andActivityWorker.Why?
Checklist