Skip to content

Commit a25f6ba

Browse files
Fix ignoreDuplicateDefinitions to log only if we are ignoring (#2553)
1 parent b581ede commit a25f6ba

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

temporal-spring-boot-autoconfigure/src/main/java/io/temporal/spring/boot/autoconfigure/properties/NamespaceProperties.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class NamespaceProperties {
1515
private final @Nullable List<WorkerProperties> workers;
1616
private final @Nonnull String namespace;
1717
private final @Nullable WorkflowCacheProperties workflowCache;
18-
private final @Nullable Boolean ignoreDuplicateDefinitions;
18+
private final @Nonnull Boolean ignoreDuplicateDefinitions;
1919

2020
@ConstructorBinding
2121
public NamespaceProperties(
@@ -29,7 +29,7 @@ public NamespaceProperties(
2929
this.namespace = MoreObjects.firstNonNull(namespace, NAMESPACE_DEFAULT);
3030
this.workflowCache = workflowCache;
3131
this.ignoreDuplicateDefinitions =
32-
MoreObjects.firstNonNull(ignoreDuplicateDefinitions, Boolean.TRUE);
32+
MoreObjects.firstNonNull(ignoreDuplicateDefinitions, Boolean.FALSE);
3333
}
3434

3535
@Nullable
@@ -57,7 +57,7 @@ public WorkflowCacheProperties getWorkflowCache() {
5757

5858
@Nonnull
5959
public Boolean isIgnoreDuplicateDefinitions() {
60-
return Boolean.TRUE;
60+
return ignoreDuplicateDefinitions;
6161
}
6262

6363
public static class WorkflowCacheProperties {

temporal-spring-boot-autoconfigure/src/main/java/io/temporal/spring/boot/autoconfigure/template/WorkersTemplate.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ private void configureActivityImplementationAutoDiscovery(
422422
worker.getTaskQueue());
423423
}
424424
} catch (TypeAlreadyRegisteredException registeredEx) {
425+
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
426+
throw registeredEx;
427+
}
425428
if (log.isInfoEnabled()) {
426429
log.info(
427430
"Skipping auto-discovered activity bean '{}' of class {} on a worker {} with a task queue '{}'"
@@ -432,9 +435,6 @@ private void configureActivityImplementationAutoDiscovery(
432435
worker.getTaskQueue(),
433436
registeredEx.getRegisteredTypeName());
434437
}
435-
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
436-
throw registeredEx;
437-
}
438438
}
439439
}
440440

@@ -461,6 +461,9 @@ private void configureNexusServiceImplementationAutoDiscovery(
461461
worker.getTaskQueue());
462462
}
463463
} catch (TypeAlreadyRegisteredException registeredEx) {
464+
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
465+
throw registeredEx;
466+
}
464467
if (log.isInfoEnabled()) {
465468
log.info(
466469
"Skipping auto-discovered nexus service bean '{}' of class {} on a worker {} with a task queue '{}'"
@@ -471,9 +474,6 @@ private void configureNexusServiceImplementationAutoDiscovery(
471474
worker.getTaskQueue(),
472475
registeredEx.getRegisteredTypeName());
473476
}
474-
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
475-
throw registeredEx;
476-
}
477477
}
478478
}
479479

@@ -489,6 +489,9 @@ private void configureWorkflowImplementationAutoDiscovery(
489489
worker.getTaskQueue());
490490
}
491491
} catch (TypeAlreadyRegisteredException registeredEx) {
492+
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
493+
throw registeredEx;
494+
}
492495
if (log.isInfoEnabled()) {
493496
log.info(
494497
"Skip registering of auto-discovered workflow class {} on a worker {}with a task queue '{}' "
@@ -498,9 +501,6 @@ private void configureWorkflowImplementationAutoDiscovery(
498501
worker.getTaskQueue(),
499502
registeredEx.getRegisteredTypeName());
500503
}
501-
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
502-
throw registeredEx;
503-
}
504504
}
505505
}
506506

0 commit comments

Comments
 (0)