예제 #1
0
        public void StoreReceivedExceptionMessage(string name, string group, string content)
        {
            var collection = _database.GetCollection <ReceivedMessage>(_options.Value.ReceivedCollection);

            var store = new ReceivedMessage
            {
                Id         = SnowflakeId.Default().NextId(),
                Group      = group,
                Name       = name,
                Content    = content,
                Added      = DateTime.Now,
                ExpiresAt  = DateTime.Now.AddDays(15),
                Retries    = _capOptions.Value.FailedRetryCount,
                Version    = _capOptions.Value.Version,
                StatusName = nameof(StatusName.Failed)
            };

            collection.InsertOne(store);
        }
예제 #2
0
        public void StoreReceivedMessage(CapReceivedMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }
            var collection = _database.GetCollection <ReceivedMessage>(_options.ReceivedCollection);

            var store = new ReceivedMessage()
            {
                Id         = message.Id,
                Group      = message.Group,
                Name       = message.Name,
                Content    = message.Content,
                Added      = message.Added,
                StatusName = message.StatusName,
                ExpiresAt  = message.ExpiresAt,
                Retries    = message.Retries,
                Version    = _capOptions.Version
            };

            collection.InsertOne(store);
        }