Repository navigation
Resolve property placeholders in Spring Boot worker names - #3143
Open
SamuelAdigos wants to merge 1 commit into
Open
SamuelAdigos wants to merge 1 commit into
SamuelAdigos wants to merge 1 commit into
Conversation
The workers attribute of @WorkflowImpl, @ActivityImpl and
@NexusServiceImpl was used verbatim, while taskQueues already went
through the Spring environment's placeholder resolution. A worker name
such as ${my.worker.name} was therefore looked up literally and startup
failed with BeanDefinitionValidationException, which prevented sharing
a workflow module between services with different worker names.
Resolve placeholders in worker names before the worker lookup, the same
way task queues are resolved, and document it on the annotations.
Fixes temporalio#2747.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
The
workersattribute of@WorkflowImpl,@ActivityImpland@NexusServiceImplnow resolves Spring property placeholders such as${my.worker.name}, the same waytaskQueuesalready does.WorkersTemplate: worker names from the annotations go throughenvironment.resolvePlaceholdersbefore the worker lookup.workersattribute of the three annotations.CHANGELOG.mdentry under Added.Why?
Only
taskQueuesresolved placeholders, soworkers = "${...}"looked up a worker literally named${...}and startup failed withBeanDefinitionValidationException. This makes it impossible to share a workflow module between services that configure different worker names.Checklist
Closes @WorkflowImpl(workers = "...") should support Spring property placeholders like taskQueues does #2747
How was this tested:
Following the existing
taskQueuesresolver test, thebyworkernametest implementations now useworkers = "${default-worker.name:mainWorker}", so the existing worker-name tests cover the default value. The newAutoDiscoveryByWorkerNameResolverTestactivates a profile that sets the property to another worker and runs a workflow with an activity and a Nexus operation, plus a dynamic workflow. Without the change both tests fail at startup withWorker with name ${default-worker.name:mainWorker} is not found in the config; with it they pass.:temporal-spring-boot-autoconfigure:testpasses on Spring Boot 2.7, 3 and 4 and in the dev-server lane on Java 11.Any docs updates needed?
No. The Javadoc of the annotations is updated.