/** * Specify an {@link Expression} for selector. * @param selectorExpression the expression for selector. * @return the current {@link WireTapSpec} * @since 1.2 * @see WireTap#WireTap(MessageChannel, MessageSelector) */ public WireTapSpec selector(Expression selectorExpression) { return selector(new ExpressionEvaluatingSelector(selectorExpression)); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation. * @param wireTapChannel the {@link MessageChannel} instance to wire-tap. * @return the current {@link MessageChannelSpec}. * @since 1.2 * @see WireTapSpec */ public S wireTap(MessageChannel wireTapChannel) { return wireTap(new WireTapSpec(wireTapChannel)); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation. * @param wireTapSpec the {@link WireTapSpec} to build {@link WireTap} instance. * @return the current {@link MessageChannelSpec}. * @since 1.2 * @see WireTap */ public S wireTap(WireTapSpec wireTapSpec) { WireTap interceptor = wireTapSpec.get(); this.componentsToRegister.add(interceptor); return interceptor(interceptor); }
/** * 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(new WireTap(tapChannel().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 wireTapSpec the {@link WireTapSpec} to use. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B wireTap(WireTapSpec wireTapSpec) { WireTap interceptor = wireTapSpec.get(); if (this.currentMessageChannel == null || !(this.currentMessageChannel instanceof ChannelInterceptorAware)) { channel(new DirectChannel()); } addComponents(wireTapSpec.getComponentsToRegister()); ((ChannelInterceptorAware) this.currentMessageChannel).addInterceptor(interceptor); return _this(); }
/** * 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(new WireTap(tapChannel().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 wireTapSpec the {@link WireTapSpec} to use. * @return the current {@link IntegrationFlowDefinition}. * @since 1.2 */ public B wireTap(WireTapSpec wireTapSpec) { WireTap interceptor = wireTapSpec.get(); if (this.currentMessageChannel == null || !(this.currentMessageChannel instanceof ChannelInterceptorAware)) { channel(new DirectChannel()); } addComponents(wireTapSpec.getComponentsToRegister()); ((ChannelInterceptorAware) this.currentMessageChannel).addInterceptor(interceptor); return _this(); }
/** * Specify an {@link Expression} for selector. * @param selectorExpression the expression for selector. * @return the current {@link WireTapSpec} * @since 1.2 * @see WireTap#WireTap(MessageChannel, MessageSelector) */ public WireTapSpec selector(Expression selectorExpression) { return selector(new ExpressionEvaluatingSelector(selectorExpression)); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation. * @param wireTapChannel the {@link MessageChannel} bean name to wire-tap. * @return the current {@link MessageChannelSpec}. * @since 1.2 * @see WireTapSpec */ public S wireTap(String wireTapChannel) { return wireTap(new WireTapSpec(wireTapChannel)); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation. * @param wireTapSpec the {@link WireTapSpec} to build {@link WireTap} instance. * @return the current {@link MessageChannelSpec}. * @since 1.2 * @see WireTap */ public S wireTap(WireTapSpec wireTapSpec) { WireTap interceptor = wireTapSpec.get(); this.componentsToRegister.add(interceptor); return interceptor(interceptor); }
public WireTapSpec selector(String selectorExpression) { return selector(new ExpressionEvaluatingSelector(selectorExpression)); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation. * @param wireTapChannel the {@link MessageChannel} instance to wire-tap. * @return the current {@link MessageChannelSpec}. * @since 1.2 * @see WireTapSpec */ public S wireTap(MessageChannel wireTapChannel) { return wireTap(new WireTapSpec(wireTapChannel)); }
public WireTapSpec selector(String selectorExpression) { return selector(new ExpressionEvaluatingSelector(selectorExpression)); }
/** * Populate the {@code Wire Tap} EI Pattern specific * {@link org.springframework.messaging.support.ChannelInterceptor} implementation. * @param wireTapChannel the {@link MessageChannel} bean name to wire-tap. * @return the current {@link MessageChannelSpec}. * @since 1.2 * @see WireTapSpec */ public S wireTap(String wireTapChannel) { return wireTap(new WireTapSpec(wireTapChannel)); }
@Bean public IntegrationFlow wireTapFlow2() { return f -> f .wireTap("tapChannel", wt -> wt.selector(m -> m.getPayload().equals("foo"))) .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 * .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 wireTapFlow3() { return f -> f .transform("payload") .wireTap("tapChannel", wt -> wt.selector("payload == 'foo'")) .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 * .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 wireTapFlow1() { return IntegrationFlows.from("tappedChannel1") .wireTap("tapChannel", wt -> wt.selector(m -> m.getPayload().equals("foo"))) .channel("nullChannel") .get(); }