Skip to content

Commit

Permalink
Refactor FullSubjectName method for compatibility (superstreamlabs#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbazen authored Dec 4, 2023
1 parent a68f0ea commit 562ed44
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Memphis.Client/Producer/MemphisProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,14 @@ async Task ReInitializeProducerAndRetry(byte[] message, NameValueCollection head

string FullSubjectName()
{
string partitionString = streamName.Split('$')[1];
int partitionNumber = Convert.ToInt32(partitionString);
if (_memphisClient.FunctionDetails.TryGetValue(_internalStationName, out var functionDetails) &&
functionDetails.PartitionsFunctions.TryGetValue(partitionNumber, out var functionId))
if (_memphisClient.FunctionDetails.TryGetValue(_internalStationName, out var functionDetails))
{
return $"{streamName}.functions.{functionId}";
string partitionString = streamName.Split('$')[1];
int partitionNumber = Convert.ToInt32(partitionString);
if (functionDetails.PartitionsFunctions.TryGetValue(partitionNumber, out var functionId))
{
return $"{streamName}.functions.{functionId}";
}
}
return $"{streamName}.final";
}
Expand Down

0 comments on commit 562ed44

Please sign in to comment.