Exemplo n.º 1
0
        void task_MessageStoringCompleted(object sender, TcpMessageCompletedEventArgs e)
        {
            try
            {
                e.Stream.Position = 0;
                //ProcessAndStoreMessage(e.Session.From.ENVID, e.Session.From.Mailbox, e.Session.From.RET, e.Session.To, e.Stream, e);

                QueueItemStream item   = QueueItemStream.Create(e.Stream);
                var             stream = AgentManager.Queue.ExecRequset(item);

                //Message message = Message.Create(e.Stream);
                //var stream = AgentManager.Queue.ExecRequset(message);


                e.Reply = new TcpReplyStream(200, stream);


                //OnMessageCompleted(new GenericEventArgs<Message>(msg));
            }
            catch (Exception x)
            {
                OnError(x);

                e.Reply = new TcpReplyStream(552, "Requested action aborted: Internal server error.");
            }
            finally
            {
                // Close file. .NET will delete that file we use FileOptions.DeleteOnClose.
                if (e.Stream != null)
                {
                    ((FileStream)e.Stream).Dispose();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Exec Requset
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        protected virtual void Execute(NamedPipeServerStream stream)
        {
            //Message message = new Message();
            //using (var copy = NetStream.CopyStream(stream))
            //{
            //    Netlog.DebugFormat("Server Read Request length:{0}", copy.Length);
            //    message.EntityRead(copy, null);
            //}
            //Netlog.DebugFormat("Server Print Request :{0}", message.Print());

            QueueItemStream item = QueueItemStream.Create(NetStream.CopyStream(stream));

            //stream.Position = 0;
            AgentManager.Queue.Execute(item, stream);
        }