Skip to content

IntegrationWebSocketContainer: Make Buffer Overflow Strategy Configurable #8678

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

Closed
ColoredCarrot opened this issue Jul 15, 2023 · 2 comments
Closed

Comments

@ColoredCarrot
Copy link
Contributor

Within Spring Integration's WebSocket support, ConcurrentWebSocketSessionDecorator, which buffers outbound messages if sending is slow, is used to decorate all websocket sessions in IntegrationWebSocketContainer, the standard entrypoint for using websockets with Integration.

ConcurrentWebSocketSessionDecorator provides the ability to configure three things:

The first two are also configurable in IntegrationWebSocketContainer. However, overflowStrategy is missing.

Suggestion

I'd like to be able to configure overflowStrategy in IntegrationWebSocketContainer, just like the other two options.
This should be possible via a simple setter, analogous to setSendTimeLimit and setSendBufferSizeLimit.

Context

My project's requirements allow me to drop messages if the server can't keep up (UDP-esque).
Currently, when messages aren't being flushed out fast enough, ConcurrentWebSocketSessionDecorator hits its buffer size limit and closes the websocket session.
I wish to use OverflowStrategy.DROP to circumvent this.

A workaround is increasing the buffer size limit, though this is obviously not sustainable.

@ColoredCarrot ColoredCarrot added status: waiting-for-triage The issue need to be evaluated and its future decided type: enhancement labels Jul 15, 2023
ColoredCarrot added a commit to ColoredCarrot/spring-integration that referenced this issue Jul 16, 2023
@artembilan artembilan added this to the 6.2.0-M1 milestone Jul 17, 2023
@artembilan artembilan added in: websocket backport 5.5.x (EOL) for: backport-to-6.1.x and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels Jul 17, 2023
ColoredCarrot added a commit to ColoredCarrot/spring-integration that referenced this issue Jul 17, 2023
artembilan pushed a commit that referenced this issue Jul 18, 2023
Within Spring Integration's WebSocket support, a `ConcurrentWebSocketSessionDecorator`,
which buffers outbound messages if sending is slow,
is used to decorate all websocket sessions in `IntegrationWebSocketContainer`,
the standard entrypoint for using websockets with Integration.

* Expose a `ConcurrentWebSocketSessionDecorator.OverflowStrategy` option on the `IntegrationWebSocketContainer`

**Cherry-pick to `5.5.x`, `6.0.x` & `6.1.x`**
artembilan pushed a commit that referenced this issue Jul 18, 2023
Within Spring Integration's WebSocket support, a `ConcurrentWebSocketSessionDecorator`,
which buffers outbound messages if sending is slow,
is used to decorate all websocket sessions in `IntegrationWebSocketContainer`,
the standard entrypoint for using websockets with Integration.

* Expose a `ConcurrentWebSocketSessionDecorator.OverflowStrategy` option on the `IntegrationWebSocketContainer`

**Cherry-pick to `5.5.x`, `6.0.x` & `6.1.x`**

(cherry picked from commit be53593)
artembilan pushed a commit that referenced this issue Jul 18, 2023
Within Spring Integration's WebSocket support, a `ConcurrentWebSocketSessionDecorator`,
which buffers outbound messages if sending is slow,
is used to decorate all websocket sessions in `IntegrationWebSocketContainer`,
the standard entrypoint for using websockets with Integration.

* Expose a `ConcurrentWebSocketSessionDecorator.OverflowStrategy` option on the `IntegrationWebSocketContainer`

**Cherry-pick to `5.5.x`, `6.0.x` & `6.1.x`**

(cherry picked from commit be53593)
artembilan pushed a commit that referenced this issue Jul 18, 2023
Within Spring Integration's WebSocket support, a `ConcurrentWebSocketSessionDecorator`,
which buffers outbound messages if sending is slow,
is used to decorate all websocket sessions in `IntegrationWebSocketContainer`,
the standard entrypoint for using websockets with Integration.

* Expose a `ConcurrentWebSocketSessionDecorator.OverflowStrategy` option on the `IntegrationWebSocketContainer`

**Cherry-pick to `5.5.x`, `6.0.x` & `6.1.x`**

(cherry picked from commit be53593)

# Conflicts:
#	spring-integration-websocket/src/test/java/org/springframework/integration/websocket/ClientWebSocketContainerTests.java
@artembilan
Copy link
Member

Merged as be53593 and cherry-picked to 6.1.x, 6.0.x & 5.5.x.

While reviewing this I've noticed that we have an XML configuration support for WebSocket containers.
If you wish, feel free to expose a new attribute for this strategy we have just added with you.
I cannot do this today since we have releases to perform: it is OK to carry out this new feature for the next milestone.

Thank you for contribution; looking forward for more!

@ColoredCarrot
Copy link
Contributor Author

Thanks for all the help, that was a really smooth process. I'll look into that XML support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants