|
20 | 20 | import java.util.Iterator;
|
21 | 21 | import java.util.List;
|
22 | 22 | import java.util.Set;
|
| 23 | +import java.util.concurrent.CompletableFuture; |
23 | 24 | import java.util.concurrent.ConcurrentHashMap;
|
24 | 25 |
|
25 | 26 | import org.junit.jupiter.api.Test;
|
|
69 | 70 | import org.springframework.messaging.support.ChannelInterceptor;
|
70 | 71 | import org.springframework.messaging.support.ExecutorSubscribableChannel;
|
71 | 72 | import org.springframework.messaging.support.MessageBuilder;
|
| 73 | +import org.springframework.messaging.tcp.ReconnectStrategy; |
| 74 | +import org.springframework.messaging.tcp.TcpConnectionHandler; |
| 75 | +import org.springframework.messaging.tcp.TcpOperations; |
72 | 76 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
73 | 77 | import org.springframework.stereotype.Controller;
|
74 | 78 | import org.springframework.util.AntPathMatcher;
|
@@ -622,7 +626,9 @@ static class BrokerRelayConfig extends SimpleBrokerConfig {
|
622 | 626 |
|
623 | 627 | @Override
|
624 | 628 | public void configureMessageBroker(MessageBrokerRegistry registry) {
|
625 |
| - registry.enableStompBrokerRelay("/topic", "/queue").setAutoStartup(true) |
| 629 | + registry.enableStompBrokerRelay("/topic", "/queue") |
| 630 | + .setAutoStartup(true) |
| 631 | + .setTcpClient(new NoOpTcpClient()) |
626 | 632 | .setUserDestinationBroadcast("/topic/unresolved-user-destination")
|
627 | 633 | .setUserRegistryBroadcast("/topic/simp-user-registry");
|
628 | 634 | }
|
@@ -787,4 +793,24 @@ public void validate(@Nullable Object target, Errors errors) {
|
787 | 793 | private static class CustomThreadPoolTaskExecutor extends ThreadPoolTaskExecutor {
|
788 | 794 | }
|
789 | 795 |
|
| 796 | + |
| 797 | + private static class NoOpTcpClient implements TcpOperations<byte[]> { |
| 798 | + |
| 799 | + @Override |
| 800 | + public CompletableFuture<Void> connectAsync(TcpConnectionHandler<byte[]> handler) { |
| 801 | + return CompletableFuture.completedFuture(null); |
| 802 | + } |
| 803 | + |
| 804 | + @Override |
| 805 | + public CompletableFuture<Void> connectAsync(TcpConnectionHandler<byte[]> handler, ReconnectStrategy strategy) { |
| 806 | + return CompletableFuture.completedFuture(null); |
| 807 | + } |
| 808 | + |
| 809 | + @Override |
| 810 | + public CompletableFuture<Void> shutdownAsync() { |
| 811 | + return CompletableFuture.completedFuture(null); |
| 812 | + } |
| 813 | + |
| 814 | + } |
| 815 | + |
790 | 816 | }
|
0 commit comments