Reputation: 149
Pub/sub guarantes that messageId is always unique number. Therefore, i use this id as deviceId and i hold this value on bigquery table. Google documents say this value string. But, messageId return 15-digit number according to my experiments. Should I keep this value as number on bigquery? Does it cause any trouble?
Upvotes: 1
Views: 5230
Reputation: 149
Google Support Says : "MessageId consist of the maximum possible digits are 19. As long as an ID hasn't been used before (since they are unique), there can be up to 19 digits, but realistically that amount of digits may not be reached."
Upvotes: 1
Reputation: 2324
Pub/sub guarantes that messageId is always unique per topic - not that it is a number (ref)
The data type as stated in the docs is a String, so it can contain any unicode character.
So, as others have said, although it is a 15 digit number now, if at some point in the future, google generates a non-numeric string, or a number greater than what your low level code can store, then your app will fail.
Upvotes: 1
Reputation: 3642
The issue is the max length of an Integer (10) and not the fact it contains only numeric values. This is why you should keep the value as String and not as an Integer as defined in the documentation
Upvotes: 3