Skip to content

Commit

Permalink
Update to checkif sendOnly config is on
Browse files Browse the repository at this point in the history
  • Loading branch information
jpalac committed Sep 5, 2023
1 parent 1df2f4d commit cb1ee00
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ServerlessTransport : TransportDefinition
{
// HINT: This constant is defined in NServiceBus but is not exposed
const string MainReceiverId = "Main";
const string SendOnlyConfigKey = "Endpoint.SendOnly";

public ServerlessTransport(AzureServiceBusTransport baseTransport) : base(
baseTransport.TransportTransactionMode,
Expand All @@ -32,9 +33,11 @@ public override async Task<TransportInfrastructure> Initialize(HostSettings host

var serverlessTransportInfrastructure = new ServerlessTransportInfrastructure(baseTransportInfrastructure);

PipelineInvoker = receivers.Length > 0
? (PipelineInvoker)serverlessTransportInfrastructure.Receivers[MainReceiverId]
: new PipelineInvoker(new SendOnlyReceiver()); // send-only endpoint
var isSendOnly = hostSettings.CoreSettings.GetOrDefault<bool>(SendOnlyConfigKey);

PipelineInvoker = isSendOnly
? new PipelineInvoker(new SendOnlyReceiver()) // send-only endpoint
: (PipelineInvoker)serverlessTransportInfrastructure.Receivers[MainReceiverId];

return serverlessTransportInfrastructure;
}
Expand Down

0 comments on commit cb1ee00

Please sign in to comment.