Skip to content

Commit

Permalink
only start BlockedNamespacesUpdater in one service: policies
Browse files Browse the repository at this point in the history
* as it must only exist once in the cluster (previously in concierge)

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Jul 13, 2022
1 parent 71c9d57 commit 763a90e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ private PoliciesRootActor(final PoliciesConfig policiesConfig,

final BlockedNamespaces blockedNamespaces = BlockedNamespaces.of(actorSystem);
// start cluster singleton that writes to the distributed cache of blocked namespaces
// this must only be started for one service in the cluster - which "policies" was chosen for ...
// this BlockedNamespacesUpdater updates the DData "BlockedNamespaces" data structure
final Props blockedNamespacesUpdaterProps = BlockedNamespacesUpdater.props(blockedNamespaces, pubSubMediator);
ClusterUtil.startSingleton(actorSystem, getContext(), PoliciesMessagingConstants.CLUSTER_ROLE,
BlockedNamespacesUpdater.ACTOR_NAME, blockedNamespacesUpdaterProps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.eclipse.ditto.internal.utils.aggregator.ThingsAggregatorActor;
import org.eclipse.ditto.internal.utils.aggregator.ThingsAggregatorConfig;
import org.eclipse.ditto.internal.utils.akka.logging.DittoLoggerFactory;
import org.eclipse.ditto.internal.utils.cluster.ClusterUtil;
import org.eclipse.ditto.internal.utils.cluster.DistPubSubAccess;
import org.eclipse.ditto.internal.utils.cluster.RetrieveStatisticsDetailsResponseSupplier;
import org.eclipse.ditto.internal.utils.cluster.ShardRegionExtractor;
Expand All @@ -30,7 +29,6 @@
import org.eclipse.ditto.internal.utils.health.DefaultHealthCheckingActorFactory;
import org.eclipse.ditto.internal.utils.health.HealthCheckingActorOptions;
import org.eclipse.ditto.internal.utils.namespaces.BlockedNamespaces;
import org.eclipse.ditto.internal.utils.namespaces.BlockedNamespacesUpdater;
import org.eclipse.ditto.internal.utils.persistence.mongo.MongoClientWrapper;
import org.eclipse.ditto.internal.utils.persistence.mongo.MongoHealthChecker;
import org.eclipse.ditto.internal.utils.persistence.mongo.config.MongoDbConfig;
Expand All @@ -40,8 +38,8 @@
import org.eclipse.ditto.internal.utils.pubsub.DistributedPub;
import org.eclipse.ditto.internal.utils.pubsubthings.LiveSignalPub;
import org.eclipse.ditto.internal.utils.pubsubthings.ThingEventPubSubFactory;
import org.eclipse.ditto.policies.enforcement.PolicyEnforcerProvider;
import org.eclipse.ditto.policies.enforcement.DefaultPolicyEnforcerProvider;
import org.eclipse.ditto.policies.enforcement.PolicyEnforcerProvider;
import org.eclipse.ditto.things.api.ThingsMessagingConstants;
import org.eclipse.ditto.things.model.signals.events.ThingEvent;
import org.eclipse.ditto.things.service.common.config.ThingsConfig;
Expand Down Expand Up @@ -90,10 +88,6 @@ private ThingsRootActor(final ThingsConfig thingsConfig,
final LiveSignalPub liveSignalPub = LiveSignalPub.of(getContext(), distributedAcks);

final BlockedNamespaces blockedNamespaces = BlockedNamespaces.of(actorSystem);
// start cluster singleton that writes to the distributed cache of blocked namespaces
final Props blockedNamespacesUpdaterProps = BlockedNamespacesUpdater.props(blockedNamespaces, pubSubMediator);
ClusterUtil.startSingleton(actorSystem, getContext(), CLUSTER_ROLE,
BlockedNamespacesUpdater.ACTOR_NAME, blockedNamespacesUpdaterProps);
final PolicyEnforcerProvider policyEnforcerProvider = DefaultPolicyEnforcerProvider.getInstance(actorSystem);
final Props thingSupervisorActorProps = getThingSupervisorActorProps(pubSubMediator,
distributedPubThingEventsForTwin,
Expand Down

0 comments on commit 763a90e

Please sign in to comment.