Skip to content

Commit e14d50c

Browse files
timbussmannjpalac
authored andcommitted
handling send-only configurations
1 parent f458dbc commit e14d50c

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src/NServiceBus.AzureFunctions.InProcess.ServiceBus/Serverless/TransportWrapper/ServerlessTransport.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ public override async Task<TransportInfrastructure> Initialize(HostSettings host
3131
.ConfigureAwait(false);
3232

3333
var serverlessTransportInfrastructure = new ServerlessTransportInfrastructure(baseTransportInfrastructure);
34-
PipelineInvoker = (PipelineInvoker)serverlessTransportInfrastructure.Receivers[MainReceiverId];
34+
35+
PipelineInvoker = receivers.Length > 0
36+
? (PipelineInvoker)serverlessTransportInfrastructure.Receivers[MainReceiverId]
37+
: new PipelineInvoker(new NullReceiver()); // send-only endpoint
38+
3539
return serverlessTransportInfrastructure;
3640
}
3741

@@ -53,4 +57,21 @@ public override IReadOnlyCollection<TransportTransactionMode> GetSupportedTransa
5357
TransportTransactionMode.SendsAtomicWithReceive
5458
};
5559
}
60+
61+
class NullReceiver : IMessageReceiver
62+
{
63+
public Task Initialize(PushRuntimeSettings limitations, OnMessage onMessage, OnError onError,
64+
CancellationToken cancellationToken = new CancellationToken()) =>
65+
throw new System.NotImplementedException();
66+
67+
public Task StartReceive(CancellationToken cancellationToken = new CancellationToken()) => throw new System.NotImplementedException();
68+
69+
public Task ChangeConcurrency(PushRuntimeSettings limitations, CancellationToken cancellationToken = new CancellationToken()) => throw new System.NotImplementedException();
70+
71+
public Task StopReceive(CancellationToken cancellationToken = new CancellationToken()) => throw new System.NotImplementedException();
72+
73+
public ISubscriptionManager Subscriptions { get; }
74+
public string Id { get; }
75+
public string ReceiveAddress { get; }
76+
}
5677
}

0 commit comments

Comments
 (0)