Merge branch '5.3.x' into main
This commit is contained in:
commit
1ebe62f646
|
|
@ -2968,6 +2968,8 @@ When using annotation-driven components or Java configuration, you can use the
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[beans-factory-scopes-application]]
|
[[beans-factory-scopes-application]]
|
||||||
==== Application Scope
|
==== Application Scope
|
||||||
|
|
||||||
|
|
@ -3011,6 +3013,17 @@ following example shows how to do so:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[[beans-factory-scopes-websocket]]
|
||||||
|
==== WebSocket Scope
|
||||||
|
|
||||||
|
WebSocket scope is associated with the lifecycle of a WebSocket session and applies to
|
||||||
|
STOMP over WebSocket applications, see
|
||||||
|
<<web.adoc#websocket-stomp-websocket-scope,WebSocket scope>> for more details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[beans-factory-scopes-other-injection]]
|
[[beans-factory-scopes-other-injection]]
|
||||||
==== Scoped Beans as Dependencies
|
==== Scoped Beans as Dependencies
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1439,8 +1439,11 @@ See <<websocket-stomp-destination-separator>>.
|
||||||
|
|
||||||
If configured with a task scheduler, the simple broker supports
|
If configured with a task scheduler, the simple broker supports
|
||||||
https://stomp.github.io/stomp-specification-1.2.html#Heart-beating[STOMP heartbeats].
|
https://stomp.github.io/stomp-specification-1.2.html#Heart-beating[STOMP heartbeats].
|
||||||
For that, you can declare your own scheduler or use the one that is automatically
|
To configure a scheduler, you can declare your own `TaskScheduler` bean and set it through
|
||||||
declared and used internally. The following example shows how to declare your own scheduler:
|
the `MessageBrokerRegistry`. Alternatively, you can use the one that is automatically
|
||||||
|
declared in the built-in WebSocket configuration, however, you'll' need `@Lazy` to avoid
|
||||||
|
a cycle between the built-in WebSocket configuration and your
|
||||||
|
`WebSocketMessageBrokerConfigurer`. For example:
|
||||||
|
|
||||||
[source,java,indent=0,subs="verbatim,quotes"]
|
[source,java,indent=0,subs="verbatim,quotes"]
|
||||||
----
|
----
|
||||||
|
|
@ -1451,13 +1454,12 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
||||||
private TaskScheduler messageBrokerTaskScheduler;
|
private TaskScheduler messageBrokerTaskScheduler;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setMessageBrokerTaskScheduler(TaskScheduler taskScheduler) {
|
public void setMessageBrokerTaskScheduler(@Lazy TaskScheduler taskScheduler) {
|
||||||
this.messageBrokerTaskScheduler = taskScheduler;
|
this.messageBrokerTaskScheduler = taskScheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageBroker(MessageBrokerRegistry registry) {
|
public void configureMessageBroker(MessageBrokerRegistry registry) {
|
||||||
|
|
||||||
registry.enableSimpleBroker("/queue/", "/topic/")
|
registry.enableSimpleBroker("/queue/", "/topic/")
|
||||||
.setHeartbeatValue(new long[] {10000, 20000})
|
.setHeartbeatValue(new long[] {10000, 20000})
|
||||||
.setTaskScheduler(this.messageBrokerTaskScheduler);
|
.setTaskScheduler(this.messageBrokerTaskScheduler);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue