NiFi RPG errors when switching between transport protocols. This closes
@@ -42,6 +42,7 @@ import org.apache.nifi.remote.exception.ProtocolException;
import org.apache.nifi.remote.exception.UnknownPortException;
import org.apache.nifi.remote.exception.UnreachableClusterException;
import org.apache.nifi.remote.protocol.DataPacket;
+import org.apache.nifi.remote.protocol.SiteToSiteTransportProtocol;
import org.apache.nifi.remote.protocol.http.HttpProxy;
import org.apache.nifi.remote.util.SiteToSiteRestApiClient;
import org.apache.nifi.remote.util.StandardDataPacket;
@@ -124,9 +125,9 @@ public class StandardRemoteGroupPort extends RemoteGroupPort {
this.targetId = targetId;
}
- private static File getPeerPersistenceFile(final String portId, final NiFiProperties nifiProperties) {
+ private static File getPeerPersistenceFile(final String portId, final NiFiProperties nifiProperties, final SiteToSiteTransportProtocol transportProtocol) {
final File stateDir = nifiProperties.getPersistentStateDirectory();
- return new File(stateDir, portId + ".peers");
+ return new File(stateDir, String.format("%s_%s.peers", portId, transportProtocol.name()));
}
@Override
@@ -180,7 +181,7 @@ public class StandardRemoteGroupPort extends RemoteGroupPort {
.sslContext(sslContext)
.useCompression(isUseCompression())
.eventReporter(remoteGroup.getEventReporter())
- .peerPersistenceFile(getPeerPersistenceFile(getIdentifier(), nifiProperties))
+ .peerPersistenceFile(getPeerPersistenceFile(getIdentifier(), nifiProperties, remoteGroup.getTransportProtocol()))
.nodePenalizationPeriod(penalizationMillis, TimeUnit.MILLISECONDS)
.timeout(remoteGroup.getCommunicationsTimeout(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS)
.transportProtocol(remoteGroup.getTransportProtocol())
