Esempio n. 1
0
        /// <summary>
        ///     Creates new snapshot subscription for a single event type that is attached to this feed.
        ///     This method creates new <see cref="IDXFeedSubscription{E}"/>.
        /// </summary>
        /// <typeparam name="E">The type of events.</typeparam>
        /// <param name="time">Unix time in the past - number of milliseconds from 1.1.1970.</param>
        /// <param name="source">The source of the event.</param>
        /// <returns>New DXFeedSubscription for a single event type.</returns>
        internal IDXFeedSubscription <E> CreateSnapshotSubscription <E>(long time, IndexedEventSource source)
            where E : IDxIndexedEvent
        {
            IDXFeedSubscription <E> subscription = new DXFeedSubscription <E>(endpoint, time, source) as IDXFeedSubscription <E>;

            subscription.Attach(this);
            return(subscription);
        }
Esempio n. 2
0
        /// <summary>
        ///     Creates new subscription for multiple event types that is attached to this feed.
        ///     For a single event type use <see cref="CreateSubscription{E}"/>.
        ///     This method creates new <see cref="IDXFeedSubscription{E}"/> and invokes
        ///     <see cref="AttachSubscription{E}(IDXFeedSubscription{E})"/>.
        /// </summary>
        /// <typeparam name="E">The type of events.</typeparam>
        /// <param name="eventTypes">The classes of event types.</param>
        /// <returns>The new <see cref="IDXFeedSubscription{E}"/>.</returns>
        /// <exception cref="InvalidOperationException">Endpoint was been closed.</exception>
        public IDXFeedSubscription <E> CreateSubscription <E>(params Type[] eventTypes)
            where E : IDxEventType
        {
            if (endpoint.State == DXEndpointState.Closed)
            {
                throw new InvalidOperationException("Endpoint was been closed.");
            }
            IDXFeedSubscription <E> subscription = new DXFeedSubscription <E>(endpoint, eventTypes) as IDXFeedSubscription <E>;

            subscription.Attach(this);
            return(subscription);
        }