public void PublishSmtpUpdated(SettingsUpdatedEvent @event) { if (!IsBackendServiceOnline) { return; } // check if the setting changed if (@event.PreviousSettings.IP == @event.NewSettings.IP && @event.PreviousSettings.Port == @event.NewSettings.Port) { return; } try { using (var messenger = GetClient()) { // update the backend service with the new ip/port settings... var smtpServerBindEvent = new SmtpServerBindEvent( Settings.Default.IP, Settings.Default.Port); bool successfulPublish = messenger.PublishEventServer(smtpServerBindEvent); _logger.Information( successfulPublish ? "Successfully pushed new Smtp Server Binding to Backend Service" : "Papercut Backend Service Failed to Update. Could be offline."); } } catch (Exception ex) { _logger.Warning(ex, BackendServiceFailureMessage); } }
public void Handle(SettingsUpdatedEvent @event) { if (!IsBackendServiceOnline) { return; } try { using (PapercutClient client = GetClient()) { // update the backend service with the new ip/port settings... var smtpServerBindEvent = new SmtpServerBindEvent( Settings.Default.IP, Settings.Default.Port); bool successfulPublish = client.PublishEventServer(smtpServerBindEvent); _logger.Information( successfulPublish ? "Successfully pushed new Smtp Server Binding to Backend Service" : "Papercut Backend Service Failed to Update. Could be offline."); } } catch (Exception ex) { _logger.Warning(ex, BackendServiceFailureMessage); } }