@@ -41,12 +41,12 @@ public class MessageBrokerRegistry {
41
41
42
42
private StompBrokerRelayRegistration brokerRelayRegistration ;
43
43
44
+ private final ChannelRegistration brokerChannelRegistration = new ChannelRegistration ();
45
+
44
46
private String [] applicationDestinationPrefixes ;
45
47
46
48
private String userDestinationPrefix ;
47
49
48
- private ChannelRegistration brokerChannelRegistration = new ChannelRegistration ();
49
-
50
50
51
51
public MessageBrokerRegistry (SubscribableChannel clientInboundChannel , MessageChannel clientOutboundChannel ) {
52
52
Assert .notNull (clientInboundChannel );
@@ -55,6 +55,7 @@ public MessageBrokerRegistry(SubscribableChannel clientInboundChannel, MessageCh
55
55
this .clientOutboundChannel = clientOutboundChannel ;
56
56
}
57
57
58
+
58
59
/**
59
60
* Enable a simple message broker and configure one or more prefixes to filter
60
61
* destinations targeting the broker (e.g. destinations prefixed with "/topic").
@@ -76,6 +77,21 @@ public StompBrokerRelayRegistration enableStompBrokerRelay(String... destination
76
77
return this .brokerRelayRegistration ;
77
78
}
78
79
80
+ /**
81
+ * Customize the channel used to send messages from the application to the message
82
+ * broker. By default, messages from the application to the message broker are sent
83
+ * synchronously, which means application code sending a message will find out
84
+ * if the message cannot be sent through an exception. However, this can be changed
85
+ * if the broker channel is configured here with task executor properties.
86
+ */
87
+ public ChannelRegistration configureBrokerChannel () {
88
+ return this .brokerChannelRegistration ;
89
+ }
90
+
91
+ protected ChannelRegistration getBrokerChannelRegistration () {
92
+ return this .brokerChannelRegistration ;
93
+ }
94
+
79
95
/**
80
96
* Configure one or more prefixes to filter destinations targeting application
81
97
* annotated methods. For example destinations prefixed with "/app" may be
@@ -91,6 +107,11 @@ public MessageBrokerRegistry setApplicationDestinationPrefixes(String... prefixe
91
107
return this ;
92
108
}
93
109
110
+ protected Collection <String > getApplicationDestinationPrefixes () {
111
+ return (this .applicationDestinationPrefixes != null ?
112
+ Arrays .asList (this .applicationDestinationPrefixes ) : null );
113
+ }
114
+
94
115
/**
95
116
* Configure the prefix used to identify user destinations. User destinations
96
117
* provide the ability for a user to subscribe to queue names unique to their
@@ -108,19 +129,13 @@ public MessageBrokerRegistry setUserDestinationPrefix(String destinationPrefix)
108
129
return this ;
109
130
}
110
131
111
- /**
112
- * Customize the channel used to send messages from the application to the message
113
- * broker. By default messages from the application to the message broker are sent
114
- * synchronously, which means application code sending a message will find out
115
- * if the message cannot be sent through an exception. However, this can be changed
116
- * if the broker channel is configured here with task executor properties.
117
- */
118
- public ChannelRegistration configureBrokerChannel () {
119
- return this .brokerChannelRegistration ;
132
+ protected String getUserDestinationPrefix () {
133
+ return this .userDestinationPrefix ;
120
134
}
121
135
136
+
122
137
protected SimpleBrokerMessageHandler getSimpleBroker (SubscribableChannel brokerChannel ) {
123
- if (( this .simpleBrokerRegistration == null ) && ( this .brokerRelayRegistration == null ) ) {
138
+ if (this .simpleBrokerRegistration == null && this .brokerRelayRegistration == null ) {
124
139
enableSimpleBroker ();
125
140
}
126
141
if (this .simpleBrokerRegistration != null ) {
@@ -136,16 +151,4 @@ protected StompBrokerRelayMessageHandler getStompBrokerRelay(SubscribableChannel
136
151
return null ;
137
152
}
138
153
139
- protected Collection <String > getApplicationDestinationPrefixes () {
140
- return (this .applicationDestinationPrefixes != null )
141
- ? Arrays .asList (this .applicationDestinationPrefixes ) : null ;
142
- }
143
-
144
- protected String getUserDestinationPrefix () {
145
- return this .userDestinationPrefix ;
146
- }
147
-
148
- protected ChannelRegistration getBrokerChannelRegistration () {
149
- return this .brokerChannelRegistration ;
150
- }
151
154
}
0 commit comments