Open mjameswh opened 4 months ago
Possible workaround for now is
const worker = await Worker.create({
connection,
dataConverter: await getDataConverter(),
...rest
});
const loadedDataConverter = worker.options.loadedDataConverter;
if (loadedDataConverter)
loadedDataConverter.failureConverter = new DefaultFailureConverter({
encodeCommonAttributes: true,
});
Describe the solution you'd like
At this time, all public APIs that accept
DataConverter
s require payload converter and failure converter to be specified as paths. That requirement originally stemmed from a desire of being consistent with the wayDataConverter
s are passed to Workflow Workers, where paths are required because these two converters need to be loaded inside the Workflow Sandbox.It however appears that in this specific case, consistency is often counter-productive. Workflow code and client code are often part of distinct deployment units, with distinct build processes for workflow vs client code, so that’s already inconsistent. By imposing consistency, we are forcing users to adapt and complexify the build process of all non-Workflow Worker components without no real reason to do so.
Instead, we should make
Client
accept pre-loaded data converters. And possibly do the same for Activity-only Workers.