/** * 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(); }
/** * 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); }