public void InitializeCommandListeners(Type type, string queueName) { Logger.LogInformation("Initializing command listeners for type '{1}'", type); foreach (var attributeContent in InitializationUtility.GetAttributeValuesWithMethod <CommandAttribute>(type)) { var parameterType = InitializationUtility.GetParameterTypeOrThrow(attributeContent.Method, Logger); _commandListener.SetupCommandListenerAsync( queueName, attributeContent.Key, receivedParameter => InvokeCommand(receivedParameter, attributeContent), parameterType, attributeContent.ExchangeName).Wait(); } }