/// <summary>
        /// Helper method to validate and collect ZeroMq parameters.
        /// </summary>
        public static ZeroMqConfiguration CollectZmqConfiguration(ref Dictionary <string, string> rawConfiguration, bool isInbound, ref IQueueLogger logger)
        {
            try
            {
                #region Initialization
                var zeroMqConfiguration = new ZeroMqConfiguration();
                rawConfiguration = rawConfiguration ?? new Dictionary <string, string>();
                #endregion

                #region Collecting Common Configuration
                MessageQueueCommonItems.CollectCommonConfiguration(ref rawConfiguration, zeroMqConfiguration, ZeroMqConfigurationKeys.GetAllKeys());
                #endregion

                #region Collecting Other Configuration
                // Nothing to collect.
                #endregion

                #region Return
                return(zeroMqConfiguration);

                #endregion
            }
            catch (QueueException queueException)
            {
                #region Adding Context Data
                queueException.Data.Add(CommonContextKeys.QueueContext, ZeroMqName);
                #endregion

                #region Logging - Error
                logger.Error(queueException, queueException.Message);
                #endregion

                throw;
            }
            catch (Exception ex)
            {
                throw MessageQueueCommonItems.PrepareAndLogQueueException(
                          QueueErrorCode.GeneralConfigurationParsingError
                          , ErrorMessages.GeneralConfigurationParsingError, ex, ZeroMqName, logger: logger);
            }
        }
Exemple #2
0
        /// <summary>
        /// Helper method to validate and collect ServiceBus parameters.
        /// </summary>
        internal static ServiceBusConfiguration CollectSbConfiguration(ref Dictionary <string, string> rawConfiguration, bool isInbound, ref IQueueLogger logger)
        {
            try
            {
                #region Initialization
                var serviceBusConfiguration = new ServiceBusConfiguration();
                rawConfiguration = rawConfiguration ?? new Dictionary <string, string>();
                #endregion

                #region Collecting Common Configuration
                MessageQueueCommonItems.CollectCommonConfiguration(ref rawConfiguration, serviceBusConfiguration, ServiceBusConfigurationKeys.GetAllKeys());
                #endregion

                #region Collecting Other Configuration
                // Namespace Address
                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.NamespaceAddress))
                {
                    if (string.IsNullOrWhiteSpace(rawConfiguration[ServiceBusConfigurationKeys.NamespaceAddress]))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.NamespaceAddress),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.NamespaceAddress
                        });
                    }

                    serviceBusConfiguration.NamespaceAddress = rawConfiguration[ServiceBusConfigurationKeys.NamespaceAddress];
                }

                // Queue Name
                if (!rawConfiguration.ContainsKey(CommonConfigurationKeys.QueueName) || string.IsNullOrWhiteSpace(rawConfiguration[CommonConfigurationKeys.QueueName]))
                {
                    throw new QueueException(QueueErrorCode.MissingRequiredConfigurationParameter,
                                             string.Format(ErrorMessages.MissingRequiredConfigurationParameter,
                                                           CommonConfigurationKeys.QueueName),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = CommonConfigurationKeys.QueueName
                    });
                }

                serviceBusConfiguration.QueueName = rawConfiguration[CommonConfigurationKeys.QueueName];

                // MaxDeliveryCount
                short maxDeliveryCount;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.MaxDeliveryCount))
                {
                    if (!short.TryParse(rawConfiguration[ServiceBusConfigurationKeys.MaxDeliveryCount], out maxDeliveryCount))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.MaxDeliveryCount),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.MaxDeliveryCount
                        });
                    }
                }
                else
                {
                    maxDeliveryCount = Defaults.MaxDeliveryCount;
                }

                serviceBusConfiguration.MaxDeliveryCount = maxDeliveryCount;

                // MaxSizeInMegabytes
                long maxSizeInMegabytes;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.MaxSizeInMegabytes))
                {
                    if (!long.TryParse(rawConfiguration[ServiceBusConfigurationKeys.MaxSizeInMegabytes], out maxSizeInMegabytes))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.MaxSizeInMegabytes),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.MaxSizeInMegabytes
                        });
                    }
                }
                else
                {
                    maxSizeInMegabytes = Defaults.MaxSizeInMegabytes;
                }

                serviceBusConfiguration.MaxSizeInMegabytes = maxSizeInMegabytes;

                // EnableDeadLettering
                bool enableDeadLettering;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.EnableDeadLettering))
                {
                    if (!bool.TryParse(rawConfiguration[ServiceBusConfigurationKeys.EnableDeadLettering], out enableDeadLettering))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.EnableDeadLettering),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.EnableDeadLettering
                        });
                    }
                }
                else
                {
                    enableDeadLettering = Defaults.EnableDeadLettering;
                }

                serviceBusConfiguration.EnableDeadLettering = enableDeadLettering;

                // EnablePartitioning
                bool enablePartitioning;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.EnablePartitioning))
                {
                    if (!bool.TryParse(rawConfiguration[ServiceBusConfigurationKeys.EnablePartitioning], out enablePartitioning))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.EnablePartitioning),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.EnablePartitioning
                        });
                    }
                }
                else
                {
                    enablePartitioning = Defaults.EnablePartitioning;
                }

                serviceBusConfiguration.EnablePartitioning = enablePartitioning;

                // RequiresDuplicateDetection
                bool requiresDuplicateDetection;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.RequiresDuplicateDetection))
                {
                    if (!bool.TryParse(rawConfiguration[ServiceBusConfigurationKeys.RequiresDuplicateDetection], out requiresDuplicateDetection))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.RequiresDuplicateDetection),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.RequiresDuplicateDetection
                        });
                    }
                }
                else
                {
                    requiresDuplicateDetection = Defaults.RequiresDuplicateDetection;
                }

                serviceBusConfiguration.RequiresDuplicateDetection = requiresDuplicateDetection;

                // EnableBatchedOperations
                bool enableBatchedOperations;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.EnableBatchedOperations))
                {
                    if (!bool.TryParse(rawConfiguration[ServiceBusConfigurationKeys.EnableBatchedOperations], out enableBatchedOperations))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.EnableBatchedOperations),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.EnableBatchedOperations
                        });
                    }
                }
                else
                {
                    enableBatchedOperations = Defaults.EnableBatchedOperations;
                }

                serviceBusConfiguration.EnableBatchedOperations = enableBatchedOperations;

                // MessageTimeToLiveInMinutes
                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.MessageTimeToLiveInMinutes))
                {
                    int messageTimeToLiveInMinutes;

                    if (!int.TryParse(rawConfiguration[ServiceBusConfigurationKeys.MessageTimeToLiveInMinutes], out messageTimeToLiveInMinutes))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.MessageTimeToLiveInMinutes),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.MessageTimeToLiveInMinutes
                        });
                    }

                    serviceBusConfiguration.MessageTimeToLiveInMinutes = TimeSpan.FromMinutes(messageTimeToLiveInMinutes);
                }
                else
                {
                    serviceBusConfiguration.MessageTimeToLiveInMinutes = Defaults.MessageTimeToLive;
                }

                // LockDurationInSeconds
                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.LockDurationInSeconds))
                {
                    int lockDurationInSeconds;

                    if (!int.TryParse(rawConfiguration[ServiceBusConfigurationKeys.LockDurationInSeconds], out lockDurationInSeconds))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.LockDurationInSeconds),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.LockDurationInSeconds
                        });
                    }

                    serviceBusConfiguration.LockDurationInSeconds = TimeSpan.FromSeconds(lockDurationInSeconds);
                }
                else
                {
                    serviceBusConfiguration.LockDurationInSeconds = Defaults.LockDurationInSeconds;
                }

                // Acknowledgment
                bool acknowledgment;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.Acknowledgment))
                {
                    if (isInbound == false)
                    {
                        throw new QueueException(QueueErrorCode.ParameterNotApplicationInCurrentConfiguration,
                                                 string.Format(ErrorMessages.ParameterNotApplicationInCurrentConfiguration,
                                                               ServiceBusConfigurationKeys.Acknowledgment),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.Acknowledgment
                        });
                    }

                    if (!bool.TryParse(rawConfiguration[ServiceBusConfigurationKeys.Acknowledgment], out acknowledgment))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.Acknowledgment),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.Acknowledgment
                        });
                    }
                }
                else
                {
                    acknowledgment = Defaults.Acknowledgment;
                }

                serviceBusConfiguration.Acknowledgment = acknowledgment;

                // MaxConcurrentReceiveCallback
                ushort maxConcurrentReceiveCallback;

                if (rawConfiguration.ContainsKey(ServiceBusConfigurationKeys.MaxConcurrentReceiveCallback))
                {
                    if (isInbound == false)
                    {
                        throw new QueueException(QueueErrorCode.ParameterNotApplicationInCurrentConfiguration,
                                                 string.Format(ErrorMessages.ParameterNotApplicationInCurrentConfiguration,
                                                               ServiceBusConfigurationKeys.MaxConcurrentReceiveCallback),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.MaxConcurrentReceiveCallback
                        });
                    }

                    if (!ushort.TryParse(rawConfiguration[ServiceBusConfigurationKeys.MaxConcurrentReceiveCallback], out maxConcurrentReceiveCallback))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               ServiceBusConfigurationKeys.MaxConcurrentReceiveCallback),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = ServiceBusConfigurationKeys.MaxConcurrentReceiveCallback
                        });
                    }
                }
                else
                {
                    maxConcurrentReceiveCallback = Defaults.MaxConcurrentReceiveCallback;
                }

                serviceBusConfiguration.MaxConcurrentReceiveCallback = maxConcurrentReceiveCallback;
                #endregion

                #region Return
                return(serviceBusConfiguration);

                #endregion
            }
            catch (QueueException queueException)
            {
                #region Adding Context Data
                queueException.Data.Add(CommonContextKeys.QueueContext, ServiceBusName);
                #endregion

                #region Logging - Error
                logger.Error(queueException, queueException.Message);
                #endregion

                throw;
            }
            catch (Exception ex)
            {
                throw MessageQueueCommonItems.PrepareAndLogQueueException(
                          QueueErrorCode.GeneralConfigurationParsingError
                          , ErrorMessages.GeneralConfigurationParsingError, ex, ServiceBusName, logger: logger);
            }
        }
Exemple #3
0
        /// <summary>
        /// Helper method to validate and collect RabbitMq parameters.
        /// </summary>
        public static RabbitMqConfiguration CollectConfiguration(ref Dictionary <string, string> rawConfiguration, bool isInbound, ref IQueueLogger logger)
        {
            try
            {
                #region Initialization
                var rabbitMqConfiguration = new RabbitMqConfiguration();
                rawConfiguration = rawConfiguration ?? new Dictionary <string, string>();
                #endregion

                #region Collecting Common Configuration
                MessageQueueCommonItems.CollectCommonConfiguration(ref rawConfiguration, rabbitMqConfiguration, RabbitMqConfigurationKeys.GetAllKeys());
                #endregion

                #region Collecting Other Configuration
                // Port
                int port = 0;

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.Port) &&
                    !int.TryParse(rawConfiguration[RabbitMqConfigurationKeys.Port], out port))
                {
                    throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                             string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                           RabbitMqConfigurationKeys.Port),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.Port
                    });
                }

                rabbitMqConfiguration.Port = port;

                // UserName
                if (!rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.UserName) ||
                    string.IsNullOrWhiteSpace(rawConfiguration[RabbitMqConfigurationKeys.UserName]))
                {
                    throw new QueueException(QueueErrorCode.MissingRequiredConfigurationParameter,
                                             string.Format(ErrorMessages.MissingRequiredConfigurationParameter,
                                                           RabbitMqConfigurationKeys.UserName),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.UserName
                    });
                }

                rabbitMqConfiguration.UserName = rawConfiguration[RabbitMqConfigurationKeys.UserName];

                // Password
                if (!rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.Password) ||
                    string.IsNullOrWhiteSpace(rawConfiguration[RabbitMqConfigurationKeys.Password]))
                {
                    throw new QueueException(QueueErrorCode.MissingRequiredConfigurationParameter,
                                             string.Format(ErrorMessages.MissingRequiredConfigurationParameter,
                                                           RabbitMqConfigurationKeys.Password),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.Password
                    });
                }

                rabbitMqConfiguration.Password = rawConfiguration[RabbitMqConfigurationKeys.Password];

                // Queue Name
                if (!rawConfiguration.ContainsKey(CommonConfigurationKeys.QueueName) ||
                    string.IsNullOrWhiteSpace(rawConfiguration[CommonConfigurationKeys.QueueName]))
                {
                    throw new QueueException(QueueErrorCode.MissingRequiredConfigurationParameter,
                                             string.Format(ErrorMessages.MissingRequiredConfigurationParameter,
                                                           CommonConfigurationKeys.QueueName),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = CommonConfigurationKeys.QueueName
                    });
                }

                rabbitMqConfiguration.QueueName = rawConfiguration[CommonConfigurationKeys.QueueName];

                // Exchange Name
                rabbitMqConfiguration.ExchangeName = null;

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.ExchangeName))
                {
                    if (string.IsNullOrWhiteSpace(rawConfiguration[RabbitMqConfigurationKeys.ExchangeName]))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               RabbitMqConfigurationKeys.ExchangeName),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.ExchangeName
                        });
                    }

                    rabbitMqConfiguration.ExchangeName = rawConfiguration[RabbitMqConfigurationKeys.ExchangeName];
                }

                // Routing Key
                rabbitMqConfiguration.RoutingKey = null;

                if (rabbitMqConfiguration.ExchangeName == null &&
                    rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.RoutingKey))
                {
                    throw new QueueException(QueueErrorCode.ParameterNotApplicationInCurrentConfiguration,
                                             string.Format(ErrorMessages.ParameterNotApplicationInCurrentConfiguration,
                                                           RabbitMqConfigurationKeys.RoutingKey),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.RoutingKey
                    });
                }

                if (rabbitMqConfiguration.ExchangeName != null)
                {
                    if (!rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.RoutingKey))
                    {
                        throw new QueueException(QueueErrorCode.ParameterRequiredInCurrentConfiguration,
                                                 string.Format(ErrorMessages.ParameterRequiredInCurrentConfiguration,
                                                               RabbitMqConfigurationKeys.RoutingKey),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.RoutingKey
                        });
                    }

                    rabbitMqConfiguration.RoutingKey = rawConfiguration[RabbitMqConfigurationKeys.RoutingKey];
                }

                // Durable Exchange
                var durableExchange = false;

                if (rabbitMqConfiguration.ExchangeName == null &&
                    rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.DurableExchange))
                {
                    throw new QueueException(QueueErrorCode.ParameterNotApplicationInCurrentConfiguration,
                                             string.Format(ErrorMessages.ParameterNotApplicationInCurrentConfiguration,
                                                           RabbitMqConfigurationKeys.DurableExchange),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.DurableExchange
                    });
                }

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.DurableExchange) &&
                    !bool.TryParse(rawConfiguration[RabbitMqConfigurationKeys.DurableExchange], out durableExchange))
                {
                    throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                             string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                           RabbitMqConfigurationKeys.DurableExchange),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.DurableExchange
                    });
                }

                rabbitMqConfiguration.DurableExchange = durableExchange;

                // Durable Queue
                var durableQueue = false;

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.DurableQueue) &&
                    !bool.TryParse(rawConfiguration[RabbitMqConfigurationKeys.DurableQueue], out durableQueue))
                {
                    throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                             string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                           RabbitMqConfigurationKeys.DurableQueue),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.DurableQueue
                    });
                }

                rabbitMqConfiguration.DurableQueue = durableQueue;

                // Durable Message
                var durableMessage = false;

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.DurableMessage) &&
                    !bool.TryParse(rawConfiguration[RabbitMqConfigurationKeys.DurableMessage], out durableMessage))
                {
                    throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                             string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                           RabbitMqConfigurationKeys.DurableMessage),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.DurableMessage
                    });
                }

                rabbitMqConfiguration.DurableMessage = durableMessage;

                // Acknowledgment
                var acknowledgment = false;

                if (isInbound == false && rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.Acknowledgment))
                {
                    throw new QueueException(QueueErrorCode.ParameterNotApplicationInCurrentConfiguration,
                                             string.Format(ErrorMessages.ParameterNotApplicationInCurrentConfiguration,
                                                           RabbitMqConfigurationKeys.Acknowledgment),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.Acknowledgment
                    });
                }

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.Acknowledgment) &&
                    !bool.TryParse(rawConfiguration[RabbitMqConfigurationKeys.Acknowledgment], out acknowledgment))
                {
                    throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                             string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                           RabbitMqConfigurationKeys.Acknowledgment),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.Acknowledgment
                    });
                }

                rabbitMqConfiguration.Acknowledgment = acknowledgment;

                // MaxConcurrentReceiveCallback
                ushort maxConcurrentReceiveCallback;

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.MaxConcurrentReceiveCallback))
                {
                    if (isInbound == false)
                    {
                        throw new QueueException(QueueErrorCode.ParameterNotApplicationInCurrentConfiguration,
                                                 string.Format(ErrorMessages.ParameterNotApplicationInCurrentConfiguration,
                                                               RabbitMqConfigurationKeys.MaxConcurrentReceiveCallback),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.MaxConcurrentReceiveCallback
                        });
                    }

                    if (!ushort.TryParse(rawConfiguration[RabbitMqConfigurationKeys.MaxConcurrentReceiveCallback],
                                         out maxConcurrentReceiveCallback))
                    {
                        throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                                 string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                               RabbitMqConfigurationKeys.MaxConcurrentReceiveCallback),
                                                 context: new Dictionary <string, string>
                        {
                            [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.MaxConcurrentReceiveCallback
                        });
                    }
                }
                else
                {
                    maxConcurrentReceiveCallback = Defaults.MaxConcurrentReceiveCallback;
                }

                rabbitMqConfiguration.MaxConcurrentReceiveCallback = maxConcurrentReceiveCallback;

                // Connection Timeout
                var connectionTimeout = Defaults.RabbitMqConnectionTimeoutInMinutes;

                if (rawConfiguration.ContainsKey(RabbitMqConfigurationKeys.ConnectionTimeoutInMinutes) &&
                    !int.TryParse(rawConfiguration[RabbitMqConfigurationKeys.ConnectionTimeoutInMinutes],
                                  out connectionTimeout))
                {
                    throw new QueueException(QueueErrorCode.InvalidValueForConfigurationParameter,
                                             string.Format(ErrorMessages.InvalidValueForConfigurationParameter,
                                                           RabbitMqConfigurationKeys.ConnectionTimeoutInMinutes),
                                             context: new Dictionary <string, string>
                    {
                        [CommonContextKeys.ParameterName] = RabbitMqConfigurationKeys.ConnectionTimeoutInMinutes
                    });
                }

                rabbitMqConfiguration.ConnectionTimeoutInMinutes = connectionTimeout;
                #endregion

                #region Return
                return(rabbitMqConfiguration);

                #endregion
            }
            catch (QueueException queueException)
            {
                #region Adding Context Data
                queueException.Data.Add(CommonContextKeys.QueueContext, RabbitMqName);
                #endregion

                #region Logging - Error
                logger.Error(queueException, queueException.Message);
                #endregion

                throw;
            }
            catch (Exception ex)
            {
                throw MessageQueueCommonItems.PrepareAndLogQueueException(
                          QueueErrorCode.GeneralConfigurationParsingError
                          , ErrorMessages.GeneralConfigurationParsingError, ex, RabbitMqName, logger: logger);
            }
        }