StreamLink.NET
IContainerSubscriptionListener Interface
StreamLink.NETCaplin.StreamLink.Subscription.ContainerIContainerSubscriptionListener
Interface to be implemented by any object wishing to subscribe for container events.
Declaration Syntax
C#Visual BasicVisual C++
public interface IContainerSubscriptionListener : ISubscriptionListener
Public Interface IContainerSubscriptionListener _
	Implements ISubscriptionListener
public interface class IContainerSubscriptionListener : ISubscriptionListener
Members
All MembersMethods



IconMemberDescription
ContainerUpdated(ISubscription, IContainerEvent)
This callback will be called when the container structure changes.

SubscriptionErrorReceived(ISubscription, ISubscriptionErrorEvent)
Handles an event raised when there is an error in a subscription.
(Inherited from ISubscriptionListener.)
SubscriptionStatusUpdated(ISubscription, ISubscriptionStatusEvent)
Handles an event raised when there is a change in the status of a subscription.
(Inherited from ISubscriptionListener.)
Thread Safety
The IContainerSubscriptionListener methods are not called on a dedicated worker thread. It is called directly from a thread running within the StreamLink.NET library. Therefore if the API user code is likely to perform any sort of intense execution it is recommended that the API user executes this in a separate thread.
Examples
CopyC#
using System;
using System.Collections.Generic;
using System.Text;
using Caplin.StreamLink.Subscription.Container;
using Caplin.StreamLink.Subscription;

namespace StreamLinkExamples.Container
{
    /// <summary>
    /// Basic example of an object implementing the IContainerSubscriptionListener
    /// interfance and querying the update objects for information.
    /// </summary>
    public class ExampleContainerSubscriptionListener: IContainerSubscriptionListener
    {
        #region IContainerSubscriptionListener Members

        /// <summary>
        /// Process the container change event.
        /// </summary>
        public void ContainerUpdated(ISubscription subscription, IContainerEvent ev)
        {
            // Process update
            string msg = "Received container structure change event for " +
                         ev.Subject + Environment.NewLine;

            msg += "Size:" + ev.Size + Environment.NewLine;
            msg += "Added constituents:" + Environment.NewLine;

            foreach (IContainerElement elem in ev.AddedElements)
            {
                msg += elem.Subject + " Type: " + elem.SubjectType +
                    Environment.NewLine;
            }
            msg += "Removed consitutents: " + Environment.NewLine;
            foreach (IContainerElement elem in ev.RemovedElements)
            {
                msg += elem.Subject + " Type: " + elem.SubjectType +
                    Environment.NewLine;
            }
            Console.WriteLine(msg);
        }

        #endregion

        #region ISubscriptionListener Members

        /// <summary>
        /// Subscription Ended Callback. For 'not found', 'read denied' etc.
        /// </summary>
        public void SubscriptionErrorReceived(ISubscription subscription,
                                              ISubscriptionErrorEvent ev)
        {
            Console.WriteLine("Subscription Status Update " + ev.Subject +
                               " Error: " + ev.Error.ToString());
        }

        /// <summary>
        /// Status Callback
        /// </summary>
        public void SubscriptionStatusUpdated(ISubscription subscription,
                                              ISubscriptionStatusEvent ev)
        {
            Console.WriteLine("Subscription Status Update " + ev.Subject +
                              " Status: " + ev.Status.ToString() +
                              " " + ev.Message);
        }

        #endregion
    }
}

Assembly: Caplin.StreamLink (Module: Caplin.StreamLink) Version: 5.0.5.0 (5.0.5.0)