Skip to content

Commit

Permalink
add @qualifier where necessary (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro23 committed Nov 4, 2024
1 parent 02f6217 commit 933a450
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package grails.plugin.springwebsocket

import groovy.transform.CompileStatic
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.messaging.MessageChannel
Expand All @@ -18,8 +19,8 @@ class DefaultWebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
void configureMessageBroker(MessageBrokerRegistry messageBrokerRegistry) {
messageBrokerRegistry.enableSimpleBroker "/queue", "/topic"
messageBrokerRegistry.setApplicationDestinationPrefixes "/app"
messageBrokerRegistry.enableSimpleBroker("/queue", "/topic")
messageBrokerRegistry.setApplicationDestinationPrefixes("/app")
}

@Override
Expand All @@ -29,20 +30,20 @@ class DefaultWebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Bean
GrailsSimpAnnotationMethodMessageHandler grailsSimpAnnotationMethodMessageHandler(
SubscribableChannel clientInboundChannel,
MessageChannel clientOutboundChannel,
@Qualifier("clientInboundChannel") SubscribableChannel clientInboundChannel,
@Qualifier("clientOutboundChannel") MessageChannel clientOutboundChannel,
SimpMessageSendingOperations brokerMessagingTemplate) {
def handler = new GrailsSimpAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
GrailsSimpAnnotationMethodMessageHandler handler = new GrailsSimpAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
handler.destinationPrefixes = ["/app"]
return handler
}

@Bean
GrailsWebSocketAnnotationMethodMessageHandler grailsWebSocketAnnotationMethodMessageHandler(
SubscribableChannel clientInboundChannel,
MessageChannel clientOutboundChannel,
@Qualifier("clientInboundChannel") SubscribableChannel clientInboundChannel,
@Qualifier("clientOutboundChannel") MessageChannel clientOutboundChannel,
SimpMessageSendingOperations brokerMessagingTemplate) {
def handler = new GrailsWebSocketAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
GrailsWebSocketAnnotationMethodMessageHandler handler = new GrailsWebSocketAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
handler.destinationPrefixes = ["/app"]
return handler
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ${model.packageName}
import grails.plugin.springwebsocket.GrailsSimpAnnotationMethodMessageHandler
import grails.plugin.springwebsocket.GrailsWebSocketAnnotationMethodMessageHandler
import groovy.transform.CompileStatic
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.messaging.MessageChannel
Expand All @@ -20,8 +21,8 @@ class ${model.className} implements WebSocketMessageBrokerConfigurer {

@Override
void configureMessageBroker(MessageBrokerRegistry messageBrokerRegistry) {
messageBrokerRegistry.enableSimpleBroker "/queue", "/topic"
messageBrokerRegistry.setApplicationDestinationPrefixes "/app"
messageBrokerRegistry.enableSimpleBroker("/queue", "/topic")
messageBrokerRegistry.setApplicationDestinationPrefixes("/app")
}

@Override
Expand All @@ -31,20 +32,20 @@ class ${model.className} implements WebSocketMessageBrokerConfigurer {

@Bean
GrailsSimpAnnotationMethodMessageHandler grailsSimpAnnotationMethodMessageHandler(
SubscribableChannel clientInboundChannel,
MessageChannel clientOutboundChannel,
@Qualifier("clientInboundChannel") SubscribableChannel clientInboundChannel,
@Qualifier("clientOutboundChannel") MessageChannel clientOutboundChannel,
SimpMessageSendingOperations brokerMessagingTemplate) {
def handler = new GrailsSimpAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
GrailsSimpAnnotationMethodMessageHandler handler = new GrailsSimpAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
handler.destinationPrefixes = ["/app"]
return handler
}

@Bean
GrailsWebSocketAnnotationMethodMessageHandler grailsWebSocketAnnotationMethodMessageHandler(
SubscribableChannel clientInboundChannel,
MessageChannel clientOutboundChannel,
@Qualifier("clientInboundChannel") SubscribableChannel clientInboundChannel,
@Qualifier("clientOutboundChannel") MessageChannel clientOutboundChannel,
SimpMessageSendingOperations brokerMessagingTemplate) {
def handler = new GrailsWebSocketAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
GrailsWebSocketAnnotationMethodMessageHandler handler = new GrailsWebSocketAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
handler.destinationPrefixes = ["/app"]
return handler
}
Expand Down

0 comments on commit 933a450

Please sign in to comment.