String getActorNamePrefix() { return AmqpConsumerActor.ACTOR_NAME_PREFIX + source.getIndex() + "-" + addressWithIndex; }
@Override public int getIndex() { return delegate.getIndex(); }
@Override public int getIndex() { return delegate.getIndex(); }
String getActorNamePrefix() { return AmqpConsumerActor.ACTOR_NAME_PREFIX + source.getIndex() + "-" + addressWithIndex; }
/** * Obtain a supplier of a description of a source of a connection. * * @param source the source. * @param connection the connection. * @return supplier of the description. */ private static Supplier<String> sourceDescription(final Source source, final Connection connection) { return () -> MessageFormat.format("Source of index {0} of connection ''{1}''", source.getIndex(), connection.getId()); }
/** * Obtain a supplier of a description of a source of a connection. * * @param source the source. * @param connection the connection. * @return supplier of the description. */ private static Supplier<String> sourceDescription(final Source source, final Connection connection) { return () -> MessageFormat.format("Source of index {0} of connection ''{1}''", source.getIndex(), connection.getId()); }
@Override protected CompletionStage<Map<String, AddressMetric>> getSourceConnectionStatus(final Source source) { return collectAsList(IntStream.range(0, source.getConsumerCount()) .mapToObj(idx -> { final String topics = String.join(",", source.getAddresses()); final String actorLabel = MqttConsumerActor.ACTOR_NAME_PREFIX + getUniqueSourceSuffix(source.getIndex(), idx); final ActorRef consumer = consumerByActorNameWithIndex.get(actorLabel); return retrieveAddressMetric(topics, actorLabel, consumer); })) .thenApply(entries -> entries.stream().collect(Collectors.toMap(Pair::first, Pair::second))); }
@Override protected CompletionStage<Map<String, AddressMetric>> getSourceConnectionStatus(final Source source) { return collectAsList(IntStream.range(0, source.getConsumerCount()) .mapToObj(idx -> { final String topics = String.join(",", source.getAddresses()); final String actorLabel = MqttConsumerActor.ACTOR_NAME_PREFIX + getUniqueSourceSuffix(source.getIndex(), idx); final ActorRef consumer = consumerByActorNameWithIndex.get(actorLabel); return retrieveAddressMetric(topics, actorLabel, consumer); })) .thenApply(entries -> entries.stream().collect(Collectors.toMap(Pair::first, Pair::second))); }
private void validateSourceAndTargetAddressesAreNonempty(final Connection connection, final DittoHeaders dittoHeaders) { connection.getSources().forEach(source -> { if (source.getAddresses().isEmpty() || source.getAddresses().contains("")) { final String location = String.format("Source %d of connection <%s>", source.getIndex(), connection.getId()); throw emptyAddressesError(location, dittoHeaders); } }); connection.getTargets().forEach(target -> { if (target.getAddress().isEmpty()) { final String location = String.format("Targets of connection <%s>", connection.getId()); throw emptyAddressesError(location, dittoHeaders); } target.getTopics().forEach(topic -> topic.getFilter().ifPresent(filter -> { // will throw an InvalidRqlExpressionException if the RQL expression was not valid: queryFilterCriteriaFactory.filterCriteria(filter, dittoHeaders); })); }); }
private void validateSourceAndTargetAddressesAreNonempty(final Connection connection, final DittoHeaders dittoHeaders) { connection.getSources().forEach(source -> { if (source.getAddresses().isEmpty() || source.getAddresses().contains("")) { final String location = String.format("Source %d of connection <%s>", source.getIndex(), connection.getId()); throw emptyAddressesError(location, dittoHeaders); } }); connection.getTargets().forEach(target -> { if (target.getAddress().isEmpty()) { final String location = String.format("Targets of connection <%s>", connection.getId()); throw emptyAddressesError(location, dittoHeaders); } target.getTopics().forEach(topic -> topic.getFilter().ifPresent(filter -> { // will throw an InvalidRqlExpressionException if the RQL expression was not valid: queryFilterCriteriaFactory.filterCriteria(filter, dittoHeaders); })); }); }
log.info("source #{} has {} consumer - not starting stream", source.getIndex(), source.getConsumerCount()); return; log.debug("Starting {}. consumer actor for source <{}> on connection <{}>.", i, source.getIndex(), factory.connectionId()); final String uniqueSuffix = getUniqueSourceSuffix(source.getIndex(), i); final String actorNamePrefix = MqttConsumerActor.ACTOR_NAME_PREFIX + uniqueSuffix;
log.info("source #{} has {} consumer - not starting stream", source.getIndex(), source.getConsumerCount()); return; log.debug("Starting {}. consumer actor for source <{}> on connection <{}>.", i, source.getIndex(), factory.connectionId()); final String uniqueSuffix = getUniqueSourceSuffix(source.getIndex(), i); final String actorNamePrefix = MqttConsumerActor.ACTOR_NAME_PREFIX + uniqueSuffix;