private void initAkka() { logger.info("Initializing Akka"); // Create one actor system with request actor for each region if ( StringUtils.isEmpty( currentRegion )) { throw new RuntimeException( "No value specified for: " + ActorSystemFig.CLUSTER_REGIONS_LOCAL ); } if ( StringUtils.isEmpty( actorSystemFig.getRegionsList() )) { throw new RuntimeException( "No value specified for: " + ActorSystemFig.CLUSTER_REGIONS_LIST ); } if ( StringUtils.isEmpty( actorSystemFig.getSeeds() )) { throw new RuntimeException( "No value specified for: " + ActorSystemFig.CLUSTER_SEEDS ); } List regionList = Arrays.asList( actorSystemFig.getRegionsList().toLowerCase().split(",") ); logger.info("Initializing Akka for hostname {} region {} regionList {} seeds {}", hostname, currentRegion, regionList, actorSystemFig.getSeeds() ); Config config = createConfiguration(); clusterSystem = createClusterSystem( config ); // register our cluster listener clusterSystem.actorOf(Props.create(ClusterListener.class, getSeedsByRegion(), getCurrentRegion()), "clusterListener" ); createClientActors( clusterSystem ); mediator = DistributedPubSub.get( clusterSystem ).mediator(); }
public ReservationCacheActor() { // subscribe to the topic named "content" ActorRef mediator = DistributedPubSub.get(getContext().system()).mediator(); mediator.tell(new DistributedPubSubMediator.Subscribe("content", getSelf()), getSelf()); }
private static ActorRef getDistributedPubSubMediatorActor(final ActorSystem actorSystem) { return DistributedPubSub.get(actorSystem).mediator(); }
private static ActorRef getDistributedPubSubMediatorActor(final ActorSystem actorSystem) { return DistributedPubSub.get(actorSystem).mediator(); }
public HintProducerProtocolActor(String endpoint, String localBrokerUri) { this.endpoint = endpoint; this.localBrokerUri = localBrokerUri; pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); }
@Override public void preStart() { // initialize the distributed event bus to send need events to the matchers pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); }
public NeedConsumerProtocolActor(String endpoint) { this.endpoint = endpoint; pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); }
@Override public void preStart() { log.debug(getSelf().path().toString()); try { ActorRef mediator = DistributedPubSub.get(getContext().system()).mediator(); mediator.tell(new DistributedPubSubMediator.Subscribe(EventStore.EVENTSTOREMESSAGES, getSelf()), getSelf()); } catch (ConfigurationException e){ log.info("Not subscribing to eventstore event, no cluster system"); } subscribe(); }
@Override public void preStart() { log.debug(getSelf().path().toString()); try { ActorRef mediator = DistributedPubSub.get(getContext().system()).mediator(); mediator.tell(new DistributedPubSubMediator.Subscribe(EventStore.EVENTSTOREMESSAGES, getSelf()), getSelf()); } catch (ConfigurationException e){ log.info("Not subscribing to eventstore event, no cluster system"); } subscribe(); }
/** * Creates a new instance of this actor using the pub-sub mediator of the actor system in which it is created. * * @param namespaceOps namespace operations on the persistence. */ protected AbstractNamespaceOpsActor(final NamespaceOps<S> namespaceOps) { pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); this.namespaceOps = namespaceOps; materializer = ActorMaterializer.create(getContext()); }
@Override public void preStart() { // subscribe for load need events pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); pubSubMediator.tell(new DistributedPubSubMediator.Subscribe(LoadNeedEvent.class.getName(), getSelf()), getSelf()); }
@Override public void preStart() { // Subscribe for need events pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); pubSubMediator.tell(new DistributedPubSubMediator.Subscribe(NeedEvent.class.getName(), getSelf()), getSelf()); }
@Override public void preStart() throws Exception { log.debug("EventstoreSingelton started with adress {}", getSelf().path()); try { Cluster cluster = Cluster.get(getContext().system()); cluster.subscribe(self(), ClusterEvent.MemberRemoved.class); cluster.subscribe(self(), ClusterEvent.ReachableMember.class); log.info("{} subscribes to cluster events", self()); } catch (ConfigurationException e) { } storage.open(); try { ActorRef mediator = DistributedPubSub.get(getContext().system()).mediator(); mediator.tell(new DistributedPubSubMediator.Publish(EventStore.EVENTSTOREMESSAGES, new NewEventstoreStarting()), self()); log.info("Sent message new eventstore starting"); } catch(ConfigurationException e){ log.info("No subscribe to eventstore messages in non cluster system"); } super.preStart(); }
@Override public void preStart() { registerSagas(); try { ActorRef mediator = DistributedPubSub.get(getContext().system()).mediator(); mediator.tell(new DistributedPubSubMediator.Subscribe(EventStore.EVENTSTOREMESSAGES, getSelf()), getSelf()); } catch (ConfigurationException e){ log.info("Not subscribing to eventstore event, no cluster system"); } repository.open(); subscribe(); timeoutstore = getContext().actorOf(TimeOutStore.mkProps(repository)); }
private DevOpsCommandsActor(final LoggingFacade loggingFacade, final String serviceName, final String instance) { this.loggingFacade = loggingFacade; this.serviceName = serviceName; this.instance = instance; pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); serviceMappingStrategy = MappingStrategy.loadMappingStrategy(getContext().getSystem()).determineStrategy(); getContext().actorOf( PubSubSubscriberActor.props(pubSubMediator, serviceName, instance, RetrieveLoggerConfig.TYPE, ChangeLogLevel.TYPE, ExecutePiggybackCommand.TYPE ), "pubSubSubscriber"); }
private DevOpsCommandsActor(final LoggingFacade loggingFacade, final String serviceName, final String instance) { this.loggingFacade = loggingFacade; this.serviceName = serviceName; this.instance = instance; pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); serviceMappingStrategy = MappingStrategy.loadMappingStrategy(getContext().getSystem()).determineStrategy(); getContext().actorOf( PubSubSubscriberActor.props(pubSubMediator, serviceName, instance, RetrieveLoggerConfig.TYPE, ChangeLogLevel.TYPE, ExecutePiggybackCommand.TYPE ), "pubSubSubscriber"); }
pubSubMediator = DistributedPubSub.get(getContext().system()).mediator(); pubSubMediator.tell(new DistributedPubSubMediator.Subscribe(WonNodeEvent.class.getName(), getSelf()), getSelf());
private ThingsUpdater(final int numberOfShards, final ShardRegionFactory shardRegionFactory, final ThingsSearchUpdaterPersistence searchUpdaterPersistence, final CircuitBreaker circuitBreaker, final boolean eventProcessingActive, final Duration thingUpdaterActivityCheckInterval, final int maxBulkSize) { final ActorSystem actorSystem = context().system(); // Start the proxy for the Things and Policies sharding, too. final ActorRef thingsShardRegion = shardRegionFactory.getThingsShardRegion(numberOfShards); final ActorRef policiesShardRegion = shardRegionFactory.getPoliciesShardRegion(numberOfShards); final ActorRef pubSubMediator = DistributedPubSub.get(actorSystem).mediator(); final Props thingUpdaterProps = ThingUpdater.props(searchUpdaterPersistence, circuitBreaker, thingsShardRegion, policiesShardRegion, thingUpdaterActivityCheckInterval, ThingUpdater.DEFAULT_THINGS_TIMEOUT, maxBulkSize) .withMailbox("akka.actor.custom-updater-mailbox"); shardRegion = shardRegionFactory.getSearchUpdaterShardRegion(numberOfShards, thingUpdaterProps); this.searchUpdaterPersistence = searchUpdaterPersistence; materializer = ActorMaterializer.create(getContext()); retrieveStatisticsDetailsResponseSupplier = RetrieveStatisticsDetailsResponseSupplier.of(shardRegion, ThingsSearchConstants.SHARD_REGION, log); if (eventProcessingActive) { pubSubMediator.tell(new DistributedPubSubMediator.Subscribe(ThingEvent.TYPE_PREFIX, UPDATER_GROUP, self()), self()); pubSubMediator.tell(new DistributedPubSubMediator.Subscribe(PolicyEvent.TYPE_PREFIX, UPDATER_GROUP, self()), self()); } }
final ActorRef policiesShardRegion = shardRegionFactory.getPoliciesShardRegion(numberOfShards); final ActorRef pubSubMediator = DistributedPubSub.get(actorSystem).mediator();
final String survivingId = survivingNamespace + ":name"; final ActorRef pubSubMediator = DistributedPubSub.get(actorSystem).mediator(); final ActorRef actorToPurge = watch(startEntityActor(actorSystem, pubSubMediator, purgedId)); final ActorRef survivingActor = watch(startEntityActor(actorSystem, pubSubMediator, survivingId));