akka.event.Logging.DebugLevel()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(117)

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

Logging.DebugLevel介绍

暂无

代码示例

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

  1. /**
  2. * Create a processing unit from a function.
  3. *
  4. * @param self reference to the actor carrying the pre-enforcement.
  5. * @param processor function to call.
  6. * @return Akka stream graph.
  7. */
  8. static Graph<FlowShape<WithSender, WithSender>, NotUsed> fromFunction(
  9. @Nullable final ActorRef self,
  10. final Function<WithDittoHeaders, CompletionStage<WithDittoHeaders>> processor) {
  11. final Attributes logLevels =
  12. Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(), Logging.ErrorLevel());
  13. final Flow<WithSender<WithDittoHeaders>, WithSender, NotUsed> flow =
  14. Flow.<WithSender<WithDittoHeaders>>create()
  15. .mapAsync(1, wrapped -> {
  16. final Supplier<CompletionStage<Object>> futureSupplier = () ->
  17. processor.apply(wrapped.getMessage())
  18. .<Object>thenApply(result -> WithSender.of(result, wrapped.getSender()));
  19. return handleErrorNowOrLater(futureSupplier, wrapped, self);
  20. })
  21. .log("PreEnforcer")
  22. .withAttributes(logLevels)
  23. .flatMapConcat(PreEnforcer::keepResultAndLogErrors);
  24. return Pipe.joinUnhandledSink(
  25. Pipe.joinFilteredFlow(Filter.of(WithDittoHeaders.class), flow), unhandled());
  26. }

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

  1. private Sink<Message, NotUsed> createSink(final Integer version, final String connectionCorrelationId,
  2. final AuthorizationContext connectionAuthContext, final DittoHeaders additionalHeaders,
  3. final ProtocolAdapter adapter) {
  4. return Flow.<Message>create()
  5. .filter(Message::isText)
  6. .map(Message::asTextMessage)
  7. .map(textMsg -> {
  8. if (textMsg.isStrict()) {
  9. return Source.single(textMsg.getStrictText());
  10. } else {
  11. return textMsg.getStreamedText();
  12. }
  13. })
  14. .flatMapConcat(textMsg -> textMsg.<String>fold("", (str1, str2) -> str1 + str2))
  15. .via(Flow.fromFunction(result -> {
  16. LogUtil.logWithCorrelationId(LOGGER, connectionCorrelationId, logger ->
  17. logger.debug("Received incoming WebSocket message: {}", result));
  18. return result;
  19. }))
  20. .withAttributes(Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(),
  21. Logging.WarningLevel()))
  22. .filter(strictText -> processProtocolMessage(connectionAuthContext, connectionCorrelationId,
  23. strictText))
  24. .map(buildSignal(version, connectionCorrelationId, connectionAuthContext, additionalHeaders, adapter))
  25. .to(Sink.actorSubscriber(
  26. CommandSubscriber.props(streamingActor, subscriberBackpressureQueueSize, eventStream)));
  27. }

相关文章