How Long Does a Push Notification Sit in Queue Before Being Removed

How long does a push notification sit in queue before being removed?

Official developer documentation isn't clear about this. From developer.apple.com:

Apple Push Notification Service includes a default Quality of Service
(QoS) component that performs a store-and-forward function. If APNs
attempts to deliver a notification but the device is offline, the QoS
stores the notification. It retains only one notification per
application on a device: the last notification received from a
provider for that application. When the offline device later
reconnects, the QoS forwards the stored notification to the device.
The QoS retains a notification for a limited period before deleting
it.

But according to PCWorld, it's 28 days:

If the app is running, it gets the notification immediately. If the
app isn't running, the notification is held in the phone to be
consumed at the app's next launch. If the iPhone is offline when the
sender attempts delivery, APNS attempts to send the notification for
28 days.

While 28 days may have been true in 2009, I wouldn't be surprised if its different today. The ambiguity in the documentation is a great excuse for Apple to change this timeout period willy-nilly.

FCM push notifications queuing up if browser is closed / Web-push

An option is to make use of time_to_live:

This parameter specifies how long (in seconds) the message should be kept in FCM storage if the device is offline. The maximum time to live supported is 4 weeks, and the default value is 4 weeks. For more information, see Setting the lifespan of a message.

and set it to your desired time. Basically it determines until only when FCM would keep the message on the queue.

Ack Deadline, Message Retention Duration, Dead Lettering and Retry Policy in GCP

We recommend using our supported client libraries, which should extend the ack deadlines automatically. In general terms, please find the answers below:

so during this time if the subscriber tries to pull the message again, will they not receive the messages as the queue will be closed for 10secs

You will not receive the same message again in that time period. You can still pull other messages from the backlog. Please note this is a best effort feature and at times you might receive the message again within the ack deadline.

But will the subscriber be getting these messages in each pull they do on the topic, even after max retries

Where are you configuring the max retries? Cloud Pub/Sub only provides this max delivery attempts as part of dead letter queues. If you have dead letter queues configured, the message will be relayed to the dead letter topic after certain number of retries and removed from the parent subscription. Otherwise, the message will stay on the parent subscription and Cloud Pub/Sub will attempt to deliver it when possible.

Bad messages here, do they mean the messages which cannot be delivered by the pubsub service to the subscribers or the messages which the subscribers are not able to ack. But in the second case where the subscribers are not able to ack. It can also mean that messages might be good but the subscriber is not acking them. In this case, as message retention is set for 7 days, will they stay in the same topic or if the dead letter is created by the subscription, will it be the responsibility of the pubsub service to forward the messages to the dead letter topic?

Bad messages in this context will be the messages which the subscribers are not able to ack. If a subscriber does not want to dead letter a message even if they are not able to process them, they should not be using dead letter queues. Dead letter queues are ideal if you are okay with the message being removed from the subscription in failure scenarios. Messages that expire the 7 day retention window are not moved to the dead letter topic systematically.

Say I set the ack deadline to 10 secs. And set the retry policy to minimum exponential backoff to 30 secs and maximum to 600 seconds. So in this case if the subscriber pulls the message for the first time but doesn't acknowledge it, the ack deadline clock starts and lets say it ends, then if the subscriber pulls it the second time does the pubsub service wait for another 30 seconds (minimum exponential backoff) before it tries to redeliver the message?

That is correct. This answer might be useful as well: GCP PubSub retry backoff timing.

I hope this was helpful.

How can I create a push notification that goes off after x number of seconds? (iPhone/iPad)

Have you considered using local notifications instead? You can schedule it to go off at a certain time without having to make the server round-trip

Auto scaling a Pull Queue in App Engine

I solved this counting the pending tasks in the Notification Queue with this method, and then adding workers depending on the number of pending tasks:

public static function task_count($queue)
{
$request = new google\appengine\TaskQueueFetchQueueStatsRequest();
$response = new google\appengine\TaskQueueFetchQueueStatsResponse();

$request->addQueueName($queue);

google\appengine\runtime\ApiProxy::makeSyncCall('taskqueue', 'FetchQueueStats', $request, $response);

return $response->getQueueStats(0)->getNumTasks();
}

iOS execute check before push notification is received

Nope, sadly you can't execute any code on the client side without the user clicking on the notification when the app is not launched. You'll have to do your check server-side to decide wether or not sending a push.

APNS notifications TTL

In Communicating with APNs it states that you can set an Expiration date to notifications:

A UNIX epoch date expressed in seconds (UTC). This header identifies the date when the notification is no longer valid and can be discarded. If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time. If the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it.



Related Topics



Leave a reply



Submit