[ARTMIS-1431] Adapt transport configuration in ClientProtocolManagerFactory

add the adaptTransportConfiguration() method to the
ClientProtocolManagerFactory so that transport configurations used by
the ClientProtocolManager have an opportunity to adapt their transport
configuration.

This allows the HornetQClientProtocolManagerFactory to adapt the
transport configuration received by remote HornetQ broker to replace the
HornetQ-based NettyConnectorFactory by the Artemis-based one.

JIRA: https://issues.apache.org/jira/browse/ARTEMIS-1431
This commit is contained in:
Jeff Mesnil 2017-09-22 16:35:36 +02:00 committed by Clebert Suconic
parent c85575f435
commit 6febd5e314
1 changed files with 5 additions and 1 deletions

View File

@ -65,7 +65,11 @@ public class XARecoveryConfig {
final ClientProtocolManagerFactory clientProtocolManager) { final ClientProtocolManagerFactory clientProtocolManager) {
TransportConfiguration[] newTransportConfiguration = new TransportConfiguration[transportConfiguration.length]; TransportConfiguration[] newTransportConfiguration = new TransportConfiguration[transportConfiguration.length];
for (int i = 0; i < transportConfiguration.length; i++) { for (int i = 0; i < transportConfiguration.length; i++) {
newTransportConfiguration[i] = clientProtocolManager.adaptTransportConfiguration(transportConfiguration[i].newTransportConfig("")); if (clientProtocolManager != null) {
newTransportConfiguration[i] = clientProtocolManager.adaptTransportConfiguration(transportConfiguration[i].newTransportConfig(""));
} else {
newTransportConfiguration[i] = transportConfiguration[i].newTransportConfig("");
}
} }
this.transportConfiguration = newTransportConfiguration; this.transportConfiguration = newTransportConfiguration;