示例#1
0
        /// <summary>
        /// Poll in a controlled manner the <seealso cref="Image"/>s under the subscription for available message fragments.
        /// Control is applied to fragments in the stream. If more fragments can be read on another stream
        /// they will even if BREAK or ABORT is returned from the fragment handler.
        /// <para>
        /// Each fragment read will be a whole message if it is under MTU length. If larger than MTU then it will come
        /// as a series of fragments ordered within a session.
        /// </para>
        /// <para>
        /// To assemble messages that span multiple fragments then use <seealso cref="ControlledFragmentAssembler"/>.
        ///
        /// </para>
        /// </summary>
        /// <param name="fragmentHandler"> callback for handling each message fragment as it is read. </param>
        /// <param name="fragmentLimit">   number of message fragments to limit for the poll operation across multiple <seealso cref="Image"/>s. </param>
        /// <returns> the number of fragments received </returns>
        /// <seealso cref="ControlledFragmentHandler" />
        public int ControlledPoll(ControlledFragmentHandler fragmentHandler, int fragmentLimit)
        {
            var handler = HandlerHelper.ToControlledFragmentHandler(fragmentHandler);

            return(ControlledPoll(handler, fragmentLimit));
        }
示例#2
0
        public virtual long ControlledPeek(long initialPosition, ControlledFragmentHandler handler, long limitPosition)
        {
            var fragmentHandler = HandlerHelper.ToControlledFragmentHandler(handler);

            return(ControlledPeek(initialPosition, fragmentHandler, limitPosition));
        }