Click or drag to resize

CommunicationOnErpCommunicationLost Field

Occurs after the connection with the ERP is lost.

Namespace:  Dynamicweb.Ecommerce.LiveIntegration.Notifications
Assembly:  Dynamicweb.Ecommerce.LiveIntegration (in Dynamicweb.Ecommerce.LiveIntegration.dll) Version: 3.0.1
Syntax
public const string OnErpCommunicationLost = "Dynamicweb.Ecommerce.LiveIntegration.Notifications.LiveIntegration.OnErpCommunicationLost"

Field Value

Type: String
Examples
C#
using Dynamicweb.Ecommerce.LiveIntegration.Notifications;
using Dynamicweb.Extensibility.Notifications;

namespace Dynamicweb.Ecommerce.LiveIntegration.Examples.Notifications
{
    /// <summary>
    /// Class CommunicationLostSubscriber.
    /// </summary>
    /// <seealso cref="NotificationSubscriber" />
    [Subscribe(Communication.OnErpCommunicationLost)]
    public class CommunicationLostSubscriber : NotificationSubscriber
    {
        /// <summary>
        /// Call to invoke observer.
        /// </summary>
        /// <param name="notification">The notification.</param>
        /// <param name="args">The args.</param>
        public override void OnNotify(string notification, NotificationArgs args)
        {
            var myArgs = (Communication.OnErpCommunicationLostArgs)args;

            if (myArgs?.Exception != null)
            {
                Logging.Logger.Instance.Log(Logging.ErrorLevel.DebugInfo, "Connection lost");
                Logging.Logger.Instance.Log(Logging.ErrorLevel.ResponseError, myArgs.Exception.Message);
            }
        }
    }
}
See Also