Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

GCM topic support and fallbacks #709

Merged
merged 1 commit into from May 3, 2016

Conversation

matzew
Copy link
Contributor

@matzew matzew commented May 2, 2016

Done for AGPUSH-1454

@secondsun @matskiv this is the PR for the 1.1.x series. Once this is merged, I will get #708 updated and land it on master

* Helper method to check if only categories are applied. Usful in GCM land, where we use topics
*/
@JsonIgnore
public boolean isCategoryOnly() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps these methods should be moved to a util, next to TokenLoader?

Not sure if this is generally helpful on the Criteria API class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@secondsun I thought about this, and will move this into a (GCM Topic) Util class.

@matzew matzew mentioned this pull request May 2, 2016

private Set<String> extractTopicsFrom(final Criteria criteria, final String variantID) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@secondsun this function is another candidate for the (GCM Topic) Util class.

I will update the PR...

@matzew
Copy link
Contributor Author

matzew commented May 3, 2016

@secondsun ok, moved the TokenLoader around and was adding a util, instead of blowing up the public Criteria API (used on the java sender too)

@matzew
Copy link
Contributor Author

matzew commented May 3, 2016

Some testing info, @secondsun @matskiv

I was using an older app (e.g. old hello world, which uses GCM register to get a legacy token)

  1. sending a push, with a category:
17:25:00,293 INFO  [org.jboss.aerogear.unifiedpush.message.sender.GCMPushNotificationSender] (Thread-46 (HornetQ-client-global-threads-1851833922)) Sent push notification to GCM topic: &#x2F;topics&#x2F;soccer
...
17:25:00,320 INFO  [org.jboss.aerogear.unifiedpush.message.sender.GCMPushNotificationSender] (Thread-24 (HornetQ-client-global-threads-1851833922)) Sent push notification to GCM Server for 1 registrationIDs

It first sends to the topic, but also looks for legacy tokens, as fallback. Message is delivered (since my device is in the 'soccer' category)

  1. Similar, with with no criteria:
17:33:56,432 INFO  [org.jboss.aerogear.unifiedpush.message.sender.GCMPushNotificationSender] (Thread-46 (HornetQ-client-global-threads-1851833922)) Sent push notification to GCM topic: &#x2F;topics&#x2F;50fdef1f-e9f6-435a-911d-5cc111e71a5f
...
17:33:56,448 INFO  [org.jboss.aerogear.unifiedpush.message.sender.GCMPushNotificationSender] (Thread-37 (HornetQ-client-global-threads-1851833922)) Sent push notification to GCM Server for 1 registrationIDs

It first sends to the 'global; topic, but also looks for legacy tokens, as fallback. Message is delivered.

  1. Now, trying a category which my device is not in:
17:37:08,229 INFO  [org.jboss.aerogear.unifiedpush.message.sender.GCMPushNotificationSender] (Thread-25 (HornetQ-client-global-threads-1851833922)) Sent push notification to GCM topic: &#x2F;topics&#x2F;dasdsadsadsa
17:37:08,231 WARNING [org.jboss.aerogear.unifiedpush.message.TokenLoader] (Thread-58 (HornetQ-client-global-threads-1851833922)) Check your push query: Not a single token was loaded from the DB!

First sends to the given topic (or category), afterwards looks for the tokens - but there is no token, as no device is registered for this category. Ergo, no message is delivered

@secondsun
Copy link
Contributor

LGTM +1

@matzew
Copy link
Contributor Author

matzew commented May 3, 2016

feel free to merge!

On Tuesday, 3 May 2016, Hoyt Summers Pittman notifications@github.com
wrote:

LGTM +1


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#709 (comment)

Sent from Gmail Mobile

@matzew matzew merged commit 591b20d into aerogear:1.1.x-dev May 3, 2016
@matzew
Copy link
Contributor Author

matzew commented May 3, 2016

landed - will send different PR for master

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants