Beispiel #1
0
        public ZMsg HandleRequest(ZMsg request)
        {
            ZMsg reply = new ZMsg();

            reply.PushBack("200");
            try
            {
                IEnumerator <byte[]> fe = request.GetEnumerator();
                while (fe.MoveNext())
                {
                    string res = this.HandleJsonRequest(encoding.GetString(fe.Current));
                    reply.PushBack(encoding.GetBytes(res));
                }
            }
            catch (System.Exception ex)
            {
                reply.Clear();
                reply.PushBack("500");
                string error = string.Format("Internal Error: {0}", ex.Message);
                reply.PushBack(encoding.GetBytes(error));
            }

            return(reply);
        }