ARTEMIS-697 Avoid self-discovery
This avoids an issue where a broker would discover itself, causing an unexpected behavior when using core bridges to forward messages: * Make channel manager a singleton ensuring that only one channel with a given name exists * Ensure that messages are marked with NON_LOOPBACK to avoid receiving messages originating from itself
This commit is contained in:
parent
6e8832b6cb
commit
bf4796c5d3
|
@ -34,7 +34,7 @@ public class JChannelManager {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(JChannelManager.class);
|
||||
|
||||
private Map<String, JChannelWrapper> channels;
|
||||
private static Map<String, JChannelWrapper> channels;
|
||||
|
||||
public synchronized JChannelWrapper getJChannel(String channelName,
|
||||
JGroupsBroadcastEndpoint endpoint) throws Exception {
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
|||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jgroups.JChannel;
|
||||
import org.jgroups.Message;
|
||||
import org.jgroups.ReceiverAdapter;
|
||||
|
||||
/**
|
||||
|
@ -127,6 +128,7 @@ public class JChannelWrapper {
|
|||
|
||||
public void send(org.jgroups.Message msg) throws Exception {
|
||||
if (logger.isTraceEnabled()) logger.trace(this + "::Sending JGroups Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + msg);
|
||||
msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
|
||||
channel.send(msg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue