private MessageLogRecord ReadMessage(byte[] recordBuffer) { var record = new MessageLogRecord(); record.ReadFrom(recordBuffer); return(record); }
public void BatchStoreMessageAsync(IQueue queue, IEnumerable <Message> messages, Action <BatchMessageLogRecord, object> callback, object parameter, string producerAddress) { lock (_lockObj) { var recordList = new List <MessageLogRecord>(); foreach (var message in messages) { var record = new MessageLogRecord( queue.Topic, message.Code, message.Body, queue.QueueId, queue.NextOffset, message.CreatedTime, DateTime.Now, message.Tag, producerAddress ?? string.Empty, null, null); recordList.Add(record); queue.IncrementNextOffset(); } var batchRecord = new BatchMessageLogRecord(recordList, callback, parameter); _batchMessageBufferQueue.EnqueueMessage(batchRecord); } }
public MessageLogRecord StoreMessage(int queueId, long queueOffset, Message message) { var record = new MessageLogRecord( message.Topic, message.Code, message.Body, queueId, queueOffset, message.CreatedTime, DateTime.Now); _chunkWriter.Write(record); return(record); }
public void StoreMessageAsync(IQueue queue, Message message, Action <MessageLogRecord, object> callback, object parameter) { lock (_lockObj) { var record = new MessageLogRecord( message.Topic, message.Code, message.Body, queue.QueueId, queue.NextOffset, message.CreatedTime, DateTime.Now, message.Tag, callback, parameter); _bufferQueue.EnqueueMessage(record); queue.IncrementNextOffset(); } }
private void PersistMessages(MessageLogRecord record) { _chunkWriter.Write(record); record.OnPersisted(); }
private void PersistMessages(MessageLogRecord message) { _chunkWriter.Write(message); message.OnPersisted(); }