Remove unused constructor arg from UserDestinationMH

This commit is contained in:
Rossen Stoyanchev 2014-01-22 11:54:45 -05:00
parent 499c858cd4
commit 8ee2a2d18c
4 changed files with 6 additions and 14 deletions

View File

@ -231,7 +231,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
@Bean @Bean
public UserDestinationMessageHandler userDestinationMessageHandler() { public UserDestinationMessageHandler userDestinationMessageHandler() {
UserDestinationMessageHandler handler = new UserDestinationMessageHandler( UserDestinationMessageHandler handler = new UserDestinationMessageHandler(
clientInboundChannel(), clientOutboundChannel(), brokerChannel(), userDestinationResolver()); clientInboundChannel(), brokerChannel(), userDestinationResolver());
return handler; return handler;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,7 +23,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.context.SmartLifecycle; import org.springframework.context.SmartLifecycle;
import org.springframework.messaging.Message; import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler; import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException; import org.springframework.messaging.MessagingException;
import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.SubscribableChannel;
@ -49,8 +48,6 @@ public class UserDestinationMessageHandler implements MessageHandler, SmartLifec
private final SubscribableChannel clientInboundChannel; private final SubscribableChannel clientInboundChannel;
private final MessageChannel clientOutboundChannel;
private final SubscribableChannel brokerChannel; private final SubscribableChannel brokerChannel;
private final MessageSendingOperations<String> brokerMessagingTemplate; private final MessageSendingOperations<String> brokerMessagingTemplate;
@ -66,20 +63,17 @@ public class UserDestinationMessageHandler implements MessageHandler, SmartLifec
* Create an instance of the handler with the given messaging template and a * Create an instance of the handler with the given messaging template and a
* user destination resolver. * user destination resolver.
* @param clientInChannel the channel for receiving messages from clients (e.g. WebSocket clients) * @param clientInChannel the channel for receiving messages from clients (e.g. WebSocket clients)
* @param clientOutChannel the channel for sending messages to clients (e.g. WebSocket clients)
* @param brokerChannel the channel for sending messages with translated user destinations * @param brokerChannel the channel for sending messages with translated user destinations
* @param userDestinationResolver the resolver to use to find queue suffixes for a user * @param userDestinationResolver the resolver to use to find queue suffixes for a user
*/ */
public UserDestinationMessageHandler(SubscribableChannel clientInChannel, MessageChannel clientOutChannel, public UserDestinationMessageHandler(SubscribableChannel clientInChannel,
SubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) { SubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) {
Assert.notNull(clientInChannel, "'clientInChannel' must not be null"); Assert.notNull(clientInChannel, "'clientInChannel' must not be null");
Assert.notNull(clientOutChannel, "'clientOutChannel' must not be null");
Assert.notNull(brokerChannel, "'brokerChannel' must not be null"); Assert.notNull(brokerChannel, "'brokerChannel' must not be null");
Assert.notNull(userDestinationResolver, "DestinationResolver must not be null"); Assert.notNull(userDestinationResolver, "DestinationResolver must not be null");
this.clientInboundChannel = clientInChannel; this.clientInboundChannel = clientInChannel;
this.clientOutboundChannel = clientOutChannel;
this.brokerChannel = brokerChannel; this.brokerChannel = brokerChannel;
this.brokerMessagingTemplate = new SimpMessagingTemplate(brokerChannel); this.brokerMessagingTemplate = new SimpMessagingTemplate(brokerChannel);
this.userDestinationResolver = userDestinationResolver; this.userDestinationResolver = userDestinationResolver;

View File

@ -53,8 +53,7 @@ public class UserDestinationMessageHandlerTests {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.registry = new DefaultUserSessionRegistry(); this.registry = new DefaultUserSessionRegistry();
DefaultUserDestinationResolver resolver = new DefaultUserDestinationResolver(this.registry); DefaultUserDestinationResolver resolver = new DefaultUserDestinationResolver(this.registry);
this.messageHandler = new UserDestinationMessageHandler(new StubMessageChannel(), this.messageHandler = new UserDestinationMessageHandler(new StubMessageChannel(), this.brokerChannel, resolver);
new StubMessageChannel(), this.brokerChannel, resolver);
} }

View File

@ -435,9 +435,8 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
ConstructorArgumentValues cavs = new ConstructorArgumentValues(); ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addIndexedArgumentValue(0, clientInChannelDef); cavs.addIndexedArgumentValue(0, clientInChannelDef);
cavs.addIndexedArgumentValue(1, clientOutChannelDef); cavs.addIndexedArgumentValue(1, brokerChannelDef);
cavs.addIndexedArgumentValue(2, brokerChannelDef); cavs.addIndexedArgumentValue(2, userDestinationResolverRef);
cavs.addIndexedArgumentValue(3, userDestinationResolverRef);
RootBeanDefinition userDestinationMessageHandlerDef = RootBeanDefinition userDestinationMessageHandlerDef =
new RootBeanDefinition(UserDestinationMessageHandler.class, cavs, null); new RootBeanDefinition(UserDestinationMessageHandler.class, cavs, null);