Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class NamespaceProperties {
private final @Nullable List<WorkerProperties> workers;
private final @Nonnull String namespace;
private final @Nullable WorkflowCacheProperties workflowCache;
private final @Nullable Boolean ignoreDuplicateDefinitions;
private final @Nonnull Boolean ignoreDuplicateDefinitions;

@ConstructorBinding
public NamespaceProperties(
Expand All @@ -29,7 +29,7 @@ public NamespaceProperties(
this.namespace = MoreObjects.firstNonNull(namespace, NAMESPACE_DEFAULT);
this.workflowCache = workflowCache;
this.ignoreDuplicateDefinitions =
MoreObjects.firstNonNull(ignoreDuplicateDefinitions, Boolean.TRUE);
MoreObjects.firstNonNull(ignoreDuplicateDefinitions, Boolean.FALSE);
}

@Nullable
Expand Down Expand Up @@ -57,7 +57,7 @@ public WorkflowCacheProperties getWorkflowCache() {

@Nonnull
public Boolean isIgnoreDuplicateDefinitions() {
return Boolean.TRUE;
return ignoreDuplicateDefinitions;
}

public static class WorkflowCacheProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ private void configureActivityImplementationAutoDiscovery(
worker.getTaskQueue());
}
} catch (TypeAlreadyRegisteredException registeredEx) {
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
throw registeredEx;
}
if (log.isInfoEnabled()) {
log.info(
"Skipping auto-discovered activity bean '{}' of class {} on a worker {} with a task queue '{}'"
Expand All @@ -432,9 +435,6 @@ private void configureActivityImplementationAutoDiscovery(
worker.getTaskQueue(),
registeredEx.getRegisteredTypeName());
}
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
throw registeredEx;
}
}
}

Expand All @@ -461,6 +461,9 @@ private void configureNexusServiceImplementationAutoDiscovery(
worker.getTaskQueue());
}
} catch (TypeAlreadyRegisteredException registeredEx) {
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
throw registeredEx;
}
if (log.isInfoEnabled()) {
log.info(
"Skipping auto-discovered nexus service bean '{}' of class {} on a worker {} with a task queue '{}'"
Expand All @@ -471,9 +474,6 @@ private void configureNexusServiceImplementationAutoDiscovery(
worker.getTaskQueue(),
registeredEx.getRegisteredTypeName());
}
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
throw registeredEx;
}
}
}

Expand All @@ -489,6 +489,9 @@ private void configureWorkflowImplementationAutoDiscovery(
worker.getTaskQueue());
}
} catch (TypeAlreadyRegisteredException registeredEx) {
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
throw registeredEx;
}
if (log.isInfoEnabled()) {
log.info(
"Skip registering of auto-discovered workflow class {} on a worker {}with a task queue '{}' "
Expand All @@ -498,9 +501,6 @@ private void configureWorkflowImplementationAutoDiscovery(
worker.getTaskQueue(),
registeredEx.getRegisteredTypeName());
}
if (!namespaceProperties.isIgnoreDuplicateDefinitions()) {
throw registeredEx;
}
}
}

Expand Down
Loading