/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the {@code INFO} * logging level and {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category. * <p> The full request {@link Message} will be logged. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log() { return log(LoggingHandler.Level.INFO); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided logging category * and {@code INFO} logging level. * <p> The full request {@link Message} will be logged. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param category the logging category to use. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log(String category) { return log(LoggingHandler.Level.INFO, category); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level and logging category. * <p> The full request {@link Message} will be logged. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param level the {@link LoggingHandler.Level}. * @param category the logging category to use. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log(LoggingHandler.Level level, String category) { return log(level, category, (Expression) null); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for provided {@link LoggingHandler.Level} * logging level and {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category. * <p> The full request {@link Message} will be logged. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param level the {@link LoggingHandler.Level}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log(LoggingHandler.Level level) { return log(level, (String) null); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the {@code INFO} logging level, * the {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category and SpEL expression to evaluate * logger message at runtime against the request {@link Message}. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param logExpression the {@link Expression} to evaluate logger message at runtime * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log(Expression logExpression) { return log(LoggingHandler.Level.INFO, logExpression); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level, * the {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category and SpEL expression to evaluate * logger message at runtime against the request {@link Message}. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param level the {@link LoggingHandler.Level}. * @param logExpression the {@link Expression} to evaluate logger message at runtime * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log(LoggingHandler.Level level, Expression logExpression) { return log(level, null, logExpression); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the {@code INFO} * {@link LoggingHandler.Level} logging level, * the provided logging category and SpEL expression to evaluate * logger message at runtime against the request {@link Message}. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param category the logging category. * @param logExpression the {@link Expression} to evaluate logger message at runtime * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log(String category, Expression logExpression) { return log(LoggingHandler.Level.INFO, category, logExpression); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level, * the provided logging category and {@link Function} for the log message. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param category the logging category. * @param function the function to evaluate logger message at runtime * @param <P> the expected payload type. * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public <P> B log(String category, Function<Message<P>, Object> function) { return log(LoggingHandler.Level.INFO, category, function); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level, * the {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category and {@link Function} for the log message. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param level the {@link LoggingHandler.Level}. * @param function the function to evaluate logger message at runtime * @param <P> the expected payload type. * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public <P> B log(LoggingHandler.Level level, Function<Message<P>, Object> function) { return log(level, null, function); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the {@code INFO} logging level, * the {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category and {@link Function} for the log message. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param function the function to evaluate logger message at runtime * @param <P> the expected payload type. * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public <P> B log(Function<Message<P>, Object> function) { Assert.notNull(function, "'function' must not be null"); return log(new FunctionExpression<>(function)); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level, logging category * and SpEL expression for the log message. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param level the {@link LoggingHandler.Level}. * @param category the logging category. * @param logExpression the SpEL expression to evaluate logger message at runtime * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public B log(LoggingHandler.Level level, String category, String logExpression) { Assert.hasText(logExpression, "'logExpression' must not be empty"); return log(level, category, PARSER.parseExpression(logExpression)); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level, logging category * and {@link Function} for the log message. * <p> When this operator is used in the end of flow, it is treated * as one-way handler without any replies to continue. * The {@link #logAndReply()} should be used for request-reply configuration. * @param level the {@link LoggingHandler.Level}. * @param category the logging category. * @param function the function to evaluate logger message at runtime * @param <P> the expected payload type. * against the request {@link Message}. * @return the current {@link IntegrationFlowDefinition}. * @see #wireTap(WireTapSpec) */ public <P> B log(LoggingHandler.Level level, String category, Function<Message<P>, Object> function) { Assert.notNull(function, "'function' must not be null"); return log(level, category, new FunctionExpression<>(function)); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level, logging category * and SpEL expression for the log message. * <p> A {@link #bridge()} is added after this operator to make the flow reply-producing * if the {@code replyChannel} header is present. * <p> This operator can be used only in the end of flow. * @param level the {@link LoggingHandler.Level}. * @param category the logging category. * @param logExpression the {@link Expression} to evaluate logger message at runtime * against the request {@link Message}. * @return an {@link IntegrationFlow} instance based on this builder. * @see #log() * @see #bridge() */ public IntegrationFlow logAndReply(LoggingHandler.Level level, String category, Expression logExpression) { return log(level, category, logExpression) .bridge() .get(); }
@Override public void configure(IntegrationFlowDefinition<?> f) { f.<String, String>transform(String::toUpperCase) .log(LoggingHandler.Level.ERROR, m -> { resultOverLoggingHandler.set(m.getPayload()); return m; }); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the {@code INFO} * logging level and {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category. * <p> The full request {@link Message} will be logged. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B log() { return log(LoggingHandler.Level.INFO); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided logging category * and {@code INFO} logging level. * <p> The full request {@link Message} will be logged. * @param category the logging category to use. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B log(String category) { return log(LoggingHandler.Level.INFO, category); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the {@code INFO} * logging level and {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category. * <p> The full request {@link Message} will be logged. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B log() { return log(LoggingHandler.Level.INFO); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided * {@link LoggingHandler.Level} logging level and logging category. * <p> The full request {@link Message} will be logged. * @param level the {@link LoggingHandler.Level}. * @param category the logging category to use. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B log(LoggingHandler.Level level, String category) { return log(level, category, (Expression) null); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for the provided logging category * and {@code INFO} logging level. * <p> The full request {@link Message} will be logged. * @param category the logging category to use. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B log(String category) { return log(LoggingHandler.Level.INFO, category); }
/** * Populate a {@link WireTap} for the {@link #currentMessageChannel} * with the {@link LoggingHandler} subscriber for provided {@link LoggingHandler.Level} * logging level and {@code org.springframework.integration.handler.LoggingHandler} * as a default logging category. * <p> The full request {@link Message} will be logged. * @param level the {@link LoggingHandler.Level}. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B log(LoggingHandler.Level level) { return log(level, (String) null); }