-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed as not planned
Closed as not planned
Copy link
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.comin: messagingIssues in messaging modules (jms, messaging)Issues in messaging modules (jms, messaging)in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)
Description
Currently, I have Set up spring websockets over STOMP and messages are routed to RabbitMQ and it acts as an external broker. My current setup looks like below:
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry
.addEndpoint("/connect")
.setAllowedOrigins("*");
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setPreservePublishOrder(true)
.setApplicationDestinationPrefixes(APP_PREFIXES)
.enableStompBrokerRelay(BROKER_PREFIXES)
.setUserDestinationBroadcast("/topic/unresolved.user.dest")
.setUserRegistryBroadcast("/topic/registry.broadcast")
.setTaskScheduler(getHeartbeatScheduler())
.setRelayHost(rabbitMQHost)
.setRelayPort(rabbitMQPort)
.setClientLogin(rabbitMQUsername)
.setClientPasscode(rabbitMQPassword)
.setSystemLogin(rabbitMQUsername)
.setSystemPasscode(rabbitMQPassword)
.setVirtualHost(rabbitMQVirtualHost);
registry.configureBrokerChannel()
.interceptors(new LoggingInterceptor(), new EscapeSlashesInterceptor())
.taskExecutor().corePoolSize(1).maxPoolSize(MAX_WORKERS_COUNT).queueCapacity(TASK_QUEUE_SIZE);
}
Whenever a client send a /connect request, my application makes a new connection to the rabbitMQ broker and it happens for each client. Let say, there are 10 clients, so there will be 10 connections to the rabbitMQ broker. I want to introduce a connection pooling mechanism here, so I can limit the number of connections to the broker and reuse them when needed. I searched the web but couldn't find any relevant solution.
Does the framework provide such mechanism or any other possible way to achieve the same. Any help in regard is highly appreciated. Thank you.
Metadata
Metadata
Assignees
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.comin: messagingIssues in messaging modules (jms, messaging)Issues in messaging modules (jms, messaging)in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)