PcDateUtils.getNowDateTimeStrStandard(), null); if (!getContext().system().deadLetters().equals(sender)) { sender.tell(res, getSelf());
statusCodeInt, PcDateUtils.getNowDateTimeStrStandard(), responseHeaders); if (!getContext().system().deadLetters().equals(sender)) { sender.tell(res, getSelf());
&& !sender.equals(getContext().system().deadLetters())) {
PcDateUtils.getNowDateTimeStrStandard(), null); if (!getContext().system().deadLetters().equals(sender)) { sender.tell(res, getSelf());
response, error, errorMessage, stackTrace, statusCode, statusCodeInt, PcDateUtils.getNowDateTimeStrStandard(), null); if (!getContext().system().deadLetters().equals(sender)) { sender.tell(res, getSelf());
response, error, errorMessage, stackTrace, statusCode, statusCodeInt, PcDateUtils.getNowDateTimeStrStandard(), null); if (!getContext().system().deadLetters().equals(sender)) {
protected boolean isValidSender(final ActorRef sender) { // If the caller passes in a null sender (ActorRef.noSender()), akka translates that to the // deadLetters actor. return sender != null && !getContext().system().deadLetters().equals(sender); } }
protected boolean isValidSender(ActorRef sender) { // If the caller passes in a null sender (ActorRef.noSender()), akka translates that to the // deadLetters actor. return sender != null && !getContext().system().deadLetters().equals(sender); } }
private BaseClientData setSession(final BaseClientData data, final ActorRef sender, final DittoHeaders headers) { if (!Objects.equals(sender, getSelf()) && !Objects.equals(sender, getContext().system().deadLetters())) { return data.setSessionSender(sender) .setSessionHeaders(headers); } else { return data.resetSession(); } }
private BaseClientData setSession(final BaseClientData data, final ActorRef sender, final DittoHeaders headers) { if (!Objects.equals(sender, getSelf()) && !Objects.equals(sender, getContext().system().deadLetters())) { return data.setSessionSender(sender) .setSessionHeaders(headers); } else { return data.resetSession(); } }
private MqttConsumerActor(final ActorRef messageMappingProcessor, final AuthorizationContext sourceAuthorizationContext, @Nullable final Enforcement enforcement, final boolean dryRun) { this.messageMappingProcessor = messageMappingProcessor; this.sourceAuthorizationContext = sourceAuthorizationContext; this.dryRun = dryRun; addressMetric = ConnectivityModelFactory.newAddressMetric(ConnectionStatus.OPEN, "Started at " + Instant.now(), 0, null); deadLetters = getContext().system().deadLetters(); if (enforcement != null) { this.topicEnforcementFilterFactory = EnforcementFactoryFactory.newEnforcementFilterFactory(enforcement, PlaceholderFactory.newSourceAddressPlaceholder()); } else { topicEnforcementFilterFactory = null; } }
private MqttConsumerActor(final ActorRef messageMappingProcessor, final AuthorizationContext sourceAuthorizationContext, @Nullable final Enforcement enforcement, final boolean dryRun) { this.messageMappingProcessor = messageMappingProcessor; this.sourceAuthorizationContext = sourceAuthorizationContext; this.dryRun = dryRun; addressMetric = ConnectivityModelFactory.newAddressMetric(ConnectionStatus.OPEN, "Started at " + Instant.now(), 0, null); deadLetters = getContext().system().deadLetters(); if (enforcement != null) { this.topicEnforcementFilterFactory = EnforcementFactoryFactory.newEnforcementFilterFactory(enforcement, PlaceholderFactory.newSourceAddressPlaceholder()); } else { topicEnforcementFilterFactory = null; } }
private <M> void forwardToShardRegion(final M message, final Function<M, String> getId, final Function<M, String> getType, final Function<M, JsonObject> toJson, final Function<M, DittoHeaders> getDittoHeaders) { final String id = getId.apply(message); log.debug("Forwarding incoming {} to shard region of {}", message.getClass().getSimpleName(), id); final String type = getType.apply(message); final JsonObject jsonObject = toJson.apply(message); final DittoHeaders dittoHeaders = getDittoHeaders.apply(message); final ShardedMessageEnvelope messageEnvelope = ShardedMessageEnvelope.of(id, type, jsonObject, dittoHeaders); final ActorRef sender = getSender(); final ActorRef deadLetters = getContext().getSystem().deadLetters(); namespaceBlockingBehavior .block(messageEnvelope) .thenAccept(m -> shardRegion.tell(m, sender)) .exceptionally(throwable -> { if (!Objects.equals(sender, deadLetters)) { // Only acknowledge IdentifiableStreamingMessage. No other messages should be acknowledged. if (message instanceof IdentifiableStreamingMessage) { final StreamAck streamAck = StreamAck.success(((IdentifiableStreamingMessage) message).asIdentifierString()); sender.tell(streamAck, getSelf()); } } return null; }); }
private State<BaseClientState, BaseClientData> onUnknownEvent(final Object event, final BaseClientData state) { log.warning("received unknown/unsupported message {} in state {} - status: {} - sender: {}", event, stateName(), state.getConnectionStatus() + ": " + state.getConnectionStatusDetails().orElse(""), getSender()); final ActorRef sender = getSender(); if (!Objects.equals(sender, getSelf()) && !Objects.equals(sender, getContext().system().deadLetters())) { sender.tell(unhandledExceptionForSignalInState(event, stateName()), getSelf()); } return stay(); }
private void dataChanged(final DataTreeChanged message) { // Do nothing if notifications are not enabled if (!notificationsEnabled) { LOG.debug("Notifications not enabled for listener {} - dropping change notification", listener); return; } LOG.debug("Sending change notification {} to listener {}", message.getChanges(), listener); try { this.listener.onDataTreeChanged(message.getChanges()); } catch (Exception e) { LOG.error("Error notifying listener {}", this.listener, e); } // TODO: do we really need this? // It seems the sender is never null but it doesn't hurt to check. If the caller passes in // a null sender (ActorRef.noSender()), akka translates that to the deadLetters actor. if (getSender() != null && !getContext().system().deadLetters().equals(getSender())) { getSender().tell(DataTreeChangedReply.getInstance(), getSelf()); } }
private void onCreateShard(CreateShard createShard) { LOG.debug("{}: onCreateShard: {}", persistenceId(), createShard); Object reply; try { String shardName = createShard.getModuleShardConfig().getShardName(); if(localShards.containsKey(shardName)) { LOG.debug("{}: Shard {} already exists", persistenceId(), shardName); reply = new Status.Success(String.format("Shard with name %s already exists", shardName)); } else { doCreateShard(createShard); reply = new Status.Success(null); } } catch (Exception e) { LOG.error("{}: onCreateShard failed", persistenceId(), e); reply = new Status.Failure(e); } if(getSender() != null && !getContext().system().deadLetters().equals(getSender())) { getSender().tell(reply, getSelf()); } }
} else { final ActorRef syncAckRecipient = activeSyncMetadata.getAckRecipient(); final ActorRef deadLetters = getContext().getSystem().deadLetters(); if (Objects.equals(syncAckRecipient, deadLetters)) {
} else { final ActorRef syncAckRecipient = activeSyncMetadata.getAckRecipient(); final ActorRef deadLetters = getContext().getSystem().deadLetters(); if (Objects.equals(syncAckRecipient, deadLetters)) {
private State<BaseClientState, BaseClientData> onUnknownEvent(final Object event, final BaseClientData state) { Object message = event; if (event instanceof Failure) { message = ((Failure) event).cause(); } if (event instanceof Status.Failure) { message = ((Status.Failure) event).cause(); } if (message instanceof Throwable) { log.error((Throwable) message, "received Exception {} in state {} - status: {} - sender: {}", message, stateName(), state.getConnectionStatus() + ": " + state.getConnectionStatusDetails().orElse(""), getSender()); } else { log.warning("received unknown/unsupported message {} in state {} - status: {} - sender: {}", message, stateName(), state.getConnectionStatus() + ": " + state.getConnectionStatusDetails().orElse(""), getSender()); } final ActorRef sender = getSender(); if (!Objects.equals(sender, getSelf()) && !Objects.equals(sender, getContext().system().deadLetters())) { sender.tell(unhandledExceptionForSignalInState(event, stateName()), getSelf()); } return stay(); }
response, error, errorMessage, stackTrace, statusCode, statusCodeInt, PcDateUtils.getNowDateTimeStrStandard(), null); if (!getContext().system().deadLetters().equals(sender)) { sender.tell(res, getSelf());