How to get Event Server hostname in MFA system for all EventServer

Hi,

We are developing a Server Side Plug-In in a MFA environment.

Starting froma master site we need to get the hostname of all EventServers belonging to all child site.

We are trying to use a code like this:

List items = Configuration.Instance.GetItems();

               foreach (Item masterLevelSite in items)

               {

                   try

                   {

                       if (masterLevelSite.FQID.Kind == Kind.Server && masterLevelSite.FQID.ServerId.ServerType == ServerId.DefaultServerType)

                       {

                           // trovato server di tipo XP cioè il recording server, invio rest

                           MessageCommunicationManager.Start(masterLevelSite.FQID.ServerId);

                           MessageCommunication \_messageCommunication = MessageCommunicationManager.Get(masterLevelSite.FQID.ServerId);

                           EnvironmentManager.Instance.Log(false, "RestService", "RMTServerEndPointFQID: " + \_messageCommunication.ServerEndPointFQID.ToString());

                           String EventServerAddress = \_messageCommunication.ServerEndPointFQID.ServerId.ServerHostname;

                           EnvironmentManager.Instance.Log(false, "RestService", "RMTEventServerAddress: " + EventServerAddress );

                           \_messageCommunication.Dispose();

                           MessageCommunicationManager.Stop(masterLevelSite.FQID.ServerId);

                       }

                   }

                   catch (Exception ex)

                   {

                       EnvironmentManager.Instance.Log(false, "RestService", "Error getting confguration from servere " + [masterLevelSite.Name](https://masterLevelSite.Name) + ": " + ex.ToString());

                       result += "{error: " + ex.ToString() + "},";

                   }

               }

But the

ServerEndPointFQID.ServerId.ServerHostname seems null and also ServerEndPointFQID semmes don’t has valid values.

Can you help us to understand ?

Many Thanks

The recommended way to find the event server is to use Registered Services. Please see the Service Test sample. - https://doc.developer.milestonesys.com/html/index.html?base=samples/pluginsamples/servicetest/readme.html&tree=tree_1.html

Please note that for each site you will have to do what the sample does to ask for the Event Server.

Many Thanks Rie,

I will test the solution and write back here the result.

Regards