I can see message in DLQ logs, Where can I see messages published to Amazon SNS Topic? - amazon-sns

I can see message in DLQ logs, Where can I see messages published to Amazon SNS Topic?
I would like to compare good message and message ended up in DLQ
I am looking for reason why it ended up in DLQ

Related

Amazon SNS Filter control and access

Looking to setup a aws SNS topic - I intend to subscribe a third party to this topic and I’m hoping that I can use its message filtering to ensure said third party only gets the messages they need.
Is that possible? Since I control the SNS topic I’m hoping I can also control who gets to see what but the docs are not super clear.
From Amazon SNS Message Filtering - Amazon Simple Notification Service:
By default, an Amazon SNS topic subscriber receives every message published to the topic. To receive a subset of the messages, a subscriber must assign a filter policy to the topic subscription.
A filter policy is a simple JSON object containing attributes that define which messages the subscriber receives. When you publish a message to a topic, Amazon SNS compares the message attributes to the attributes in the filter policy for each of the topic's subscriptions. If any of the attributes match, Amazon SNS sends the message to the subscriber. Otherwise, Amazon SNS skips the subscriber without sending the message. If a subscription doesn't have a filter policy, the subscription receives every message published to its topic.

FCM admin sdk sendToTopic not received by everyone

I'm using the Firebase Admin SDK on my backend server to create topics, subscribe/unsubscribe tokens, and send topic messages.
There are some devices, which doesn't receive messages sent to a given topic.
What I know:
The device must be subscribed to the topic, as when I send topic message from the firebase console, it arrives.
The Admin SDK-s sendToTopic function must work, as other devices subscribed to the topic receive the message.
I guess the problem is specific with some devices and it fails during the sending process.
Does anyone have any experience with this issue?
Can I somehow see logs or any information about message status per device?

Sent notification FCM before topic was created or before subscription

Scenario: Send notification to topic "X" with expire time 4 weeks.
What happens when:
Topic does not exist, no one subscribed to it. Then after one hour,
someone subscribe to it. Will this device get this notification?
Topic exists or existed (had one subscriber but he unscusribed), now he is subscribing again after an hour of sending. Will it get it?
One or more devices are subscribing to topic X. All of them got it. One new device now subscribe to it, after as always, an hour from sending. Will it get it?
Something is telling me "No" to all of those answers, but have problem with finding that answer in fcm documenation.
If I guessed right, what would be solution to get this previous notifications? Let's say for business it is important, and notification lives only for an hour, but in between he could change subscription and after getting back, he would like to get that notification.
FCM Topics are auto-created when you send a message to it, or when somebody subscribes to them.
The device only receives messages that were sent to the topic after it subscribes. It does not receive messages that were sent to the topic when it isn't subscribed.
Since in all three questions the message is sent to the topic when the device isn't subscribed, it will not receive those messages.
For this type of scenario you'll want to use a persistent database, instead of a transient message passing mechanism. E.g. you can store the messages for each topic in a database, and grant the device access to that database when it subscribes to the topic.

Firebase cloud messaging message log

In my Android app I receive messages sent using Firebase, the problem is not all messages arrive and sometimes messages arrival is very slow.
In my server side I track the messages I send to FCM and I always receive success: 1 response from FCM, still there are messages I do not receive in my Android app.
I thought an FCM messages log would be a great help in cases like described above but I don't sure if this option exist.
Is there a way to browse Firebase Messages log ?
First of all, did you know that Firebase Cloud Messages can be delayed if the connected device is in doze mode and your app's standby bucket is not high enough to wake up the device? Therefore, even if FCM sends the message to your target device in time, there is still a chance that it will be delayed by the Android platform. Also, if the message is sent with high priority, you might have a chance to wake up the device from doze mode to be able to receive the message in time.
The following two docs will give you a more detailed explanation:
https://developer.android.com/training/monitoring-device-state/doze-standby
https://developer.android.com/topic/performance/power/power-details
Besides, FCM provides three sets of tools to help you get insight into message delivery:
Firebase console message delivery reports (go to Firebase Console -> Messaging -> Reports)
Aggregated Android SDK delivery metrics from the Firebase Cloud Messaging Data API
Comprehensive data export to Google BigQuery
All these three tools can help you understand your message delivery, the following docs have a pretty good explanation about how to use them:
https://medium.com/firebase-developers/what-is-fcm-aggregated-delivery-data-d6d68396b83b
https://firebase.google.com/docs/cloud-messaging/understand-delivery?platform=android#count-data-messages-sent

Amazon Simple Notification Service to http endpoint

I want to send message from Amazon Simple Notification Service(SNS) to the http endpoint. There is no proper solid documentation on how to do that. Though I had read Amazon SNS documentation still I could not get entire picture.
Can anyone give me simple example on how Amazon SNS and http endpoint work together?
There good documentation for what you asking: http://docs.aws.amazon.com/sns/latest/dg/sns-dg.pdf
Look at the page #147, it describes what steps you need to do for sending messages to HTTP(s) endpoint.
Also check this example which describes how to create topic, subscribe endpoint, confirm subscription and start to receive notification messages from SNS (uses Java SDK): https://github.com/mfine/AmazonSNSExample
General picture is:
On the publisher side:
create topic and subscribe some endpoint to receive messages. After subscribing endpoint to topic, the endpoint will receive SubscriptionConfirmation message.
start publish to topic so your endpoints will receive notification messages
On the subscriber side (your endpoint should be able to handle at least confirm subscription request and notification messages):
confirm subscription: make HTTP GET request to the "SubscribeURL" URL which comes inside the body of the confirm subscription request. Before you confirm subscription your endpoint will not receive any messages from SNS
receive notification messages and do what you want

Resources