This commit is contained in:
Rossen Stoyanchev 2013-07-17 18:23:27 -04:00
parent 329fbf31bc
commit 8a8501a992
2 changed files with 12 additions and 13 deletions

View File

@ -37,18 +37,17 @@ public class SimpleBrokerMessageHandler implements MessageHandler {
private static final Log logger = LogFactory.getLog(SimpleBrokerMessageHandler.class);
private final MessageChannel outboundChannel;
private final MessageChannel messageChannel;
private SubscriptionRegistry subscriptionRegistry = new DefaultSubscriptionRegistry();
/**
* @param outboundChannel the channel to which messages for clients should be sent
* @param observable an Observable to use to manage subscriptions
* @param messageChannel the channel to broadcast messages to
*/
public SimpleBrokerMessageHandler(MessageChannel outboundChannel) {
Assert.notNull(outboundChannel, "outboundChannel is required");
this.outboundChannel = outboundChannel;
public SimpleBrokerMessageHandler(MessageChannel messageChannel) {
Assert.notNull(messageChannel, "messageChannel is required");
this.messageChannel = messageChannel;
}
@ -104,7 +103,7 @@ public class SimpleBrokerMessageHandler implements MessageHandler {
Object payload = message.getPayload();
Message<?> clientMessage = MessageBuilder.withPayloadAndHeaders(payload, headers).build();
try {
this.outboundChannel.send(clientMessage);
this.messageChannel.send(clientMessage);
}
catch (Throwable ex) {
logger.error("Failed to send message to destination=" + destination +

View File

@ -57,7 +57,7 @@ public class StompBrokerRelayMessageHandler implements MessageHandler, SmartLife
private static final String STOMP_RELAY_SYSTEM_SESSION_ID = "stompRelaySystemSessionId";
private final MessageChannel outboundChannel;
private final MessageChannel messageChannel;
private final String[] destinationPrefixes;
@ -83,14 +83,14 @@ public class StompBrokerRelayMessageHandler implements MessageHandler, SmartLife
/**
* @param outboundChannel a channel for messages going out to clients
* @param messageChannel the channel to send messages from the STOMP broker to
* @param destinationPrefixes the broker supported destination prefixes; destinations
* that do not match the given prefix are ignored.
*/
public StompBrokerRelayMessageHandler(MessageChannel outboundChannel, Collection<String> destinationPrefixes) {
Assert.notNull(outboundChannel, "outboundChannel is required");
public StompBrokerRelayMessageHandler(MessageChannel messageChannel, Collection<String> destinationPrefixes) {
Assert.notNull(messageChannel, "messageChannel is required");
Assert.notNull(destinationPrefixes, "destinationPrefixes is required");
this.outboundChannel = outboundChannel;
this.messageChannel = messageChannel;
this.destinationPrefixes = destinationPrefixes.toArray(new String[destinationPrefixes.size()]);
}
@ -411,7 +411,7 @@ public class StompBrokerRelayMessageHandler implements MessageHandler, SmartLife
}
protected void sendMessageToClient(Message<?> message) {
outboundChannel.send(message);
messageChannel.send(message);
}
private void sendError(String sessionId, String errorText) {