/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * f -> f.wireTap("tapChannel") * .handle(p -> process(p)) * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} bean name to wire-tap. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(String wireTapChannel) { return wireTap(wireTapChannel, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .transform("payload") * .wireTap(tapChannel()) * .channel("foo") * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} to wire-tap. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(MessageChannel wireTapChannel) { return wireTap(wireTapChannel, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .filter("World"::equals) * .wireTap(sf -> sf.<String, String>transform(String::toUpperCase)) * .handle(p -> process(p)) * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param flow the {@link IntegrationFlow} for wire-tap subflow as an alternative to the {@code wireTapChannel}. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(IntegrationFlow flow) { return wireTap(flow, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .transform("payload") * .wireTap(sf -> sf.<String, String>transform(String::toUpperCase), wt -> wt.selector("payload == 'foo'")) * .channel("foo") * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param flow the {@link IntegrationFlow} for wire-tap subflow as an alternative to the {@code wireTapChannel}. * @param wireTapConfigurer the {@link Consumer} to accept options for the {@link WireTap}. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(IntegrationFlow flow, Consumer<WireTapSpec> wireTapConfigurer) { MessageChannel wireTapChannel = obtainInputChannelFromFlow(flow); return wireTap(wireTapChannel, wireTapConfigurer); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .transform("payload") * .wireTap(tapChannel(), wt -> wt.selector(m -> m.getPayload().equals("foo"))) * .channel("foo") * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} to wire-tap. * @param wireTapConfigurer the {@link Consumer} to accept options for the {@link WireTap}. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(MessageChannel wireTapChannel, Consumer<WireTapSpec> wireTapConfigurer) { WireTapSpec wireTapSpec = new WireTapSpec(wireTapChannel); if (wireTapConfigurer != null) { wireTapConfigurer.accept(wireTapSpec); } addComponent(wireTapChannel); return wireTap(wireTapSpec); }
@Bean public IntegrationFlow wireTapFlow2() { return f -> f .wireTap("tapChannel", wt -> wt.selector(m -> m.getPayload().equals("foo"))) .handle(loggingMessageHandler()); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .transform("payload") * .wireTap("tapChannel", wt -> wt.selector(m -> m.getPayload().equals("foo"))) * .channel("foo") * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} bean name to wire-tap. * @param wireTapConfigurer the {@link Consumer} to accept options for the {@link WireTap}. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(String wireTapChannel, Consumer<WireTapSpec> wireTapConfigurer) { DirectChannel internalWireTapChannel = new DirectChannel(); addComponent(IntegrationFlows.from(internalWireTapChannel).channel(wireTapChannel).get()); return wireTap(internalWireTapChannel, wireTapConfigurer); }
/** * 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 {@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, String category, Expression logExpression) { LoggingHandler loggingHandler = new LoggingHandler(level); if (StringUtils.hasText(category)) { loggingHandler.setLoggerName(category); } if (logExpression != null) { loggingHandler.setLogExpression(logExpression); } else { loggingHandler.setShouldLogFullMessage(true); } addComponent(loggingHandler); MessageChannel loggerChannel = new FixedSubscriberChannel(loggingHandler); return wireTap(loggerChannel); }
@Bean public IntegrationFlow wireTapFlow3() { return f -> f .transform("payload") .wireTap("tapChannel", wt -> wt.selector("payload == 'foo'")) .handle(loggingMessageHandler()); }
@Bean public IntegrationFlow wireTapFlow5() { return f -> f .wireTap(sf -> sf .<String, String>transform(String::toUpperCase) .channel(MessageChannels.queue("wireTapSubflowResult"))) .channel("nullChannel"); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * f -> f.wireTap("tapChannel") * .handle(p -> process(p)) * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} bean name to wire-tap. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(String wireTapChannel) { return wireTap(wireTapChannel, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * f -> f.wireTap("tapChannel") * .handle(p -> process(p)) * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} bean name to wire-tap. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(String wireTapChannel) { return wireTap(wireTapChannel, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .filter("World"::equals) * .wireTap(sf -> sf.<String, String>transform(String::toUpperCase)) * .handle(p -> process(p)) * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param flow the {@link IntegrationFlow} for wire-tap subflow as an alternative to the {@code wireTapChannel}. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(IntegrationFlow flow) { return wireTap(flow, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .transform("payload") * .wireTap(tapChannel()) * .channel("foo") * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} to wire-tap. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(MessageChannel wireTapChannel) { return wireTap(wireTapChannel, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * f -> f.wireTap("tapChannel") * .handle(p -> process(p)) * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} bean name to wire-tap. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(String wireTapChannel) { return wireTap(wireTapChannel, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .transform("payload") * .wireTap(tapChannel()) * .channel("foo") * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param wireTapChannel the {@link MessageChannel} to wire-tap. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(MessageChannel wireTapChannel) { return wireTap(wireTapChannel, null); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation * to the current {@link #currentMessageChannel}. * It is useful when an implicit {@link MessageChannel} is used between endpoints: * <pre class="code"> * {@code * .filter("World"::equals) * .wireTap(sf -> sf.<String, String>transform(String::toUpperCase)) * .handle(p -> process(p)) * } * </pre> * This method can be used after any {@link #channel} for explicit {@link MessageChannel}, * but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s. * @param flow the {@link IntegrationFlow} for wire-tap subflow as an alternative to the {@code wireTapChannel}. * @return the current {@link IntegrationFlowDefinition}. */ public B wireTap(IntegrationFlow flow) { return wireTap(flow, null); }
@Bean public IntegrationFlow wireTapFlow2() { return f -> f .wireTap("tapChannel", wt -> wt.selector(m -> m.getPayload().equals("foo"))) .channel("nullChannel"); }
@Bean public IntegrationFlow wireTapFlow3() { return f -> f .transform("payload") .wireTap("tapChannel", wt -> wt.selector("payload == 'foo'")) .channel("nullChannel"); }
@Bean public IntegrationFlow wireTapFlow5() { return f -> f .wireTap(sf -> sf .<String, String>transform(String::toUpperCase) .channel(c -> c.queue("wireTapSubflowResult"))) .channel("nullChannel"); }