Polish
This commit is contained in:
parent
329fbf31bc
commit
8a8501a992
|
|
@ -37,18 +37,17 @@ public class SimpleBrokerMessageHandler implements MessageHandler {
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(SimpleBrokerMessageHandler.class);
|
private static final Log logger = LogFactory.getLog(SimpleBrokerMessageHandler.class);
|
||||||
|
|
||||||
private final MessageChannel outboundChannel;
|
private final MessageChannel messageChannel;
|
||||||
|
|
||||||
private SubscriptionRegistry subscriptionRegistry = new DefaultSubscriptionRegistry();
|
private SubscriptionRegistry subscriptionRegistry = new DefaultSubscriptionRegistry();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param outboundChannel the channel to which messages for clients should be sent
|
* @param messageChannel the channel to broadcast messages to
|
||||||
* @param observable an Observable to use to manage subscriptions
|
|
||||||
*/
|
*/
|
||||||
public SimpleBrokerMessageHandler(MessageChannel outboundChannel) {
|
public SimpleBrokerMessageHandler(MessageChannel messageChannel) {
|
||||||
Assert.notNull(outboundChannel, "outboundChannel is required");
|
Assert.notNull(messageChannel, "messageChannel is required");
|
||||||
this.outboundChannel = outboundChannel;
|
this.messageChannel = messageChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -104,7 +103,7 @@ public class SimpleBrokerMessageHandler implements MessageHandler {
|
||||||
Object payload = message.getPayload();
|
Object payload = message.getPayload();
|
||||||
Message<?> clientMessage = MessageBuilder.withPayloadAndHeaders(payload, headers).build();
|
Message<?> clientMessage = MessageBuilder.withPayloadAndHeaders(payload, headers).build();
|
||||||
try {
|
try {
|
||||||
this.outboundChannel.send(clientMessage);
|
this.messageChannel.send(clientMessage);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Throwable ex) {
|
||||||
logger.error("Failed to send message to destination=" + destination +
|
logger.error("Failed to send message to destination=" + destination +
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class StompBrokerRelayMessageHandler implements MessageHandler, SmartLife
|
||||||
|
|
||||||
private static final String STOMP_RELAY_SYSTEM_SESSION_ID = "stompRelaySystemSessionId";
|
private static final String STOMP_RELAY_SYSTEM_SESSION_ID = "stompRelaySystemSessionId";
|
||||||
|
|
||||||
private final MessageChannel outboundChannel;
|
private final MessageChannel messageChannel;
|
||||||
|
|
||||||
private final String[] destinationPrefixes;
|
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
|
* @param destinationPrefixes the broker supported destination prefixes; destinations
|
||||||
* that do not match the given prefix are ignored.
|
* that do not match the given prefix are ignored.
|
||||||
*/
|
*/
|
||||||
public StompBrokerRelayMessageHandler(MessageChannel outboundChannel, Collection<String> destinationPrefixes) {
|
public StompBrokerRelayMessageHandler(MessageChannel messageChannel, Collection<String> destinationPrefixes) {
|
||||||
Assert.notNull(outboundChannel, "outboundChannel is required");
|
Assert.notNull(messageChannel, "messageChannel is required");
|
||||||
Assert.notNull(destinationPrefixes, "destinationPrefixes is required");
|
Assert.notNull(destinationPrefixes, "destinationPrefixes is required");
|
||||||
this.outboundChannel = outboundChannel;
|
this.messageChannel = messageChannel;
|
||||||
this.destinationPrefixes = destinationPrefixes.toArray(new String[destinationPrefixes.size()]);
|
this.destinationPrefixes = destinationPrefixes.toArray(new String[destinationPrefixes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,7 +411,7 @@ public class StompBrokerRelayMessageHandler implements MessageHandler, SmartLife
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendMessageToClient(Message<?> message) {
|
protected void sendMessageToClient(Message<?> message) {
|
||||||
outboundChannel.send(message);
|
messageChannel.send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendError(String sessionId, String errorText) {
|
private void sendError(String sessionId, String errorText) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue