本文整理了Java中akka.event.Logging.DebugLevel()
方法的一些代码示例,展示了Logging.DebugLevel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logging.DebugLevel()
方法的具体详情如下:
包路径:akka.event.Logging
类名称:Logging
方法名:DebugLevel
暂无
代码示例来源:origin: eclipse/ditto
/**
* Create a processing unit from a function.
*
* @param self reference to the actor carrying the pre-enforcement.
* @param processor function to call.
* @return Akka stream graph.
*/
static Graph<FlowShape<WithSender, WithSender>, NotUsed> fromFunction(
@Nullable final ActorRef self,
final Function<WithDittoHeaders, CompletionStage<WithDittoHeaders>> processor) {
final Attributes logLevels =
Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(), Logging.ErrorLevel());
final Flow<WithSender<WithDittoHeaders>, WithSender, NotUsed> flow =
Flow.<WithSender<WithDittoHeaders>>create()
.mapAsync(1, wrapped -> {
final Supplier<CompletionStage<Object>> futureSupplier = () ->
processor.apply(wrapped.getMessage())
.<Object>thenApply(result -> WithSender.of(result, wrapped.getSender()));
return handleErrorNowOrLater(futureSupplier, wrapped, self);
})
.log("PreEnforcer")
.withAttributes(logLevels)
.flatMapConcat(PreEnforcer::keepResultAndLogErrors);
return Pipe.joinUnhandledSink(
Pipe.joinFilteredFlow(Filter.of(WithDittoHeaders.class), flow), unhandled());
}
代码示例来源:origin: eclipse/ditto
private Sink<Message, NotUsed> createSink(final Integer version, final String connectionCorrelationId,
final AuthorizationContext connectionAuthContext, final DittoHeaders additionalHeaders,
final ProtocolAdapter adapter) {
return Flow.<Message>create()
.filter(Message::isText)
.map(Message::asTextMessage)
.map(textMsg -> {
if (textMsg.isStrict()) {
return Source.single(textMsg.getStrictText());
} else {
return textMsg.getStreamedText();
}
})
.flatMapConcat(textMsg -> textMsg.<String>fold("", (str1, str2) -> str1 + str2))
.via(Flow.fromFunction(result -> {
LogUtil.logWithCorrelationId(LOGGER, connectionCorrelationId, logger ->
logger.debug("Received incoming WebSocket message: {}", result));
return result;
}))
.withAttributes(Attributes.createLogLevels(Logging.DebugLevel(), Logging.DebugLevel(),
Logging.WarningLevel()))
.filter(strictText -> processProtocolMessage(connectionAuthContext, connectionCorrelationId,
strictText))
.map(buildSignal(version, connectionCorrelationId, connectionAuthContext, additionalHeaders, adapter))
.to(Sink.actorSubscriber(
CommandSubscriber.props(streamingActor, subscriberBackpressureQueueSize, eventStream)));
}
内容来源于网络,如有侵权,请联系作者删除!