@@ -48,7 +48,7 @@ public Task<IOutboxTransaction> BeginTransaction(ContextBag context,
4848 } ,
4949 ExpressionAttributeValues = new Dictionary < string , AttributeValue > ( 1 )
5050 {
51- { ":outboxId" , new AttributeValue { S = OutboxPartitionKey ( messageId ) } }
51+ { ":outboxId" , new AttributeValue { S = OutboxPartitionKey ( endpointIdentifier , messageId ) } }
5252 } ,
5353 TableName = configuration . Table . TableName
5454 } ;
@@ -185,7 +185,7 @@ IReadOnlyCollection<TransactWriteItem> Serialize(OutboxMessage outboxMessage, Co
185185 {
186186 {
187187 configuration . Table . PartitionKeyName ,
188- new AttributeValue { S = OutboxPartitionKey ( outboxMessage . MessageId ) }
188+ new AttributeValue { S = OutboxPartitionKey ( endpointIdentifier , outboxMessage . MessageId ) }
189189 } ,
190190 {
191191 configuration . Table . SortKeyName ,
@@ -220,7 +220,7 @@ IReadOnlyCollection<TransactWriteItem> Serialize(OutboxMessage outboxMessage, Co
220220 {
221221 Item = new Dictionary < string , AttributeValue > ( 6 )
222222 {
223- { configuration . Table . PartitionKeyName , new AttributeValue { S = OutboxPartitionKey ( outboxMessage . MessageId ) } } ,
223+ { configuration . Table . PartitionKeyName , new AttributeValue { S = OutboxPartitionKey ( endpointIdentifier , outboxMessage . MessageId ) } } ,
224224 { configuration . Table . SortKeyName , new AttributeValue { S = OutboxOperationSortKey ( outboxMessage . MessageId , n ) } } ,
225225 { MessageId , new AttributeValue { S = operation . MessageId } } ,
226226 {
@@ -288,7 +288,7 @@ public async Task SetAsDispatched(string messageId, ContextBag context,
288288 {
289289 Key = new Dictionary < string , AttributeValue > ( 2 )
290290 {
291- { configuration . Table . PartitionKeyName , new AttributeValue { S = OutboxPartitionKey ( messageId ) } } ,
291+ { configuration . Table . PartitionKeyName , new AttributeValue { S = OutboxPartitionKey ( endpointIdentifier , messageId ) } } ,
292292 { configuration . Table . SortKeyName , new AttributeValue { S = OutboxMetadataSortKey ( messageId ) } }
293293 } ,
294294 UpdateExpression = "SET #dispatched = :dispatched, #dispatched_at = :dispatched_at, #ttl = :ttl" ,
@@ -323,7 +323,7 @@ public async Task SetAsDispatched(string messageId, ContextBag context,
323323 {
324324 Key = new Dictionary < string , AttributeValue > ( 2 )
325325 {
326- { configuration . Table . PartitionKeyName , new AttributeValue { S = OutboxPartitionKey ( messageId ) } } ,
326+ { configuration . Table . PartitionKeyName , new AttributeValue { S = OutboxPartitionKey ( endpointIdentifier , messageId ) } } ,
327327 { configuration . Table . SortKeyName , new AttributeValue { S = OutboxOperationSortKey ( messageId , i ) } }
328328 }
329329 }
@@ -341,9 +341,9 @@ await dynamoDbClient.BatchWriteItemWithRetries(writeRequestBatches, configuratio
341341 . ConfigureAwait ( false ) ;
342342 }
343343
344- string OutboxPartitionKey ( string messageId ) => $ "OUTBOX#{ endpointIdentifier } #{ messageId } ";
345- string OutboxMetadataSortKey ( string messageId ) => $ "OUTBOX#METADATA#{ messageId } ";
346- string OutboxOperationSortKey ( string messageId , int messageNumber ) => $ "OUTBOX#OPERATION#{ messageId } #{ messageNumber : D4} ";
344+ internal static string OutboxPartitionKey ( string endpointIdentifier , string messageId ) => $ "OUTBOX#{ endpointIdentifier } #{ messageId } ";
345+ static string OutboxMetadataSortKey ( string messageId ) => $ "OUTBOX#METADATA#{ messageId } ";
346+ static string OutboxOperationSortKey ( string messageId , int messageNumber ) => $ "OUTBOX#OPERATION#{ messageId } #{ messageNumber : D4} ";
347347
348348 readonly IAmazonDynamoDB dynamoDbClient ;
349349 readonly OutboxPersistenceConfiguration configuration ;
0 commit comments