private void RPush(PushAction action) { if (action.queueHandler == null) { action.result = "queue not exists."; action.channel.Send(action); } else { action.item.messageId = ++action.queueHandler.messageId; this.DO_RPush(action); } }
private void DO_LPush(PushAction action) { action.result = Action.RESULT_OK; //join data action.queueHandler.itemQueue.LPush(action.item); // action.channel.Send(action); //trigger deliver if ((action.queueHandler.deliverQueue.count == 0) == false) { this.PushDeliver(action.queue); } }
private void LPush(HttpServerWebSocketContext context, string queue, string id, byte[] body) { var action = new PushAction(); action.actionType = Action.LPUSH; action.channel = (IChannel)context.UserState; action.queue = queue; action.id = id; action.item = new DataItem() { body = body //,messageId = "" , from action processor }; // Program.ActionProcessor.Push(action); }
private HttpStatusCode Push(byte actionType, HttpServerContext httpContext, bool bin) { var body = httpContext.PostData; if (body == null || body.Length == 0) { httpContext.ResponseHeader["Content-Type"] = "text/html"; httpContext.Content = "No body"; return(HttpStatusCode.BadRequest); } else if (httpContext.RequestHeader["Content-Type"] != "application/octet-stream") { httpContext.ResponseHeader["Content-Type"] = "text/html"; httpContext.Content = "Please set content-type to application/octet-stream"; return(HttpStatusCode.BadRequest); } // if (bin) { httpContext.ResponseHeader["Content-Type"] = "application/octet-stream"; } else { httpContext.ResponseHeader["Content-Type"] = "application/json"; } httpContext.BeginWrite(); // var queue = httpContext.QueryString["queue"] ?? ""; var id = httpContext.QueryString["requestid"] ?? ""; // var action = new PushAction(); action.actionType = actionType; action.channel = new HttpState(httpContext, bin); action.queue = queue; action.id = id; action.item = new DataItem() { body = body }; // Program.ActionProcessor.Push(action); // return(HttpStatusCode.OK); }
private void LPush(HttpServerWebSocketContext context, string queue, string id, string body) { if (body == null) { Program.LogManager.Warning.WriteTimeLine("receive a invalid packet, body empty from " + context.GetRemoteNode()); return; } // var action = new PushAction(); action.actionType = Action.LPUSH; action.channel = (IChannel)context.UserState; action.queue = queue; action.id = id; action.item = new DataItem() { body = System.Text.Encoding.UTF8.GetBytes(body) // , messageId = "" form action processor }; // Program.ActionProcessor.Push(action); }