private MqttPublisherActor(final MqttConnectionFactory factory, final ActorRef mqttClientActor, final boolean dryRun) { this.mqttClientActor = mqttClientActor; this.dryRun = dryRun; final Sink<MqttMessage, CompletionStage<Done>> mqttSink = factory.newSink(); final Pair<ActorRef, CompletionStage<Done>> materializedValues = Source.<MqttMessage>actorRef(100, OverflowStrategy.dropHead()) .map(this::countPublishedMqttMessage) .toMat(mqttSink, Keep.both()) .run(ActorMaterializer.create(getContext())); materializedValues.second().handle(this::reportReadiness); sourceActor = materializedValues.first(); addressMetric = ConnectivityModelFactory.newAddressMetric(ConnectionStatus.OPEN, "Started at " + Instant.now(), 0, null); }
private MqttPublisherActor(final MqttConnectionFactory factory, final ActorRef mqttClientActor, final boolean dryRun) { this.mqttClientActor = mqttClientActor; this.dryRun = dryRun; final Sink<MqttMessage, CompletionStage<Done>> mqttSink = factory.newSink(); final Pair<ActorRef, CompletionStage<Done>> materializedValues = Source.<MqttMessage>actorRef(100, OverflowStrategy.dropHead()) .map(this::countPublishedMqttMessage) .toMat(mqttSink, Keep.both()) .run(ActorMaterializer.create(getContext())); materializedValues.second().handle(this::reportReadiness); sourceActor = materializedValues.first(); addressMetric = ConnectivityModelFactory.newAddressMetric(ConnectionStatus.OPEN, "Started at " + Instant.now(), 0, null); }
public PlayAsyncIOWriter(final Http.Request request, final Map<String, Object> additionalAttributes, final Http.Response response) { final String[] transport = request.queryString() != null ? request.queryString().get(HeaderConfig.X_ATMOSPHERE_TRANSPORT) : null; this.source = Source.<ByteString>actorRef(BUFFER_SIZE, OverflowStrategy.dropNew()).mapMaterializedValue(actorRef -> { out = new OutStream() { @Override