예제 #1
0
        public static IMessageId FromByteArrayWithTopic(byte[] data, TopicName topicName)
        {
            if (data == null)
            {
                throw new ArgumentException();
            }
            var builder = new MessageIdData();

            MessageIdData idData = builder;

            IMessageId messageId;

            if (idData.BatchIndex >= 0)
            {
                messageId = new BatchMessageId((long)idData.ledgerId, (long)idData.entryId, idData.Partition, idData.BatchIndex, idData.BatchSize, BatchMessageAcker.NewAcker(idData.BatchSize));
            }
            else
            {
                messageId = new MessageId((long)idData.ledgerId, (long)idData.entryId, idData.Partition);
            }
            if (idData.Partition > -1 && topicName != null)
            {
                var t = new TopicName();
                messageId = new TopicMessageId(t.GetPartition(idData.Partition).ToString(), topicName.ToString(), messageId);
            }

            return(messageId);
        }
예제 #2
0
        public TopicMessage(string topicPartitionName, string topicName, IMessage <T> msg)
        {
            _topicPartitionName = topicPartitionName;

            _msg       = msg;
            _messageId = new TopicMessageId(topicPartitionName, topicName, msg.MessageId);
        }