Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTEMIS-3753 Prevent sending message to internal queues on mirror #4012

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -201,6 +201,13 @@ public void sendMessage(Message message, RoutingContext context, List<MessageRef
return;
}

if (context.isInternal()) {
if (logger.isTraceEnabled()) {
logger.trace("server " + server + " is discarding send to avoid sending to internal queue");
}
return;
}

if (logger.isTraceEnabled()) {
logger.trace(server + " send message " + message);
}
Expand Down
Expand Up @@ -41,6 +41,9 @@ public interface RoutingContext {
* to avoid*/
boolean isMirrorController();

/** return true if every queue routed is internal */
boolean isInternal();

MirrorController getMirrorSource();

RoutingContext setMirrorSource(MirrorController mirrorController);
Expand Down
Expand Up @@ -59,6 +59,8 @@ public class RoutingContextImpl implements RoutingContext {

Boolean reusable = null;

Boolean internalOnly = null;

volatile int version;

private final Executor executor;
Expand Down Expand Up @@ -95,6 +97,11 @@ public boolean isReusable() {
return reusable != null && reusable;
}

@Override
public boolean isInternal() {
return internalOnly != null && internalOnly;
}

@Override
public int getPreviousBindingsVersion() {
return version;
Expand Down Expand Up @@ -138,6 +145,8 @@ public RoutingContext clear() {

this.reusable = null;

this.internalOnly = null;

return this;
}

Expand All @@ -163,6 +172,13 @@ public void addQueue(final SimpleString address, final Queue queue) {
listing.getNonDurableQueues().add(queue);
}

if (internalOnly == null) {
internalOnly = true;
}

// every queue added has to be internal only
internalOnly = internalOnly && queue.isInternalQueue();

queueCount++;
}

Expand Down