Nservice Bus with AzureStorageQueueTransport which hosted on azure webjob causing more containers creation and charging more price. please check below details and help me to find out what could be causing.
Please check my web job code and i am attaching storage account screenshots
.program.cs file
TelemetryConfiguration.Active.InstrumentationKey = ConfigurationManager.AppSettings[“APPINSIGHTS_INSTRUMENTATIONKEY”];
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12;
var config = new JobHostConfiguration();
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
config.DashboardConnectionString = null;
var host = new JobHost(config);
// The following code ensures that the WebJob will be running continuously
host.Call(typeof(Functions).GetMethod(“Host”));
host.RunAndBlock();
Functions.cs
public class Functions
{
private static readonly ILog Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
[NoAutomaticTrigger]
public static void Host(TextWriter log, CancellationToken cancellationToken)
{
try
{
NServiceBus.Logging.LogManager.Use<Log4NetFactory>();
var endpointConfiguration = new EndpointConfiguration("myendpoint");
endpointConfiguration.UniquelyIdentifyRunningInstance().UsingNames("myendpoint", Environment.MachineName);
endpointConfiguration.DisableFeature<AutoSubscribe>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.DisableFeature<NServiceBus.Features.TimeoutManager>();
endpointConfiguration.UseSerialization<XmlSerializer>();
endpointConfiguration.PurgeOnStartup(false);
endpointConfiguration.SendFailedMessagesTo("myendpointerror");
endpointConfiguration.AuditProcessedMessagesTo("myendpointaudit");
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
var delayedDelivery = transport.DelayedDelivery();
delayedDelivery.DisableTimeoutManager();
delayedDelivery.DisableDelayedDelivery();
var connection = ConfigurationManager.AppSettings["NServiceBus/AzureStorageQueue"];
transport.ConnectionString(connection);
transport.MessageInvisibleTime(TimeSpan.FromSeconds(90));
var recoverability = endpointConfiguration.Recoverability();
var nServiceBusMaxRetrys = Convert.ToInt32(ConfigurationManager.AppSettings["NServiceBusMaxRetrys"]);
recoverability.Immediate(
immediate =>
{
immediate.NumberOfRetries(0);
}).Delayed(delayed=> delayed.NumberOfRetries(0));
string route = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var routing = transport.Routing();
endpointConfiguration.UsePersistence<NHibernatePersistence>();
endpointConfiguration.DisableFeature<TimeoutManager>();
Logger.Info("*****.Backend.***** Host Starting!");
var endpointInstance = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();
Logger.Info("*****.Backend.***** Host Started!");
}
catch (Exception ex)
{
Logger.Info(ex.StackTrace);
throw ex;
}
}
}
