protected Config.QueueReader getReaderConfig(ref OperationParameter.NodeParser parser) { if (parser.OnReturn != null) { if (parser.ValueData.Type == ValueData.DataType.Json) { Config.QueueReader config = null; if (parser.ValueData.GetJson(ref config) && config != null) { if (Writer != null) { if (!Writer.IsDisposed) { return(config); } else { parser.ReturnParameter.Type = ReturnType.MessageQueueDisposed; } } else { parser.ReturnParameter.Type = ReturnType.MessageQueueNotFoundWriter; } return(null); } } parser.ReturnParameter.Type = ReturnType.ValueDataLoadError; } return(null); }
/// <summary> /// 查询数据 /// </summary> /// <param name="parser">参数解析</param> internal override void QueryEnd(ref OperationParameter.NodeParser parser) { switch (parser.OperationType) { case OperationParameter.OperationType.MessageQueueEnqueue: enqueue(ref parser, ValueData.Data <valueType> .DataType); return; case OperationParameter.OperationType.MessageQueueGetDequeueIdentity: Config.QueueReader config = getReaderConfig(ref parser); if (config != null) { if (reader == null || reader.IsDisposed) { QueueTaskThread.Thread.Default.Add(new QueueTaskThread.GetIdentity(this, config, ref parser)); return; } else { parser.ReturnParameter.Set(reader.Identity); } } return; case OperationParameter.OperationType.MessageQueueDequeue: if (parser.ValueData.Type == ValueData.DataType.ULong) { File.QueueReader reader = this.reader; if (reader != null && !reader.IsDisposed) { if (parser.OnReturn != null) { QueueTaskThread.Thread.Default.Add(new QueueTaskThread.GetMessage(reader, ref parser)); } } else { parser.ReturnParameter.Type = ReturnType.MessageQueueNotFoundReader; } } else { parser.ReturnParameter.Type = ReturnType.ValueDataLoadError; } return; case OperationParameter.OperationType.MessageQueueSetDequeueIdentity: setDequeueIdentity(ref parser, this.reader); return; } parser.ReturnParameter.Type = ReturnType.OperationTypeError; }
/// <summary> /// 获取下一个节点 /// </summary> /// <param name="parser"></param> /// <returns></returns> internal override Cache.Node GetQueryNext(ref OperationParameter.NodeParser parser) { int readerIndex; switch (parser.OperationType) { case OperationParameter.OperationType.MessageQueueGetDequeueIdentity: if ((readerIndex = getReaderIndex(ref parser)) >= 0) { Config.QueueReader config = getReaderConfig(ref parser); if (config != null) { if (readerIndex < readers.Length) { File.QueueReader reader = readers[readerIndex]; if (reader != null && !reader.IsDisposed) { parser.ReturnParameter.Set(reader.Identity); return(null); } } QueueTaskThread.Thread.Default.Add(new QueueTaskThread.GetIdentity(this, config, ref parser, readerIndex)); } } return(null); case OperationParameter.OperationType.MessageQueueDequeue: if ((readerIndex = getReaderIndex(ref parser)) >= 0) { if (parser.ValueData.Type == ValueData.DataType.ULong) { if (readerIndex < readers.Length) { File.QueueReader reader = readers[readerIndex]; if (reader != null && !reader.IsDisposed) { if (parser.OnReturn != null) { QueueTaskThread.Thread.Default.Add(new QueueTaskThread.GetMessage(reader, ref parser)); } return(null); } } parser.ReturnParameter.Type = ReturnType.MessageQueueNotFoundReader; } else { parser.ReturnParameter.Type = ReturnType.ValueDataLoadError; } } return(null); case OperationParameter.OperationType.MessageQueueSetDequeueIdentity: if ((uint)(readerIndex = getReaderIndex(ref parser)) < readers.Length) { setDequeueIdentity(ref parser, readers[readerIndex]); } return(null); } parser.ReturnParameter.Type = ReturnType.OperationTypeError; return(null); }