Created
January 10, 2021 15:05
-
-
Save zleao/e8443efebb3841d774da822e73d844f9 to your computer and use it in GitHub Desktop.
Examples of Publish using zoft.NotificationService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OneWay Publish | |
// Publish an one-way message for default or specified context | |
NotificationService.PublishAsync(myMessage); | |
NotificationService.PublishAsync(myMessage, "myContext"); | |
// Adds a message to the pending notification queue | |
NotificationService.DelayedPublishAsync(myMessage); | |
// Adds a message to the pending notification queue for the specified context | |
NotificationService.DelayedPublishAsync(myMessage, "myContext"); | |
// Adds a message to the pending notification queue for the specified context (may try a 'normal' publish first) | |
NotificationService.DelayedPublishAsync(myMessage, "myContext", true); | |
// Publishes the pending notifications for default or specified context | |
NotificationService.PublishPendingNotificationsAsync(this); | |
NotificationService.PublishPendingNotificationsAsync(this, "myCOntext"); | |
/// Publishes an one-way information message. | |
Task PublishInfoNotificationAsync(string message, NotificationModeEnum mode = NotificationModeEnum.Default, string context = AsyncSubscription.DefaultContext); | |
// TwoWay Publish | |
// Publish a two-way message for default or specified context | |
var myResult = NotificationService.PublishAsync<MyResult>(MyMessage); | |
var myResult = NotificationService.PublishAsync<MyResult>(MyMessage, "myContext"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment