@Override public StandardIntegrationFlow get() { return super.get(); }
/** * Add a {@value IntegrationContextUtils#NULL_CHANNEL_BEAN_NAME} bean into this flow * definition as a terminal operator. * @return The {@link IntegrationFlow} instance based on this definition. * @since 5.1 */ public IntegrationFlow nullChannel() { return channel(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME) .get(); }
@Override public final void configure(IntegrationFlowDefinition<?> flow) { IntegrationFlowDefinition<?> targetFlow = buildFlow(); Assert.state(targetFlow != null, "the 'buildFlow()' must not return null"); flow.integrationComponents.clear(); flow.integrationComponents.putAll(targetFlow.integrationComponents); this.targetIntegrationFlow = flow.get(); }
/** * 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(); }
/** * Try to get a {@link MessageChannel} as an input for the provided {@link IntegrationFlow} * or create one and wrap the provided flow to a new one. * @param subFlow the {@link IntegrationFlow} to extract input channel. * @param evaluateInternalBuilder true if an internal {@link IntegrationFlowDefinition} should be * evaluated to an {@link IntegrationFlow} component or left as a builder in the {@link #componentsToRegister} * for future use-case. For example the builder is used for router configurations to retain beans * registration order for parent-child dependencies. * @return the input channel of the flow of create one * @since 5.0.4 */ protected MessageChannel obtainInputChannelFromFlow(IntegrationFlow subFlow, boolean evaluateInternalBuilder) { Assert.notNull(subFlow, "'subFlow' must not be null"); MessageChannel messageChannel = subFlow.getInputChannel(); if (messageChannel == null) { messageChannel = new DirectChannel(); IntegrationFlowDefinition<?> flowBuilder = IntegrationFlows.from(messageChannel); subFlow.configure(flowBuilder); this.componentsToRegister.put(evaluateInternalBuilder ? flowBuilder.get() : flowBuilder, null); } else { this.componentsToRegister.put(subFlow, null); } return messageChannel; }
/** * Represent an Integration Flow as a Reactive Streams {@link Publisher} bean. * @param <T> the expected {@code payload} type * @return the Reactive Streams {@link Publisher} */ @SuppressWarnings("unchecked") public <T> Publisher<Message<T>> toReactivePublisher() { MessageChannel channelForPublisher = this.currentMessageChannel; Publisher<Message<T>> publisher; if (channelForPublisher instanceof Publisher) { publisher = (Publisher<Message<T>>) channelForPublisher; } else { if (channelForPublisher != null && this.integrationComponents.size() > 1 && !(channelForPublisher instanceof MessageChannelReference) && !(channelForPublisher instanceof FixedSubscriberChannelPrototype)) { publisher = MessageChannelReactiveUtils.toPublisher(channelForPublisher); } else { MessageChannel reactiveChannel = new FluxMessageChannel(); publisher = (Publisher<Message<T>>) reactiveChannel; channel(reactiveChannel); } } this.implicitChannel = false; get(); return new PublisherIntegrationFlow<>(this.integrationComponents, publisher); }
private MessageChannel obtainInputChannelFromFlow(IntegrationFlow flow) { Assert.notNull(flow, "'flow' must not be null"); MessageChannel messageChannel = flow.getInputChannel(); if (messageChannel == null) { messageChannel = new DirectChannel(); IntegrationFlowDefinition<?> flowBuilder = IntegrationFlows.from(messageChannel); flow.configure(flowBuilder); addComponent(flowBuilder.get()); } else { addComponent(flow); } return messageChannel; }
flowBuilder.channel(new FixedSubscriberChannel(bridgeHandler)); addComponent(flowBuilder.get());
@Override public StandardIntegrationFlow get() { return super.get(); }
@Override public StandardIntegrationFlow get() { return super.get(); }
@Override public StandardIntegrationFlow get() { return super.get(); }
/** * Add a {@value IntegrationContextUtils#NULL_CHANNEL_BEAN_NAME} bean into this flow * definition as a terminal operator. * @return The {@link IntegrationFlow} instance based on this definition. * @since 5.1 */ public IntegrationFlow nullChannel() { return channel(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME) .get(); }
@Override public final void configure(IntegrationFlowDefinition<?> flow) { IntegrationFlowDefinition<?> targetFlow = buildFlow(); Assert.state(targetFlow != null, "the 'buildFlow()' must not return null"); flow.integrationComponents.clear(); flow.integrationComponents.putAll(targetFlow.integrationComponents); this.targetIntegrationFlow = flow.get(); }
@Override public final void configure(IntegrationFlowDefinition<?> flow) { IntegrationFlowDefinition<?> targetFlow = buildFlow(); Assert.state(targetFlow != null, "the 'buildFlow()' must not return null"); flow.integrationComponents.clear(); flow.integrationComponents.addAll(targetFlow.integrationComponents); this.targetIntegrationFlow = flow.get(); }
@Override public final void configure(IntegrationFlowDefinition<?> flow) { IntegrationFlowDefinition<?> targetFlow = buildFlow(); Assert.state(targetFlow != null, "the 'buildFlow()' must not return null"); flow.integrationComponents.clear(); flow.integrationComponents.addAll(targetFlow.integrationComponents); this.targetIntegrationFlow = flow.get(); }
/** * 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(); }
/** * Try to get a {@link MessageChannel} as an input for the provided {@link IntegrationFlow} * or create one and wrap the provided flow to a new one. * @param subFlow the {@link IntegrationFlow} to extract input channel. * @param evaluateInternalBuilder true if an internal {@link IntegrationFlowDefinition} should be * evaluated to an {@link IntegrationFlow} component or left as a builder in the {@link #componentsToRegister} * for future use-case. For example the builder is used for router configurations to retain beans * registration order for parent-child dependencies. * @return the input channel of the flow of create one * @since 5.0.4 */ protected MessageChannel obtainInputChannelFromFlow(IntegrationFlow subFlow, boolean evaluateInternalBuilder) { Assert.notNull(subFlow, "'subFlow' must not be null"); MessageChannel messageChannel = subFlow.getInputChannel(); if (messageChannel == null) { messageChannel = new DirectChannel(); IntegrationFlowDefinition<?> flowBuilder = IntegrationFlows.from(messageChannel); subFlow.configure(flowBuilder); this.componentsToRegister.put(evaluateInternalBuilder ? flowBuilder.get() : flowBuilder, null); } else { this.componentsToRegister.put(subFlow, null); } return messageChannel; }
/** * Represent an Integration Flow as a Reactive Streams {@link Publisher} bean. * @param executor the managed {@link Executor} to be used for the background task to * poll messages from the {@link PollableChannel}. * Defaults to {@link Executors#newSingleThreadExecutor()}. * @param <T> the {@code payload} type * @return the Reactive Streams {@link Publisher} */ public <T> Publisher<Message<T>> toReactivePublisher(Executor executor) { Assert.notNull(executor, "'executor' must not be null"); MessageChannel channelForPublisher = this.currentMessageChannel; if (channelForPublisher == null) { PublishSubscribeChannel publishSubscribeChannel = new PublishSubscribeChannel(); publishSubscribeChannel.setMinSubscribers(1); channelForPublisher = publishSubscribeChannel; channel(channelForPublisher); } get(); return new PublisherIntegrationFlow<T>(this.integrationComponents, channelForPublisher, executor); }
/** * Represent an Integration Flow as a Reactive Streams {@link Publisher} bean. * @param executor the managed {@link Executor} to be used for the background task to * poll messages from the {@link PollableChannel}. * Defaults to {@link Executors#newSingleThreadExecutor()}. * @param <T> the {@code payload} type * @return the Reactive Streams {@link Publisher} */ public <T> Publisher<Message<T>> toReactivePublisher(Executor executor) { Assert.notNull(executor, "'executor' must not be null"); MessageChannel channelForPublisher = this.currentMessageChannel; if (channelForPublisher == null) { PublishSubscribeChannel publishSubscribeChannel = new PublishSubscribeChannel(); publishSubscribeChannel.setMinSubscribers(1); channelForPublisher = publishSubscribeChannel; channel(channelForPublisher); } get(); return new PublisherIntegrationFlow<T>(this.integrationComponents, channelForPublisher, executor); }
private MessageChannel obtainInputChannelFromFlow(IntegrationFlow flow) { Assert.notNull(flow, "'flow' must not be null"); MessageChannel messageChannel = flow.getInputChannel(); if (messageChannel == null) { messageChannel = new DirectChannel(); IntegrationFlowDefinition<?> flowBuilder = IntegrationFlows.from(messageChannel); flow.configure(flowBuilder); addComponent(flowBuilder.get()); } else { addComponent(flow); } return messageChannel; }