Skip to content

Commit

Permalink
Only configure publisher confirmation callbacks once during external …
Browse files Browse the repository at this point in the history
…bus initialisation (#3256)
  • Loading branch information
dhickie authored Aug 13, 2024
1 parent 3430d02 commit 02cbf36
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/Paramore.Brighter/CommandProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ public CommandProcessor(IAmARequestContextFactory requestContextFactory,
_transformPipelineBuilder = new TransformPipelineBuilder(mapperRegistry, messageTransformerFactory);

InitExtServiceBus(policyRegistry, outBox, outboxTimeout, producerRegistry, outboxBulkChunkSize);

ConfigureCallbacks(producerRegistry);
}

/// <summary>
Expand Down Expand Up @@ -220,8 +218,6 @@ public CommandProcessor(IAmASubscriberRegistry subscriberRegistry,
_transformPipelineBuilder = new TransformPipelineBuilder(mapperRegistry, messageTransformerFactory);

InitExtServiceBus(policyRegistry, outBox, outboxTimeout, producerRegistry, outboxBulkChunkSize);

ConfigureCallbacks(producerRegistry);
}

/// <summary>
Expand Down Expand Up @@ -261,8 +257,6 @@ public CommandProcessor(IAmASubscriberRegistry subscriberRegistry,
_transformPipelineBuilder = new TransformPipelineBuilder(mapperRegistry, messageTransformerFactory);

InitExtServiceBus(policyRegistry, outBox, outboxTimeout, producerRegistry, outboxBulkChunkSize);

ConfigureCallbacks(producerRegistry);
}

/// <summary>
Expand Down Expand Up @@ -815,8 +809,7 @@ private void AssertValidSendPipeline<T>(T command, int handlerCount) where T : c
$"No command handler was found for the typeof command {typeof(T)} - a command should have exactly one handler.");
}


private void ConfigureCallbacks(IAmAProducerRegistry producerRegistry)
private static void ConfigureCallbacks(IAmAProducerRegistry producerRegistry)
{
//Only register one, to avoid two callbacks where we support both interfaces on a producer
foreach (var producer in producerRegistry.Producers)
Expand Down Expand Up @@ -871,6 +864,8 @@ private static void InitExtServiceBus(
_bus.PolicyRegistry = policyRegistry;
_bus.ProducerRegistry = producerRegistry;
_bus.OutboxBulkChunkSize = outboxBulkChunkSize;

ConfigureCallbacks(producerRegistry);
}
}
}
Expand Down

0 comments on commit 02cbf36

Please sign in to comment.