michaelandrepearce commented on a change in pull request #2892: ARTEMIS-2549 -
Add Downstream support to Federation
URL: https://github.com/apache/activemq-artemis/pull/2892#discussion_r348353170
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddress.java
##########
@@ -113,7 +116,31 @@ public void start() {
*/
@Override
public synchronized void afterCreateQueue(Queue queue) {
- createRemoteConsumer(queue);
+ conditionalCreateRemoteConsumer(queue);
+ }
+
+ private void conditionalCreateRemoteConsumer(Queue queue) {
+ //Always create demand if not a federated queue
+ if (!queue.getName().toString().startsWith(FEDERATED_QUEUE_PREFIX)) {
+ createRemoteConsumer(queue);
+ } else {
+ //For federated queues we want to make sure that we aren't creating
demand
+ //if the federated queue is part of the same federation stream as we
would get into a situation
+ //where a local consumer on broker A created a federated queue on
broker B and in turn broker
+ //A would respond to the federated queue on B and created a federated
queue on A even though there is
+ //no local demand on B
+
+ //For queues part of a different federation stream we want to create
demand
+ String[] federationToken = queue.getName().toString().split("\\.");
Review comment:
Where is the "." coming from? Is it wildcard settings separator? If so will
need to honor that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services