/// <summary> /// Initializes a new instance of the <see cref="ProducerQueueRpc{T}" /> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="sendMessages">The send messages.</param> /// <param name="responseIdFactory">The response identifier factory.</param> /// <param name="messageFactory">The message factory.</param> /// <param name="rpcTimeoutFactory">The RPC timeout factory.</param> /// <param name="generateMessageHeaders">The generate message headers.</param> /// <param name="addStandardMessageHeaders">The add standard message headers.</param> public ProducerQueueRpc( QueueProducerConfiguration configuration, ISendMessages sendMessages, IResponseIdFactory responseIdFactory, IMessageFactory messageFactory, IRpcTimeoutFactory rpcTimeoutFactory, GenerateMessageHeaders generateMessageHeaders, AddStandardMessageHeaders addStandardMessageHeaders) { Guard.NotNull(() => configuration, configuration); Guard.NotNull(() => sendMessages, sendMessages); Guard.NotNull(() => responseIdFactory, responseIdFactory); Guard.NotNull(() => messageFactory, messageFactory); Guard.NotNull(() => rpcTimeoutFactory, rpcTimeoutFactory); Guard.NotNull(() => generateMessageHeaders, generateMessageHeaders); Guard.NotNull(() => addStandardMessageHeaders, addStandardMessageHeaders); _configuration = configuration; _sendMessages = sendMessages; _responseIdFactory = responseIdFactory; _messageFactory = messageFactory; _rpcTimeoutFactory = rpcTimeoutFactory; _generateMessageHeaders = generateMessageHeaders; _addStandardMessageHeaders = addStandardMessageHeaders; }
public static AdditionalMessageData GenerateDataWithColumnValue(QueueProducerConfiguration configuration, int columnValue) { var data = new AdditionalMessageData(); if (configuration.Options().EnableMessageExpiration) { data.SetExpiration(TimeSpan.FromSeconds(1)); } if (configuration.Options().EnableDelayedProcessing) { data.SetDelay(TimeSpan.FromSeconds(5)); } if (configuration.Options().EnablePriority) { data.SetPriority(5); } data.AdditionalMetaData.Add(new AdditionalMetaData <int>("OrderID", columnValue)); return(data); }
public static AdditionalMessageData GenerateData(QueueProducerConfiguration configuration) { if (configuration.Options().EnableMessageExpiration || configuration.Options().EnableDelayedProcessing || configuration.Options().EnablePriority || configuration.Options().AdditionalColumns.Count > 0) { var data = new AdditionalMessageData(); if (configuration.Options().EnableMessageExpiration) data.SetExpiration(TimeSpan.FromSeconds(1)); if (configuration.Options().EnableDelayedProcessing) data.SetDelay(TimeSpan.FromSeconds(5)); if (configuration.Options().EnablePriority) data.SetPriority(5); if (configuration.Options().AdditionalColumns.Count > 0) { data.AdditionalMetaData.Add(new AdditionalMetaData<int>("OrderID", 123)); } return data; } return new AdditionalMessageData(); }
public static void Verify(QueueConnection queueConnection, QueueProducerConfiguration queueProducerConfiguration, long messageCount, ICreationScope scope) { using (var verify = new VerifyQueueData(queueConnection, queueProducerConfiguration)) { verify.Verify(messageCount, 0, null); } }
public static AdditionalMessageData GenerateData(QueueProducerConfiguration configuration) { if (configuration.GetMessageExpiration().HasValue || configuration.GetMessageDelay().HasValue || configuration.GetMessageRoute().HasValue) { var data = new AdditionalMessageData(); // ReSharper disable once PossibleInvalidOperationException if (configuration.GetMessageExpiration().HasValue&& configuration.GetMessageExpiration().Value) { data.SetExpiration(TimeSpan.FromSeconds(1)); } // ReSharper disable once PossibleInvalidOperationException if (configuration.GetMessageDelay().HasValue&& configuration.GetMessageDelay().Value) { data.SetDelay(TimeSpan.FromSeconds(5)); } // ReSharper disable once PossibleInvalidOperationException if (configuration.GetMessageRoute().HasValue&& configuration.GetMessageRoute().Value) { data.Route = DefaultRoute; } return(data); } return(new AdditionalMessageData()); }
public static void Verify(string queueName, string connectionString, QueueProducerConfiguration queueProducerConfiguration, long messageCount, string route, ICreationScope scope) { using (var verify = new VerifyQueueData(queueName, queueProducerConfiguration, connectionString)) { verify.Verify(messageCount, 0, route); } }
public VerifyQueueData(string queueName, QueueProducerConfiguration configuration, string connectionString) { _configuration = configuration; var connection = new BaseConnectionInformation(queueName, connectionString); _redisNames = new RedisNames(connection); _connection = new RedisConnection(connection); }
public VerifyQueueData(QueueConnection queueConnection, QueueProducerConfiguration configuration) { _configuration = configuration; var connection = new BaseConnectionInformation(queueConnection); _redisNames = new RedisNames(connection); _connection = new RedisConnection(connection); }
public static void Verify(string notused1, string notused2, QueueProducerConfiguration config, long recordCount, ICreationScope scope) { var realScope = (CreationScope)scope; if (realScope.ContainedClears.TryPeek(out var dataStorage)) { var data = (IDataStorage)dataStorage; var messageCount = data.RecordCount; Assert.Equal(recordCount, messageCount); } else { throw new InvalidOperationException(); } }
public static AdditionalMessageData GenerateData(QueueProducerConfiguration configuration) { if (configuration.Options().EnableMessageExpiration || configuration.Options().EnableDelayedProcessing) { var data = new AdditionalMessageData(); if (configuration.Options().EnableMessageExpiration) { data.SetExpiration(TimeSpan.FromSeconds(1)); } if (configuration.Options().EnableDelayedProcessing) { data.SetDelay(TimeSpan.FromSeconds(5)); } return(data); } return(new AdditionalMessageData()); }
/// <summary> /// Initializes a new instance of the <see cref="ProducerQueue{T}" /> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="sendMessages">The send messages.</param> /// <param name="messageFactory">The message factory.</param> /// <param name="log">The log.</param> /// <param name="generateMessageHeaders">The generate message headers.</param> /// <param name="addStandardMessageHeaders">The add standard message headers.</param> public ProducerQueue( QueueProducerConfiguration configuration, ISendMessages sendMessages, IMessageFactory messageFactory, ILogFactory log, GenerateMessageHeaders generateMessageHeaders, AddStandardMessageHeaders addStandardMessageHeaders) { Guard.NotNull(() => configuration, configuration); Guard.NotNull(() => sendMessages, sendMessages); Guard.NotNull(() => messageFactory, messageFactory); Guard.NotNull(() => log, log); Guard.NotNull(() => generateMessageHeaders, generateMessageHeaders); Guard.NotNull(() => addStandardMessageHeaders, addStandardMessageHeaders); _configuration = configuration; _sendMessages = sendMessages; _addStandardMessageHeaders = addStandardMessageHeaders; _messageFactory = messageFactory; _log = log.Create(); _generateMessageHeaders = generateMessageHeaders; }
private void Verify(QueueConnection arg1, QueueProducerConfiguration arg2, long arg3, ICreationScope arg4) { //no-op at single producer level }
public static AdditionalMessageData GenerateData(QueueProducerConfiguration configuration) { return(null); }
public static void NoVerification(string queueName, QueueProducerConfiguration queueProducerConfiguration, long messageCount) { }
public static void NoVerification(QueueConnection queueConnection, QueueProducerConfiguration queueProducerConfiguration, long messageCount, ICreationScope scope) { }
public static void Verify(QueueConnection queueConnection, QueueProducerConfiguration queueProducerConfiguration, long messageCount, ICreationScope scope) { new VerifyQueueData(queueConnection, queueProducerConfiguration.Options()).Verify(messageCount, null); }
private void Verify(QueueConnection arg1, QueueProducerConfiguration arg2, long arg3, ICreationScope arg4) { //only verify count in redis }
private void VerifyRoutes(Action <QueueConnection, QueueProducerConfiguration, long, string, ICreationScope> verify, QueueConnection arg1, QueueProducerConfiguration arg3, long arg4, string route, ICreationScope scope) { verify(arg1, arg3, arg4, route, scope); }
private void Verify(QueueConnection arg1, QueueProducerConfiguration arg2, long arg3, ICreationScope arg4) { //noop }
public static void Verify(string queueName, string connectionString, QueueProducerConfiguration queueProducerConfiguration, long messageCount, string route, ICreationScope scope) { new VerifyQueueData(queueName, queueProducerConfiguration.Options()).Verify(messageCount, route); }
public static AdditionalMessageData GenerateRouteData(QueueProducerConfiguration configuration) { configuration.SetRoute(true); return(GenerateData(configuration)); }
public static AdditionalMessageData GenerateExpiredDataWithRoute(QueueProducerConfiguration configuration) { configuration.SetMessageExpiration(true); configuration.SetRoute(true); return(GenerateData(configuration)); }
public static void NoVerification(string queueName, string connectionString, QueueProducerConfiguration queueProducerConfiguration, long messageCount, ICreationScope scope) { }
private void Verify(QueueConnection arg1, QueueProducerConfiguration arg2, long arg3, ICreationScope arg4) { Helpers.Verify(arg1, arg2, arg3 * 10, arg4); }
private void Verify(QueueConnection arg1, QueueProducerConfiguration arg2, long arg3, ICreationScope arg4) { //don't verify the single producers; verify at the end }
private AdditionalMessageData GenerateDataWithRoute(Func <QueueProducerConfiguration, AdditionalMessageData> generateData, QueueProducerConfiguration config, string route) { var data = generateData(config); data.Route = route; return(data); }