-
Notifications
You must be signed in to change notification settings - Fork 959
ARTEMIS-6004 Add clientFailoverAdvertisingEnabled configuration to not send failover server list info to AMQP clients #6614
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,10 +27,12 @@ | |
| import org.apache.activemq.artemis.api.core.ActiveMQBuffers; | ||
| import org.apache.activemq.artemis.api.core.ActiveMQException; | ||
| import org.apache.activemq.artemis.api.core.Message; | ||
| import org.apache.activemq.artemis.api.core.TransportConfiguration; | ||
| import org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper; | ||
| import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl; | ||
| import org.apache.activemq.artemis.core.remoting.CloseListener; | ||
| import org.apache.activemq.artemis.core.remoting.FailureListener; | ||
| import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; | ||
| import org.apache.activemq.artemis.core.server.ActiveMQServer; | ||
| import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; | ||
| import org.apache.activemq.artemis.core.server.cluster.ClusterManager; | ||
|
|
@@ -49,12 +51,14 @@ | |
| import org.apache.activemq.artemis.protocol.amqp.sasl.ServerSASLFactory; | ||
| import org.apache.activemq.artemis.spi.core.remoting.Connection; | ||
| import org.apache.activemq.artemis.spi.core.remoting.ReadyListener; | ||
| import org.apache.activemq.artemis.utils.ConfigurationHelper; | ||
| import org.apache.activemq.artemis.utils.UUIDGenerator; | ||
| import org.apache.qpid.proton.amqp.Binary; | ||
| import org.apache.qpid.proton.amqp.Symbol; | ||
| import org.apache.qpid.proton.amqp.transport.AmqpError; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.lang.invoke.MethodHandles; | ||
|
|
||
| import io.netty.buffer.ByteBuf; | ||
|
|
@@ -191,7 +195,7 @@ public AMQPSessionCallback createSessionCallback(AMQPConnectionContext connectio | |
| } | ||
|
|
||
| public void sendSASLSupported() { | ||
| connection.write(ActiveMQBuffers.wrappedBuffer(new byte[]{'A', 'M', 'Q', 'P', 3, 1, 0, 0})); | ||
| connection.write(ActiveMQBuffers.wrappedBuffer(new byte[] {'A', 'M', 'Q', 'P', 3, 1, 0, 0})); | ||
| } | ||
|
|
||
| public boolean validateConnection(org.apache.qpid.proton.engine.Connection connection, SASLResult saslResult) { | ||
|
|
@@ -266,7 +270,14 @@ public URI getFailoverList() { | |
| if (clusterConnection != null) { | ||
| TopologyMemberImpl member = clusterConnection.getTopology().getMember(server.getNodeID().toString()); | ||
| if (member != null) { | ||
| return member.toBackupURI(); | ||
| TransportConfiguration backupConnector = member.getBackup(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding this here seems off if you intend as you've said above for this to be a more generic option applicable to other protocols besides AMQP. Having to copy this code block around for any other implementation that needs it is sub optimal and likely error prone. Seems as though this code should live elsewhere so that it can be called here or in other protocols implementations to check if the connector is to be advertised.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently this fix is specific for AMQP. I could see making this naming AMQP specific if that make it more obvious for now. No matter what there won't be a single spot for all protocols unless an abstraction is specifically made for this but I don't think this is something all protocols support so I wouldn't think that makes sense but let me know if that would stop this getting merged. Core might be only other protocol that I know of that might use this but I could be wrong. |
||
| if (backupConnector == null) { | ||
| return null; | ||
| } | ||
| boolean clientFailoverAdvertisingEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.CLIENT_FAILOVER_ADVERTISING_ENABLED_PROP_NAME, true, backupConnector.getCombinedParams()); | ||
| if (clientFailoverAdvertisingEnabled) { | ||
| return member.toBackupURI(); | ||
| } | ||
| } | ||
| } | ||
| return null; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value should be added to the initialization of ALLOWABLE_CONNECTOR_KEYS from what I can tell the usage is meant to be. Also a test to ensure that the XML parses out the URI options and applies them as this would show that the option is likely not applied currently in that case since it isn't added to the allowed keys set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that makes sense. My manual testing did not seem to need this but I'll add for completeness.
I've added the property to
ALLOWABLE_CONNECTOR_KEYSand added a regression test inConnectorTransportConfigurationParserURITestto verify thatclientFailoverAdvertisingEnabled=falseis parsed from the connector URI into theTransportConfigurationparams.