Skip to content

Instantly share code, notes, and snippets.

@zleao
Created January 10, 2021 15:05
Show Gist options
  • Save zleao/e8443efebb3841d774da822e73d844f9 to your computer and use it in GitHub Desktop.
Save zleao/e8443efebb3841d774da822e73d844f9 to your computer and use it in GitHub Desktop.
Examples of Publish using zoft.NotificationService
// 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