2
votes

I am setting up a small application to test a newly created Basic tier Azure service bus. I am using Masstransit to set up a sample publisher:

ServiceBusFactory.New(sbc =>
                {
                    var queueUri = "azure-sb://" + azureNamespace + "/Sample_TestPub";

                    sbc.UseAzureServiceBus(a =>
                    {
                        a.SetDefaultMessageTimeToLive(TimeSpan.FromSeconds(30));
                        a.ConfigureNamespace(azureNamespace ,
                                             azureNs =>
                                             {
                                                 azureNs.SetKey(sharedKey);
                                                 azureNs.SetKeyName(keyName);
                                                 azureNs.Validate();
                                             });
                    });
                    sbc.ReceiveFrom(queueUri);
                    sbc.UseAzureServiceBusRouting();
                })
            )

I am using the following code to publish:

text = Console.ReadLine();
            var newWhat = new SomethingRequest
                {
                    What = text,
                    When = DateTime.Now
                };
            ISomethingResponse response = null;
            bus.PublishRequest(newWhat, cfg =>
                {
                    cfg.Handle<ISomethingResponse>(r => response = r);
                });

On PublishRequest() I am getting the following error:

azure-sb://namespace/Sample_TestPub => Invalid connection to host

inner exception: {"The remote server returned an error: (400) Bad Request. SubCode=40000. The property value for 'DefaultMessageTimeToLive' must be between 00:00:01 and 14.00:00:00 when the namespace 'namespace' is using 'Basic' tier.\r\nParameter name: DefaultMessageTimeToLive. TrackingId:67c96bcc-e376-429a-8f22-79227e89f935_G24,TimeStamp:2/3/2015 2:56:33 AM"}

I have not configured my bus in anyway through the Azure portal - is there something I am missing? Does the SetDefaultMessageTimeToLive() call not do what I think it does?

1
Doesn't it look like you need to have TTL of at least 1 minutezaitsman
00:00:01 should mean "1 second" (For C#, in LinqPad try TimeSpan.FromSeconds(1) == TimeSpan.Parse("00:00:01") it should return True) Either way I Tried a larger timespan with the same resultsryanhallcs
I can't answer that on the ASB transport, as I didn't write it, but I know that MassTransit 3 has early service bus support, but it's not ready for production use yet.Chris Patterson

1 Answers

1
votes

I got the same error using a sample app from NServiceBus. When I switched my Azure Service Bus to a Standard tier instead of Basic it started working. I don't know why. My gut, however, suggests that the text of the error doesn't match exactly with the problem.