Skip to content

Commit 9fbb739

Browse files
committed
Polish STOMP documentation
1 parent 80cb0c4 commit 9fbb739

File tree

1 file changed

+34
-44
lines changed

1 file changed

+34
-44
lines changed

src/asciidoc/index.adoc

Lines changed: 34 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -37749,61 +37749,51 @@ sections <<websocket-stomp-handle-broker-relay-configure>> and
3774937749
[[websocket-stomp-message-flow]]
3775037750
==== Flow of Messages
3775137751

37752-
When a STOMP endpoint is configured, the Spring application becomes the broker to
37753-
connected clients. It handles incoming messages and broadcasts messages back.
37754-
This section provides the big picture of how messages are handled and how
37755-
they flow inside the application.
37756-
37757-
The `spring-messaging` module contains a number of abstractions for use in
37758-
messaging applications which originated in the
37759-
https://spring.io/spring-integration[Spring Integration] project and
37760-
have been in use for a long time but are now part of the Spring Framework.
37761-
Listed below are some of the main building blocks:
37762-
37763-
* {javadoc-baseurl}/org/springframework/messaging/Message.html[Message]
37752+
When a STOMP endpoint is configured, the Spring application acts as the STOMP broker
37753+
to connected clients. It handles incoming messages and sends messages back.
37754+
This section provides a big picture overview of how messages flow inside the application.
37755+
37756+
The `spring-messaging` module contains a number of abstractions that originated in the
37757+
https://spring.io/spring-integration[Spring Integration] project and are intended
37758+
for use as building blocks in messaging applications:
37759+
37760+
* {javadoc-baseurl}/org/springframework/messaging/Message.html[Message] --
3776437761
represents a message with headers and a payload.
37765-
* {javadoc-baseurl}/org/springframework/messaging/MessageHandler.html[MessageHandler]
37766-
a simple contract components that handle a message.
37767-
* {javadoc-baseurl}/org/springframework/messaging/MessageChannel.html[MessageChannel]
37768-
a simple contract for sending a message that enables loose coupling between
37769-
senders and receivers.
37770-
* {javadoc-baseurl}/org/springframework/messaging/SubscribableChannel.html[SubscribableChannel]
37762+
* {javadoc-baseurl}/org/springframework/messaging/MessageHandler.html[MessageHandler] --
37763+
a contract for handling a message.
37764+
* {javadoc-baseurl}/org/springframework/messaging/MessageChannel.html[MessageChannel] --
37765+
a contract for sending a message enabling loose coupling between senders and receivers.
37766+
* {javadoc-baseurl}/org/springframework/messaging/SubscribableChannel.html[SubscribableChannel] --
3777137767
extends `MessageChannel` and sends messages to registered `MessageHandler` subscribers.
37772-
* {javadoc-baseurl}/org/springframework/messaging/support/ExecutorSubscribableChannel.html[ExecutorSubscribableChannel]
37768+
* {javadoc-baseurl}/org/springframework/messaging/support/ExecutorSubscribableChannel.html[ExecutorSubscribableChannel] --
3777337769
a concrete implementation of `SubscribableChannel` that can deliver messages
37774-
asynchronously using threads from a thread pool.
37775-
37776-
The above building blocks can be used to construct a message flow.
37770+
asynchronously through a thread pool.
3777737771

37778-
The provided configuration for STOMP over WebSocket, both Java config and XML namespace,
37779-
assemble just such a concrete message flow that consists of the following 3
37780-
subscribable channels:
37772+
The provided STOMP over WebSocket config, both Java and XML, uses the above to
37773+
assemble a concrete message flow including the following 3 channels:
3778137774

37782-
* `"clientInboundChannel"` for messages from WebSocket clients; every incoming
37783-
WebSocket message that is decoded and turned into a Spring Message representing
37784-
a STOMP frame is passed through this channel.
37785-
* `"clientOutboundChannel"` for messages to WebSocket clients; every outgoing
37786-
Spring Message representing a STOMP frame that is encoded and sent as a
37787-
WebSocket message is passed through this channel.
37788-
* `"brokerChannel"` for messages to the broker from within the application and
37789-
ultimately intended to reach connected clients; every message that the application
37790-
wants to send to clients passes through this channel.
37775+
* `"clientInboundChannel"` -- for messages from WebSocket clients. Every incoming
37776+
WebSocket message carrying a STOMP frame is sent through this channel.
37777+
* `"clientOutboundChannel"` -- for messages to WebSocket clients. Every outgoing
37778+
STOMP message from the broker is sent through this channel before getting sent
37779+
to a client's WebSocket session.
37780+
* `"brokerChannel"` -- for messages to the broker from within the application.
37781+
Every message sent from the application to the broker passes through this channel.
3779137782

37792-
Messages through `"clientInboundChannel"` can flow to annotated
37783+
Messages on the `"clientInboundChannel"` can flow to annotated
3779337784
methods for application handling (e.g. a stock trade execution request) or can
3779437785
be forwarded to the broker (e.g. client subscribing for stock quotes).
3779537786
The STOMP destination is used for simple prefix-based routing. For example
37796-
the "/app" prefix routes messages annotated methods while the "/topic" or
37797-
"/queue" prefix route messages to the broker.
37787+
the "/app" prefix could route messages to annotated methods while the "/topic"
37788+
and "/queue" prefixes could route messages to the broker.
3779837789

3779937790
When a message-handling annotated method has a return type, its return
3780037791
value is sent as the payload of a Spring Message to the `"brokerChannel"`.
37801-
The broker in turn broadcasts the message to clients. Sending an object as
37802-
the payload of a Message to a specific destination can also easily be done
37803-
from anywhere in the application with the help of a messaging template.
37804-
For example a an HTTP POST handling method can broadcast a message to
37805-
connected clients or a service component may periodically broadcast
37806-
stock quotes.
37792+
The broker in turn broadcasts the message to clients. Sending a message
37793+
to a destination can also be done from anywhere in the application with
37794+
the help of a messaging template. For example a an HTTP POST handling method
37795+
can broadcast a message to connected clients or a service component may
37796+
periodically broadcast stock quotes.
3780737797

3780837798
Below is a simple example to illustrate the flow of messages:
3780937799

@@ -37839,7 +37829,7 @@ Below is a simple example to illustrate the flow of messages:
3783937829

3784037830
----
3784137831

37842-
The following explains how messages flow given the above:
37832+
The following explains the message flow for the above exmaple:
3784337833

3784437834
* WebSocket clients connect to the WebSocket endpoint at "/portfolio".
3784537835
* Subscriptions to "/topic/greeting" pass through the "clientInboundChannel"

0 commit comments

Comments
 (0)