Skip to content

Sending single message for multiple devices with for loop #900

Answered by jchambers
pasake asked this question in Q&A
Discussion options

You must be logged in to vote

While I'm having a little trouble following your example code (you're both calling sendNotificationFuture.get AND sendNotificationFuture.whenComplete, which is a little confusing), it sounds like you're running into this frequently-asked question:

I sent a bunch of notifications, and lots (but not all) of them failed with an Http2GoAwayException or ClientNotConnectedException. How come?

My recommendation would be to do something like this:

final ApnsClient apnsClient = ...;

final CountDownLatch countDownLatch = new CountDownLatch(cfgList.size());

for (final PushConfigRspDTO configRspDTO : cfgLst) {
    final final SimpleApnsPushNotification pushNotification = ...;

    apnsClient.send…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pasake
Comment options

Answer selected by pasake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #899 on July 23, 2021 13:08.