Ejemplo n.º 1
0
        async Task SendEndpointStartupMessage(DateTime startupTime, CancellationToken cancellationToken)
        {
            try
            {
                var message = new RegisterEndpointStartup
                {
                    HostId          = hostInfo.HostId,
                    Host            = hostInfo.DisplayName,
                    Endpoint        = endpointName,
                    HostDisplayName = hostInfo.DisplayName,
                    HostProperties  = hostInfo.Properties,
                    StartedAt       = startupTime
                };
                await backend.Send(message, ttlTimeSpan, dispatcher).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                if (!resendRegistration)
                {
                    Logger.Warn("Unable to register endpoint startup with ServiceControl.", ex);
                    return;
                }

                resendRegistration = false;

                Logger.Warn($"Unable to register endpoint startup with ServiceControl. Going to reattempt registration after {registrationRetryInterval}.", ex);

                await Task.Delay(registrationRetryInterval, cancellationToken).ConfigureAwait(false);
                await SendEndpointStartupMessage(startupTime, cancellationToken).ConfigureAwait(false);
            }
        }
 public Task Send(RegisterEndpointStartup messageToSend, TimeSpan timeToBeReceived)
 {
     var body = Serialize(messageToSend);
     return Send(body, messageToSend.GetType().FullName, timeToBeReceived);
 }
 internal byte[] Serialize(RegisterEndpointStartup message)
 {
     return Serialize(message, startupSerializer);
 }