Closed Doris-Ge closed 1 year ago
@Doris-Ge Could you please clarify why sending N requests with 1 notification in each is better rather then sending 1 request with N notifications? For me that fact that I should use SendEachAsync
instead of SendAllAsync
sounds counterintuitive
@hankovich SendAllAsync
calls the legacy Batch Send API which will be discontinued starting June 20, 2024. That's the main reason why it is replaced by SendEachAsync
. SendEachAsync
calls the HTTP v1 API which does not support sending 1 request with N notifications.
SendAllAsync
() andSendMulticastAsync
APIs.SendEachAsync
andSendEachForMulticastAsync
APIsSendEachAsync
vsSendAllAsync
SendEachAsync
sends one HTTP request to V1 Send endpoint for each message in the list.SendAllAsync
sends only one HTTP request to V1 Batch Send endpoint to send all messages in the list.SendEachAsync
callsTask.WhenAll
to wait for allhttpClient.SendAndDeserializeAsync
calls to complete and construct aBatchResponse
with allSendResponse
s. AnhttpClient.SendAndDeserializeAsync
call to V1 Send endpoint either completes with a success or throws an exception. So if an exception is thrown out, the exception will be caught inSendEachAsync
and turned into aSendResponse
with an exception. Therefore, unlikeSendAllAsync
,SendEachAsync
does not always throw an exception for a total failure. It can also return aBatchResponse
with only exceptions in it.SendEachForMulticastAsync
callsSendEachAsync
under the hood.RELEASE NOTE:
SendAllAsync()
andSendMulticastAsync()
APIs are now deprecated. UseSendEachAsync()
andSendEachForMulticastAsync()
APIs instead.