Exemple #1
0
        private static void OnReceiveComplete(IAsyncResult ar)
        {
            FeedAsyncResult  result  = ar as FeedAsyncResult;
            FeedInputChannel channel = result.Channel;

            Feed feed = channel.EndReceive(result);

            if (FeedEngine.FeedReceived != null)
            {
                FeedEngine.FeedReceived(feed);
            }

            if (receivers.Count > 0)
            {
                FeedReceiver receiver = receivers[channel.Destination] as FeedReceiver;
                if (receiver != null)
                {
                    receiver.Receive(feed);
                }
            }

            // Update the storage
            if (Storage != null)
            {
                Storage.Add(feed);
            }
        }
        private void OnReceiveComplete(IAsyncResult ar)
        {
            ReceiveAsyncResult result     = ar as ReceiveAsyncResult;
            FeedHttpConnection connection = result.Connection;

            Feed feed = null;

            feed = connection.EndReceive(ar);
            FeedInputChannel channel = (FeedInputChannel)base.InputChannels[connection.Destination.ToString()];

            if (channel == null)
            {
                throw new ApplicationException("Failed to get InputChannel");
            }
            channel.Enqueue(feed);

            FeedAsyncResult feedResult = new FeedAsyncResult(channel);

            this.ReceiveCompleteCallback(feedResult);
        }
 public FeedAsyncResult(FeedInputChannel channel)
 {
     this.channel = channel;
 }