public Simulator() { Config config = context().system().settings().config().getConfig("caffeine.simulator"); settings = new BasicSettings(config); List<Routee> routes = makeRoutes(); router = new Router(new BroadcastRoutingLogic(), routes); remaining = routes.size(); batchSize = settings.batchSize(); stopwatch = Stopwatch.createStarted(); reporter = settings.report().format().create(config); }
@Inject public MetricsServiceImpl(CircuitBreakerMetricsProvider metricsProvider, ActorSystem system) { // TODO it would be better to do this in ServiceGuiceSupport.bindService, // but I'm not sure how to access config from there boolean statusEnabled = system.settings().config().getBoolean("lagom.status-endpoint.enabled"); if (statusEnabled && metricsProvider instanceof CircuitBreakerMetricsProviderImpl) provider = Optional.of((CircuitBreakerMetricsProviderImpl) metricsProvider); else provider = Optional.empty(); }
/** * Indicates whether the logging of incoming messages is enabled by config or not. * * @return {@code true} if information about incoming messages should be logged, {@code false} else. */ private boolean isLogIncomingMessages() { final ActorSystem actorSystem = getContext().getSystem(); final Config config = actorSystem.settings().config(); return config.hasPath(ConfigKeys.THINGS_LOG_INCOMING_MESSAGES) && config.getBoolean(ConfigKeys.THINGS_LOG_INCOMING_MESSAGES); }
private ReconnectActor(final ActorRef connectionShardRegion, final Supplier<Source<String, NotUsed>> currentPersistenceIdsSourceSupplier) { this.connectionShardRegion = connectionShardRegion; this.currentPersistenceIdsSourceSupplier = currentPersistenceIdsSourceSupplier; final Config config = getContext().system().settings().config(); materializer = ActorMaterializer.create(getContext().getSystem()); reconnectInitialDelay = config.getDuration(ConfigKeys.Reconnect.RECONNECT_INITIAL_DELAY); reconnectInterval = config.getDuration(ConfigKeys.Reconnect.RECONNECT_INTERVAL); reconnectRateFrequency = config.getDuration(ConfigKeys.Reconnect.RECONNECT_RATE_FREQUENCY); reconnectRateEntities = config.getInt(ConfigKeys.Reconnect.RECONNECT_RATE_ENTITIES); }
private ReconnectActor(final ActorRef connectionShardRegion, final Supplier<Source<String, NotUsed>> currentPersistenceIdsSourceSupplier) { this.connectionShardRegion = connectionShardRegion; this.currentPersistenceIdsSourceSupplier = currentPersistenceIdsSourceSupplier; final Config config = getContext().system().settings().config(); materializer = ActorMaterializer.create(getContext().getSystem()); reconnectInitialDelay = config.getDuration(ConfigKeys.Reconnect.RECONNECT_INITIAL_DELAY); reconnectInterval = config.getDuration(ConfigKeys.Reconnect.RECONNECT_INTERVAL); reconnectRateFrequency = config.getDuration(ConfigKeys.Reconnect.RECONNECT_RATE_FREQUENCY); reconnectRateEntities = config.getInt(ConfigKeys.Reconnect.RECONNECT_RATE_ENTITIES); }
MqttClientActor(final Connection connection, final ConnectionStatus desiredConnectionStatus, final ActorRef conciergeForwarder, final BiFunction<Connection, DittoHeaders, MqttConnectionFactory> connectionFactoryCreator) { super(connection, desiredConnectionStatus, conciergeForwarder); this.connectionFactoryCreator = connectionFactoryCreator; consumerByActorNameWithIndex = new HashMap<>(); pendingStatusReportsFromStreams = new HashSet<>(); sourceBufferSize = ConnectionConfigReader.fromRawConfig(getContext().system().settings().config()) .mqtt() .sourceBufferSize(); }
@Inject public KafkaTopicFactory(ServiceInfo serviceInfo, ActorSystem system, Materializer materializer, ExecutionContext executionContext, ServiceLocator serviceLocator) { this.serviceInfo = serviceInfo; this.system = system; this.materializer = materializer; this.executionContext = executionContext; // TODO: expose KafkaConfig as a constructor argument instead of building one from system.settings().config() // https://github.com/lagom/lagom/issues/1255 this.config = KafkaConfig$.MODULE$.apply(system.settings().config()); this.serviceLocator = serviceLocator; }
private ThingsSearchIndexDeletionActor(final MongoClientWrapper mongoClientWrapper) { final Config config = getContext().getSystem().settings().config(); age = config.getDuration(ConfigKeys.DELETION_AGE); runInterval = config.getDuration(ConfigKeys.DELETION_RUN_INTERVAL); firstIntervalHour = config.getInt(ConfigKeys.DELETION_FIRST_INTERVAL_HOUR); if (firstIntervalHour < 0 || firstIntervalHour > 23) { throw new ConfigurationException( "The configured <" + ConfigKeys.DELETION_FIRST_INTERVAL_HOUR + "> must be" + "between 0 and 23"); } actorMaterializer = ActorMaterializer.create(getContext()); collection = mongoClientWrapper.getDatabase().getCollection(THINGS_COLLECTION_NAME); }
/** * Initializes the things search persistence with a passed in {@code persistence}. * * @param clientWrapper the mongoDB persistence wrapper. * @param actorSystem the Akka ActorSystem. */ public MongoThingsSearchPersistence(final MongoClientWrapper clientWrapper, final ActorSystem actorSystem) { collection = clientWrapper.getDatabase().getCollection(PersistenceConstants.THINGS_COLLECTION_NAME); log = Logging.getLogger(actorSystem, getClass()); materializer = ActorMaterializer.create(actorSystem); indexInitializer = IndexInitializer.of(clientWrapper.getDatabase(), materializer); maxQueryTime = MongoConfig.getMaxQueryTime(actorSystem.settings().config()); }
/** * Adds security related HTTP headers to the response. * * @param inner the inner Route to wrap with the response headers * @return the new Route wrapping {@code inner} with the response headers */ public static Route addSecurityResponseHeaders(final Supplier<Route> inner) { return Directives.extractActorSystem(actorSystem -> { final Config config = actorSystem.settings().config(); final Iterable<HttpHeader> securityResponseHeaders = createSecurityResponseHeaders(config); return respondWithHeaders(securityResponseHeaders, inner); }); }
private boolean isMetricsCaptureEnabled(){ CommonConfig config = new CommonConfig(getContext().system().settings().config()); return config.isMetricCaptureEnabled(); }
private boolean isMetricsCaptureEnabled() { CommonConfig config = new CommonConfig(getContext().system().settings().config()); return config.isMetricCaptureEnabled(); }
private boolean isMetricsCaptureEnabled() { CommonConfig config = new CommonConfig(getContext().system().settings().config()); return config.isMetricCaptureEnabled(); }
private static Config getFallbackConfig(final ActorSystem actorSystem) { final ActorSystem.Settings settings = actorSystem.settings(); final Config config = settings.config(); return config.getConfig(FALLBACK_CONFIG_PATH); }
MqttClientActor(final Connection connection, final ConnectionStatus desiredConnectionStatus, final ActorRef conciergeForwarder, final BiFunction<Connection, DittoHeaders, MqttConnectionFactory> connectionFactoryCreator) { super(connection, desiredConnectionStatus, conciergeForwarder); this.connectionFactoryCreator = connectionFactoryCreator; consumerByActorNameWithIndex = new HashMap<>(); pendingStatusReportsFromStreams = new HashSet<>(); sourceBufferSize = ConnectionConfigReader.fromRawConfig(getContext().system().settings().config()) .mqtt() .sourceBufferSize(); }
public Simulator() { Config config = context().system().settings().config().getConfig("caffeine.simulator"); settings = new BasicSettings(config); List<Routee> routes = makeRoutes(); router = new Router(new BroadcastRoutingLogic(), routes); remaining = routes.size(); batchSize = settings.batchSize(); stopwatch = Stopwatch.createStarted(); reporter = settings.report().format().create(config); }
private boolean isMetricsCaptureEnabled(){ CommonConfig config = new CommonConfig(getContext().system().settings().config()); return config.isMetricCaptureEnabled(); } }
public MeteredBoundedMailbox(ActorSystem.Settings settings, Config config) { CommonConfig commonConfig = new CommonConfig(settings.config()); this.capacity = commonConfig.getMailBoxCapacity(); this.pushTimeOut = commonConfig.getMailBoxPushTimeout(); MetricsReporter reporter = MetricsReporter.getInstance(MeteringBehavior.DOMAIN); registry = reporter.getMetricsRegistry(); }
private boolean isMetricsCaptureEnabled() { CommonConfig config = new CommonConfig(getContext().system().settings().config()); return config.isMetricCaptureEnabled(); } }
public MeteredBoundedMailbox(final ActorSystem.Settings settings, final Config config) { CommonConfig commonConfig = new CommonConfig(settings.config()); this.capacity = commonConfig.getMailBoxCapacity(); this.pushTimeOut = commonConfig.getMailBoxPushTimeout(); }