-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-3591: Add gateway()
section into dsl.adoc
#3593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
garyrussell
suggested changes
Jul 19, 2021
src/reference/asciidoc/dsl.adoc
Outdated
Comment on lines
605
to
615
The `gateway()` operator of `IntegrationFlow` definition is a special service activator implementation to call some other endpoint or integration flow via their input channel and wait for reply from there. | ||
Technically it plays the same role as a nested `<gateway>` component for `<chain>` definition (see <<./chain.adoc#chain-gateway,Calling a Chain from within a Chain>>) and allows to make a code flow much cleaner and more straightforward. | ||
And logically and from business perspective it is a messaging gateway to let to distribute and reuse functionality between different parts of the target integration solution (see <<./gateway.adoc#gateway,Messaging Gateways>>). | ||
This operator has several overloads for different goals: | ||
|
||
- `gateway(String requestChannel)` to call some endpoint's input channel by its name; | ||
- `gateway(MessageChannel requestChannel)` to call some endpoint's input channel by its direct injection; | ||
- `gateway(IntegrationFlow flow)` to call the input channel of the provided `IntegrationFlow`. | ||
|
||
All of them have a variant with the second `Consumer<GatewayEndpointSpec>` argument to configure the target `GatewayMessageHandler` and respective `AbstractEndpoint`. | ||
Also the `IntegrationFlow`-based has a power that it allows to call existing `IntegrationFlow` bean or declare the flow as a sub-flow via an in-place lambda for an `IntegrationFlow` functional interface or have it extracted in a `private` method cleaner code style: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
The `gateway()` operator of `IntegrationFlow` definition is a special service activator implementation to call some other endpoint or integration flow via their input channel and wait for reply from there. | |
Technically it plays the same role as a nested `<gateway>` component for `<chain>` definition (see <<./chain.adoc#chain-gateway,Calling a Chain from within a Chain>>) and allows to make a code flow much cleaner and more straightforward. | |
And logically and from business perspective it is a messaging gateway to let to distribute and reuse functionality between different parts of the target integration solution (see <<./gateway.adoc#gateway,Messaging Gateways>>). | |
This operator has several overloads for different goals: | |
- `gateway(String requestChannel)` to call some endpoint's input channel by its name; | |
- `gateway(MessageChannel requestChannel)` to call some endpoint's input channel by its direct injection; | |
- `gateway(IntegrationFlow flow)` to call the input channel of the provided `IntegrationFlow`. | |
All of them have a variant with the second `Consumer<GatewayEndpointSpec>` argument to configure the target `GatewayMessageHandler` and respective `AbstractEndpoint`. | |
Also the `IntegrationFlow`-based has a power that it allows to call existing `IntegrationFlow` bean or declare the flow as a sub-flow via an in-place lambda for an `IntegrationFlow` functional interface or have it extracted in a `private` method cleaner code style: | |
The `gateway()` operator in an `IntegrationFlow` definition is a special service activator implementation, to call some other endpoint or integration flow via its input channel and wait for reply. | |
Technically it plays the same role as a nested `<gateway>` component in a `<chain>` definition (see <<./chain.adoc#chain-gateway,Calling a Chain from within a Chain>>) and allows a flow to be cleaner and more straightforward. | |
Logically, and from business perspective, it is a messaging gateway to allow the distribution and reuse of functionality between different parts of the target integration solution (see <<./gateway.adoc#gateway,Messaging Gateways>>). | |
This operator has several overloads for different goals: | |
- `gateway(String requestChannel)` to send a message to some endpoint's input channel by its name; | |
- `gateway(MessageChannel requestChannel)` to send a message to some endpoint's input channel by its direct injection; | |
- `gateway(IntegrationFlow flow)` to send a message to the input channel of the provided `IntegrationFlow`. | |
All of these have a variant with the second `Consumer<GatewayEndpointSpec>` argument to configure the target `GatewayMessageHandler` and respective `AbstractEndpoint`. | |
Also the `IntegrationFlow`-based methods allows calling existing `IntegrationFlow` bean or declare the flow as a sub-flow via an in-place lambda for an `IntegrationFlow` functional interface or have it extracted in a `private` method cleaner code style: | |
IMPORTANT: If the downstream flow does not always return a reply, you should set the `requestTimeout` to 0 to prevent hanging the calling thread indefinitely. | |
In that case, the flow will end at that point and the thread released for further work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3591