@Override public Set<FilteredTopic> getTopics() { return delegate.getTopics(); }
@Override public Set<FilteredTopic> getTopics() { return delegate.getTopics(); }
private boolean isTargetSubscribedForTopic(final Target target, final Signal<?> signal) { return target.getTopics().stream() .filter(applyTopicFilter(signal)) .filter(applyRqlFilter(signal)) .anyMatch(applyNamespaceFilter(signal)); }
private boolean isTargetSubscribedForTopic(final Target target, final Signal<?> signal) { return target.getTopics().stream() .filter(applyTopicFilter(signal)) .filter(applyRqlFilter(signal)) .anyMatch(applyNamespaceFilter(signal)); }
/** * Creates a new {@link Target} from existing target but different address. * * @param target the target * @param address the address where the signals will be published * @return the created {@link Target} */ public static Target newTarget(final Target target, final String address) { return newTarget(address, target.getAuthorizationContext(), target.getHeaderMapping().orElse(null), target.getTopics()); }
/** * Creates a new {@link Target} from existing target but different address. * * @param target the target * @param address the address where the signals will be published * @return the created {@link Target} */ public static Target newTarget(final Target target, final String address) { return newTarget(address, target.getAuthorizationContext(), target.getHeaderMapping().orElse(null), target.getTopics()); }
private void subscribeForEvents() { checkConnectionNotNull(); // unsubscribe to previously subscribed topics unsubscribeFromEvents(); uniqueTopics = connection.getTargets().stream() .flatMap(target -> target.getTopics().stream().map(FilteredTopic::getTopic)) .collect(Collectors.toSet()); forEachPubSubTopicDo(pubSubTopic -> { final DistributedPubSubMediator.Subscribe subscribe = new DistributedPubSubMediator.Subscribe(pubSubTopic, PUB_SUB_GROUP_PREFIX + connectionId, getSelf()); log.debug("Subscribing to pub-sub topic <{}> for connection <{}>.", pubSubTopic, connectionId); pubSubMediator.tell(subscribe, getSelf()); }); }
private void subscribeForEvents() { checkConnectionNotNull(); // unsubscribe to previously subscribed topics unsubscribeFromEvents(); uniqueTopics = connection.getTargets().stream() .flatMap(target -> target.getTopics().stream().map(FilteredTopic::getTopic)) .collect(Collectors.toSet()); forEachPubSubTopicDo(pubSubTopic -> { final DistributedPubSubMediator.Subscribe subscribe = new DistributedPubSubMediator.Subscribe(pubSubTopic, PUB_SUB_GROUP_PREFIX + connectionId, getSelf()); log.debug("Subscribing to pub-sub topic <{}> for connection <{}>.", pubSubTopic, connectionId); pubSubMediator.tell(subscribe, getSelf()); }); }
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); })); }); }