コード例 #1
0
        // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
        private void VerifyCount(long messageCount, string route)
        {
            var db      = _connection.Connection.GetDatabase();
            var records = !string.IsNullOrEmpty(route) ? db.ListLength(_redisNames.PendingRoute(route)) : db.HashLength(_redisNames.Status);

            Assert.Equal(messageCount, records);
        }
コード例 #2
0
        /// <summary>
        /// Gets the parameters.
        /// </summary>
        /// <param name="messages">The messages.</param>
        /// <param name="route">The route.</param>
        /// <returns></returns>
        private object GetParameters(List <MessageToSend> messages, string route)
        {
            var pendingKey = !string.IsNullOrEmpty(route) ? RedisNames.PendingRoute(route) : RedisNames.Pending;
            // Creates serializer.
            var serializer = SerializationContext.Default.GetSerializer <List <MessageToSend> >();

            using (var output = new MemoryStream())
            {
                serializer.Pack(output, messages, PackerCompatibilityOptions.Classic);
                object rc = new
                {
                    messages   = (RedisValue)output.ToArray(),
                    key        = (RedisKey)RedisNames.Values,
                    pendingkey = (RedisKey)pendingKey,
                    headerskey = (RedisKey)RedisNames.Headers,
                    channel    = RedisNames.Notification,
                    metakey    = (RedisKey)RedisNames.MetaData,
                    IDKey      = (RedisKey)RedisNames.Id,
                    delaykey   = (RedisKey)RedisNames.Delayed,
                    expirekey  = (RedisKey)RedisNames.Expiration,
                    StatusKey  = (RedisKey)RedisNames.Status,
                    RouteIDKey = (RedisKey)RedisNames.Route
                };
                return(rc);
            }
        }
コード例 #3
0
        /// <summary>
        /// Gets the parameters.
        /// </summary>
        /// <param name="messageId">The message identifier.</param>
        /// <param name="message">The message.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="metaData">The meta data.</param>
        /// <param name="expireTime">The expire time.</param>
        /// <param name="route">The route.</param>
        /// <returns></returns>
        private object GetParameters(string messageId, byte[] message, byte[] headers, byte[] metaData,
                                     long expireTime, string route)
        {
            var pendingKey = !string.IsNullOrEmpty(route) ? RedisNames.PendingRoute(route) : RedisNames.Pending;
            var realRoute  = string.IsNullOrEmpty(route) ? string.Empty : route;

            return
                (new
            {
                key = (RedisKey)RedisNames.Values,
                field = messageId,
                value = message,
                pendingkey = (RedisKey)pendingKey,
                channel = RedisNames.Notification,
                headers,
                Route = realRoute,
                headerskey = (RedisKey)RedisNames.Headers,
                metakey = (RedisKey)RedisNames.MetaData,
                metavalue = metaData,
                expirekey = (RedisKey)RedisNames.Expiration,
                timestampexpire = expireTime,
                IDKey = (RedisKey)RedisNames.Id,
                StatusKey = (RedisKey)RedisNames.Status,
                RouteIDKey = (RedisKey)RedisNames.Route
            });
        }
コード例 #4
0
        /// <summary>
        /// Gets the parameters.
        /// </summary>
        /// <param name="messageId">The message identifier.</param>
        /// <param name="message">The message.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="metaData">The meta data.</param>
        /// <param name="jobName">Name of the job.</param>
        /// <param name="scheduledTime">The scheduled time.</param>
        /// <param name="eventTime">The event time.</param>
        /// <param name="route">The route.</param>
        /// <returns></returns>
        private object GetParameters(string messageId, byte[] message, byte[] headers, byte[] metaData, string jobName,
                                     DateTimeOffset scheduledTime, DateTimeOffset eventTime, string route)
        {
            var pendingKey = !string.IsNullOrEmpty(route) ? RedisNames.PendingRoute(route) : RedisNames.Pending;
            var realRoute  = string.IsNullOrEmpty(route) ? string.Empty : route;

            return(new
            {
                key = (RedisKey)RedisNames.Values,
                field = messageId,
                value = (RedisValue)message,
                headers,
                headerskey = (RedisKey)RedisNames.Headers,
                pendingkey = (RedisKey)pendingKey,
                channel = RedisNames.Notification,
                metakey = (RedisKey)RedisNames.MetaData,
                metavalue = (RedisValue)metaData,
                Route = realRoute,
                IDKey = (RedisKey)RedisNames.Id,
                JobKey = (RedisKey)RedisNames.JobNames,
                JobIDKey = (RedisKey)RedisNames.JobIdNames,
                JobName = jobName,
                StatusKey = (RedisKey)RedisNames.Status,
                JobEventKey = (RedisKey)RedisNames.JobEvent,
                RouteIDKey = (RedisKey)RedisNames.Route,
                JobNameScheduled = string.Concat(jobName, "|scheduled"),
                ScheduledTime = scheduledTime.ToString(DateTimeScheduler, CultureInfo.InvariantCulture),
                EventTime = eventTime.ToString(DateTimeFormat, CultureInfo.InvariantCulture)
            });
        }
コード例 #5
0
        /// <summary>
        /// Gets the parameters.
        /// </summary>
        /// <param name="unixTime">The current unix time.</param>
        /// <param name="route">The route.</param>
        /// <returns></returns>
        private object GetParameters(long unixTime, string route)
        {
            var pendingKey = !string.IsNullOrEmpty(route) ? RedisNames.PendingRoute(route) : RedisNames.Pending;

            return(new
            {
                pendingkey = (RedisKey)pendingKey,
                workingkey = (RedisKey)RedisNames.Working,
                timestamp = unixTime,
                valueskey = (RedisKey)RedisNames.Values,
                headerskey = (RedisKey)RedisNames.Headers,
                expirekey = (RedisKey)RedisNames.Expiration,
                StatusKey = (RedisKey)RedisNames.Status
            });
        }