FabricClient.ServiceManagementClient.ServiceNotificationFilterMatched Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Raised when a ServiceNotificationFilterDescription previously registered through RegisterServiceNotificationFilterAsync(ServiceNotificationFilterDescription) is matched by a service's endpoint changes in system.
public event EventHandler ServiceNotificationFilterMatched;
member this.ServiceNotificationFilterMatched : EventHandler
Public Event ServiceNotificationFilterMatched As EventHandler
Event Type
Examples
The following example shows how to register for and process service notifications:
namespace ServiceNotificationsExample
{
class Program
{
static void Main(string[] args)
{
var client = new FabricClient(new string[] { "[cluster_endpoint]:[client_port]" });
var filter = new ServiceNotificationFilterDescription()
{
Name = new Uri("fabric:/my_application"),
MatchNamePrefix = true,
};
client.ServiceManager.ServiceNotificationFilterMatched += (s, e) => OnNotification(e);
var filterId = client.ServiceManager.RegisterServiceNotificationFilterAsync(filter).Result;
Console.WriteLine(
"Registered filter: name={0} id={1}",
filter.Name,
filterId);
Console.ReadLine();
client.ServiceManager.UnregisterServiceNotificationFilterAsync(filterId).Wait();
Console.WriteLine(
"Unregistered filter: name={0} id={1}",
filter.Name,
filterId);
}
private static void OnNotification(EventArgs e)
{
var castedEventArgs = (FabricClient.ServiceManagementClient.ServiceNotificationEventArgs)e;
var notification = castedEventArgs.Notification;
Console.WriteLine(
"[{0}] received notification for service '{1}'",
DateTime.UtcNow,
notification.ServiceName);
}
}
}
Remarks
The event argument is of type FabricClient.ServiceManagementClient.ServiceNotificationEventArgs.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Azure SDK for .NET