akka.stream.javadsl.Source.filterNot()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中akka.stream.javadsl.Source.filterNot()方法的一些代码示例,展示了Source.filterNot()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Source.filterNot()方法的具体详情如下:
包路径:akka.stream.javadsl.Source
类名称:Source
方法名:filterNot

Source.filterNot介绍

暂无

代码示例

代码示例来源:origin: eclipse/ditto

private void retrieveThingsAndSendResult(final List<String> thingIds,
    @Nullable final JsonFieldSelector selectedFields,
    final Command<?> command, final ActorRef resultReceiver) {
  final DittoHeaders dittoHeaders = command.getDittoHeaders();
  final CompletionStage<?> commandResponseSource = Source.from(thingIds)
      .filter(Objects::nonNull)
      .filterNot(String::isEmpty)
      .filter(thingId -> THING_ID_PATTERN.matcher(thingId).matches())
      .map(thingId -> {
        final Command<?> toBeWrapped;
        if (command instanceof RetrieveThings) {
          toBeWrapped = Optional.ofNullable(selectedFields)
              .map(sf -> RetrieveThing.getBuilder(thingId, dittoHeaders)
                  .withSelectedFields(sf)
                  .build())
              .orElse(RetrieveThing.of(thingId, dittoHeaders));
        } else {
          toBeWrapped = Optional.ofNullable(selectedFields)
              .map(sf -> SudoRetrieveThing.of(thingId, sf, dittoHeaders))
              .orElse(SudoRetrieveThing.of(thingId, dittoHeaders));
        }
        return ConciergeWrapper.wrapForEnforcer(toBeWrapped);
      })
      .ask(calculateParallelism(thingIds), targetActor, Jsonifiable.class,
          Timeout.apply(retrieveSingleThingTimeout.toMillis(), TimeUnit.MILLISECONDS))
      .log("command-response", log)
      .runWith(StreamRefs.sourceRef(), actorMaterializer);
  PatternsCS.pipe(commandResponseSource, aggregatorDispatcher)
      .to(resultReceiver);
}

代码示例来源:origin: eclipse/ditto

(CompletionStage<List<PlainJson>>) sourceRef.getSource()
    .orElse(Source.single(ThingNotAccessibleException.newBuilder("").build()))
    .filterNot(el -> el instanceof DittoRuntimeException)
    .map(param -> thingPlainJsonSupplier.apply((Jsonifiable<?>) param))
    .log("retrieve-thing-response", log)

相关文章