FabricClient.ServiceManagementClient.ServiceNotificationFilterMatched Événement
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Déclenché lorsqu’un ServiceNotificationFilterDescription précédemment inscrit via RegisterServiceNotificationFilterAsync(ServiceNotificationFilterDescription) est mis en correspondance par les modifications du point de terminaison d’un service dans le système.
public event EventHandler ServiceNotificationFilterMatched;
member this.ServiceNotificationFilterMatched : EventHandler
Public Event ServiceNotificationFilterMatched As EventHandler
Type d'événement
Exemples
L’exemple suivant montre comment s’inscrire et traiter les notifications de service :
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);
}
}
}
Remarques
L’argument d’événement est de type FabricClient.ServiceManagementClient.ServiceNotificationEventArgs.
S’applique à
Azure SDK for .NET
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour