public ServiceBrokerTransportReceiver(ServiceBrokerServiceBusReceiverConfiguration receiverConfiguration, ServiceBrokerServiceBusConfiguration configuration)
 {
     messageMapper = configuration.MessageMapper;
     messageEncoder = configuration.MessageEncoder;
     ServiceBrokerMessageType = configuration.ServiceBrokerMessageType;
     if (string.IsNullOrWhiteSpace(ServiceBrokerMessageType))
     {
         throw new InvalidConfigurationException("ServiceBrokerMessageType cannot be null or whitespace.");
     }
     ServiceBrokerContract = configuration.ServiceBrokerContract;
     if (string.IsNullOrWhiteSpace(ServiceBrokerContract))
     {
         throw new InvalidConfigurationException("ServiceBrokerContract cannot be null or whitespace.");
     }
     ServiceBrokerService = receiverConfiguration.ServiceBrokerService;
     if (string.IsNullOrWhiteSpace(ServiceBrokerService))
     {
         throw new InvalidConfigurationException("ServiceBrokerService cannot be null or whitespace.");
     }
     ServiceBrokerQueue = receiverConfiguration.ServiceBrokerQueue;
     if (string.IsNullOrWhiteSpace(ServiceBrokerQueue))
     {
         throw new InvalidConfigurationException("ServiceBrokerQueue cannot be null or whitespace.");
     }
     ConnectionString = configuration.ServiceBrokerConnectionString;
     if (string.IsNullOrWhiteSpace(ConnectionString) &&
         !string.IsNullOrWhiteSpace(configuration.ServiceBrokerConnectionStringName) &&
         ConfigurationManager.ConnectionStrings[configuration.ServiceBrokerConnectionStringName] != null)
     {
         ConnectionString = ConfigurationManager.ConnectionStrings[configuration.ServiceBrokerConnectionStringName].ConnectionString;
     }
     if (string.IsNullOrWhiteSpace(ConnectionString))
     {
         throw new InvalidConfigurationException("ServiceBrokerConnectionString cannot be null or whitespace.");
     }
     MaxRetries = receiverConfiguration.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = receiverConfiguration.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     if (MaxConcurrency > 0)
     {
         workerThreadPool = new Semaphore(MaxConcurrency, MaxConcurrency);
     }
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }
 public InMemoryQueueTransportReceiver(InMemoryQueueMessageReceiverConfiguration config, BaseServiceBusConfig serviceBusConfig)
 {
     QueueName = config.Address;
     MaxRetries = config.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = config.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }
 public AmqpTransportReceiver(AmqpMessageReceiverConfiguration config, AmqpServiceBusConfiguration serviceBusConfig)
 {
     amqpAddress = serviceBusConfig.AmqpAddress;
     ReceiverLinkAddress = config.ReceiverLinkAddress;
     MaxRetries = config.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = config.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     messageMapper = serviceBusConfig.MessageMapper;
     messageEncoder = serviceBusConfig.MessageEncoder;
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }