I have a Managed Discovery Service hosted with a known URI. I have a discoverable service that when it starts, it announces itself using an AnnouncementEndpoint added to the ServiceDiscoveryBehavior of the service.
The specific use case I would like to solve is the following:
How then does the discoverable service refresh itself (re-announce) to the Managed Discovery service?
I know the Managed Discovery service can persist endpoints and restore them upon start but I want everything to be dynamic and self repairing so that there's no chance of stale endpoint information.
An alternative use case would be:
How do we force or invoke the same Announcement service contract call to the new Managed Discovery service?
I hope this is enough information about what I want to accomplish.
I found the answer myself. In the scenario where you need to control announcements outside of the ServiceDiscoveryBehavior , you would use the AnnouncementClient class.
AnnouncementClient client = new AnnouncementClient(announcementEndpoint);
var endpointDiscoveryMetadata = EndpointDiscoveryMetadata.FromServiceEndpoint(netTcpEndpoint);
client.AnnounceOnline(endpointDiscoveryMetadata);