Amazon SQS queue does not found with NSB7

I am using Nihbernate as persistence and Amazon SQS as transport

Below packages I am using

  <package id="AWSSDK.Core" version="3.3.19" targetFramework="net462" />
  <package id="AWSSDK.S3" version="3.3.16" targetFramework="net462" />
  <package id="AWSSDK.SQS" version="3.3.3.2" targetFramework="net462" />
  <package id="Iesi.Collections" version="4.0.2" targetFramework="net462" />
  <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net462" />
  <package id="NHibernate" version="4.0.4.4000" targetFramework="net462" />
  <package id="NServiceBus" version="7.0.1" targetFramework="net462" />
  <package id="NServiceBus.AmazonSQS" version="4.1.0" targetFramework="net462" />
  <package id="NServiceBus.CustomChecks" version="3.0.0" targetFramework="net461" />
  <package id="NServiceBus.Heartbeat" version="3.0.0" targetFramework="net461" />
  <package id="NServiceBus.Metrics" version="3.0.0" targetFramework="net461" />
  <package id="NServiceBus.Metrics.ServiceControl" version="3.0.1" targetFramework="net461" />
  <package id="NServiceBus.Newtonsoft.Json" version="2.1.0" targetFramework="net462" />
  <package id="NServiceBus.NHibernate" version="8.0.0" targetFramework="net462" />
  <package id="NServiceBus.SqlServer" version="4.0.0" targetFramework="net462" />
  <package id="System.Data.SqlClient" version="4.4.3" targetFramework="net462" />

When I try to run the code I got below exception

    2018-06-22 07:12:55.628 INFO  NServiceBus.Transports.SQS.QueueCreator Creating SQS Queue with 
     name 'error' for address 'error'.
2018-06-22 07:12:55.768 INFO  NServiceBus.Transports.SQS.QueueCreator Creating SQS Queue with name 'audit' for address 'audit'.
2018-06-22 07:12:55.784 INFO  NServiceBus.Transports.SQS.QueueCreator Creating SQS Queue with name 'NSB-Server' for address 'NSB.Server'.
2018-06-22 07:12:56.800 ERROR NServiceBus.Transports.SQS.MessageDispatcher Exception from Send.
Amazon.SQS.Model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. ---> Amazon.Runtime.Internal.HttpErrorResponseException: The remote server returned an error: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.HttpRequest.<GetResponseAsync>d__16.MoveNext()
   --- End of inner exception stack trace ---
   at Amazon.Runtime.Internal.HttpRequest.<GetResponseAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.HttpHandler`1.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.SQS.Internal.ValidationResponseHandler.<InvokeAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1.MoveNext()
   --- End of inner exception stack trace ---
   at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception)
   at Amazon.Runtime.Internal.ExceptionHandler`1.Handle(IExecutionContext executionContext, Exception exception)
   at Amazon.Runtime.Internal.ErrorHandler.ProcessException(IExecutionContext executionContext, Exception exception)
   at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.AmazonSQS.QueueUrlCache.<GetQueueUrl>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Transports.SQS.MessageDispatcher.<SendMessage>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NServiceBus.Transports.SQS.MessageDispatcher.<Dispatch>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Transports.SQS.MessageDispatcher.<Dispatch>d__1.MoveNext()
2018-06-22 07:12:56.815 ERROR NServiceBus.Transports.SQS.MessageDispatcher Exception from Send.
Amazon.SQS.Model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. ---> Amazon.Runtime.Internal.HttpErrorResponseException: The remote server returned an error: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.HttpRequest.<GetResponseAsync>d__16.MoveNext()
   --- End of inner exception stack trace ---
   at Amazon.Runtime.Internal.HttpRequest.<GetResponseAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.HttpHandler`1.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.SQS.Internal.ValidationResponseHandler.<InvokeAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1.MoveNext()
   --- End of inner exception stack trace ---
   at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception)
   at Amazon.Runtime.Internal.ExceptionHandler`1.Handle(IExecutionContext executionContext, Exception exception)
   at Amazon.Runtime.Internal.ErrorHandler.ProcessException(IExecutionContext executionContext, Exception exception)
   at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.AmazonSQS.QueueUrlCache.<GetQueueUrl>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Transports.SQS.MessageDispatcher.<SendMessage>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NServiceBus.Transports.SQS.MessageDispatcher.<Dispatch>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Below is config code

   //serializer
        endpointConfiguration.UseSerialization<XmlSerializer>();
       
        var persistence = endpointConfiguration.UsePersistence<NHibernatePersistence>();
        var nhConfig = new NHibernate.Cfg.Configuration();
        nhConfig.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
        nhConfig.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.Sql2008ClientDriver");
        nhConfig.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MsSql2008Dialect");
        nhConfig.SetProperty(NHibernate.Cfg.Environment.ConnectionString, ConfigurationManager.ConnectionStrings["NSB_AWS.NHibernatePersistence"].ConnectionString);
        nhConfig.SetProperty(NHibernate.Cfg.Environment.DefaultSchema, "dbo");
        
        persistence.UseConfiguration(nhConfig);
                                      
        //Transport
        var transportType = ConfigurationManager.AppSettings["transportType"];

        if (string.IsNullOrEmpty(transportType))
            throw new Exception("Provide TransportType in configuration");

    endpointConfiguration.SendFailedMessagesTo("error");
                    endpointConfiguration.AuditProcessedMessagesTo("audit");

                    endpointConfiguration.ReportCustomChecksTo(
                    serviceControlQueue: "Particular.ServiceControl",
                    timeToLive: TimeSpan.FromSeconds(10));

                    endpointConfiguration.SendHeartbeatTo(
                    serviceControlQueue: "Particular.ServiceControl",
                    frequency: TimeSpan.FromSeconds(15),
                    timeToLive: TimeSpan.FromSeconds(30));

                    const string SERVICE_CONTROL_METRICS_ADDRESS = "particular.monitoring";

                    var metrics = endpointConfiguration.EnableMetrics();

                    metrics.SendMetricDataToServiceControl(
                        serviceControlMetricsAddress: SERVICE_CONTROL_METRICS_ADDRESS,
                        interval: TimeSpan.FromSeconds(10)
                        );

                    var S3BucketName = ConfigurationManager.AppSettings["S3BucketName"];
                    var S3KeyPrefix = ConfigurationManager.AppSettings["S3KeyPrefix"];
                    var transport = endpointConfiguration.UseTransport<SqsTransport>();

                    transport.ClientFactory(() => new AmazonSQSClient(new AmazonSQSConfig
                    {
                        RegionEndpoint = RegionEndpoint.USEast1,


                    }));

                    var s3Configuration = transport.S3(S3BucketName, S3KeyPrefix);

                    s3Configuration.ClientFactory(() => new AmazonS3Client(
                    new AmazonS3Config
                    {
                        RegionEndpoint = RegionEndpoint.USEast1
                    }));

                    BuildEndpointSQSRouting(transport.Routing());
                    endpointConfiguration.EnableOutbox();  
                    endpointConfiguration.EnableInstallers();

Note : It is creating audit, error and ednpoint queue in SQS

Hi @eraj2587

When you have EnableInstallers() on an endpoint the endpoint only creates the queues that belong to that endpoint. That is the endpoint queue itself, the delay delivery queue (SQS Version 4 and greater if enabled) and the audit and error queues if they don’t exist (these are two special cases).

All the queues you send to are not automatically created for you. They are created by the endpoints that own it. So if something tries to send a message to a queue that does not exist the exception you are seeing will be thrown.

Based on your code above I would say it could be either

particular.monitor
Particular.ServiceControl
or one of the queues that you refer to in BuildEndpointSQSRouting.

For Send and receive scenarios you need to make sure that the receiver with enabled installers is either started before the sender or in production you could create the queues yourself by using the script approach we provide on the docs site.

Furthermore please be aware that only the monitoring solution is fully supported with SQS. ServiceControl with SQS works with the transport adapter approach for now. We are working on making it fully supported but can’t give you any dates yet when it will be ready.

See the transport adapters for more details about how to get ServiceControl running by adapting over another transport

Regards
Daniel

Thanks after manually creating missing queues, error disappeared.

Again came the same issue when pumping large number of order messages (100). Errors shown are as below

Error 1

2018-06-22 19:07:28.502 INFO  NServiceBus.RecoverabilityExecutor Immediate Retry is going to retry me    ssage 'a3b1742f-b5eb-4310-a366-a907013a56a4' because of an exception:
Amazon.SQS.Model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. ---> Amazon.Runtime.Internal.HttpErrorResponseException: The remote server returned an error: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

Error 2

2018-06-22 19:07:28.620 ERROR NServiceBus.Transports.SQS.MessageDispatcher Exception from Send.
Amazon.SQS.Model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. ---> Amazon.Runtime.Internal.HttpErrorResponseException: The remote server returned an error: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

I have below queues for that endpoint and such for all endpoints
NSB-Server
NSB-Server-Retries
NSB-Server-Timeouts
NSB-Server-TimeoutsDispatcher

I am not sure which queue still I am missing.

Hi

I raised an issue to improve this

Until there is more transparency I would suggest you double check the routing code and check for casing mismatch. Amazon SQS queues and URLs are case-sensitive, unfortunately.

Regards
Daniel

Thanks for raising it. I have below code for routing

    internal virtual RoutingSettings<SqsTransport> BuildEndpointSQSRouting(
          RoutingSettings<SqsTransport> routing)
        {
            routing.RouteToEndpoint(typeof(PlaceOrder), "NSB.Server");
            routing.RegisterPublisher(typeof(OrderPlaced), "NSB.Server");
            return routing;
        }

Meanwhile I will check casing and update you.