Releases: Azure/azure-notificationhubs-java-backend
Azure Notification Hubs Java SDK 1.0.5
This is the v1.0.5 release of the Azure Notification Hubs SDK for Java. This contains the following:
Changelist
- Fixes [BUG] Get a notification hub by the hub path not working (#169)
Azure Notification Hubs Java SDK 1.0.4
This is the v1.0.4 release of the Azure Notification Hubs SDK for Java. This contains the following:
Changelist
- Fixes 500 errors during Direct Batch Send (#150)
- Updates httpclient and httpcore to 5.2
Azure Notification Hubs Java SDK 1.0.3
This is the v1.0.3 release of the Azure Notification Hubs SDK for Java. This contains the following:
Bug Fixes
- Wrap the
inputFireUri
in theNotificationHubJob
in aCNAME
for URI escaping
Azure Notification Hubs SDK for Java v1.0.2
This is the v1.0.2 release of the Azure Notification Hubs SDK for Java. This contains the following:
Bug Fixes
Azure Notification Hubs SDK 1.0.0
This is the 1.0.0 release of the Azure Notification Hubs SDK for Java.
This release adds the following:
- Created per PNS notification classes instead of the Notification class itself:
AdmNotification
AppleNotification
BaiduNotification
FcmNotification
MpnsNotification
WindowsNotification
WindowsRawNotification
- Added method to save an installation through the
BaseInstallation
- Added installation classes per type:
AdmInstallation
AppleInstallation
BaiduInstallation
FcmInstallation
MpnsInstallation
WindowsInstallation
Misc stuff fixed:
- Added JavaDoc to all public members
- Rewrote
equals
andhashcode
implementations based upon IntelliJ recommendations - Migrated SAS token creation to a single
SasTokenProvider
Azure Notification Hubs SDK 0.4.1
This update is a minor update to create the sources.jar and javadoc.jar files for MavenCentral and SonaType.
Azure Notification Hubs SDK for Java release v0.4
Update junit to deal with CVE GHSA-269g-pwp5-87pp
Azure Notification Hubs SDK for Java version 0.3
This update includes a number of new features with the following:
- Push to User
- Throttling Support
- Note on FCM and GCM Support
Push to User
With the Installation API we now have a new feature that allows you to associate a user ID with an installation and then be able to target it with a send to all devices for that user. To set the user ID for the installation, set the UserId
property of the Installation
.
Installation installation = new Installation();
installation.setUserId("user1234");
hub.createOrUpdateInstallation(installation);
The user can then be targeted to send a notification with the tag format of $UserId:{USER_ID}
, for example like the following:
String jsonPayload = "{\"aps\":{\"alert\":\"Notification Hub test notification\"}}";
Set<String> tags = new HashSet<String>();
tags.add("$UserId:user1234");
Notification n = Notification.createAppleNotification(jsonPayload);
NotificationOutcome outcome = hub.sendNotification(n, tags);
Throttling and Retrying Operations
By default, the Azure Notification Hubs SDK for Java by default does not have any retry behavior. You can add this behavior to the SDK by introducing libraries such as Failsafe or reactive libraries such as RxJava or Reactor.
The SDK will throw a NotificationHubsException
if there is anything but a successful HTTP operation such as 200 (OK), 201 (Created) or 204 (No Content). The NotificationHubsException
class has two properties worth noting, isTransient
to determine whether the failure is transient, and retryAfter
which gives the value from the Retry-After
header which indicates after how many seconds to retry the operation.
The following HTTP status codes can be retried for the SDK:
- 403 (Quota Exceeded)
- 408 (RequestTimeout)
- 429 (Throttling)
- 500 (ServerError)
- 503 (ServiceUnavailable)
- 504 (Timeout)
The following HTTP status codes should not be retried: 400 (Bad Request), 401 (Unauthorized), 404 (Not Found), 405 (Method Not Allowed) , 409 (Conflict), 410 (Gone), 412 (Precondition Failed), 413 (Request Entity Too Large).
// Create an execution policy
RetryPolicy<Installation> retryPolicy = new RetryPolicy<>()
.handle(NotificationHubsException.class)
.handleIf(error -> {
NotificationHubsException ex = (NotificationHubsException)err;
return ex.isTransient();
})
.withDelay(Duration.ofSeconds(5))
.withMaxRetries(3);
// Initialize installation
Installation installation = new Installation("installation-id", NotificationPlatform.Adm, "adm-push-channel");
// Run the operation with a static delay
Installation createdInstallation =
Failsafe.with(retryPolicy)
.get(() -> hub.createOrUpdateInstallation(installation));
Note on FCM and GCM Support
The Azure Notification Hubs SDK has support for Firebase Cloud Messaging (FCM) via the Legacy HTTP API which is compatible with GCM. For registrations, use the FirebaseRegistration
to create registrations, as the GcmRegistration
class has been deprecated. For more information, read the Azure Notification Hubs and Google Firebase Cloud Messaging migration
For installations, use the NotificationPlatform.Gcm
for all FCM registrations which use the legacy HTTP API. Currently, we do not have full support for FCM and calling NotificationPlatform.Fcm
will result in an exception.
Installation i = new Installation();
// Uses the FCM Legacy API
i.setPlatform(NotificationPlatform.Gcm);
notification-hubs-android-sdk 0.2.0
This SDK release contains minor updates to the following dependencies:
- #66 Bump httpasyncclient from 4.0.2 to 4.1.4
- #70 Bump junit from 4.11 to 4.13
- #69 Bump commons-codec from 1.8 to 1.15
- #68 Bump commons-io from 2.4 to 2.8.0
- Bump maven-compiler-plugin from 3.0 to 3.8.1
- #74 Bump gson from 2.3.1 to 2.8.6
- #72 Bump jaxb-api from 2.3.0 to 2.3.1
- #71 Bump httpcore from 4.4.5 to 4.4.13
- #75 Update Bean Utils from 18.3. to 1.9.4
notification-hubs-android-sdk 0.1.0
- Added ability to configure timeouts for default HttpAsyncClient