User-1101714267 posted
Hi all.
I need to create an Excel report long-term in the background with the call from a website. The code to use for the call is the following:
QueueClient client = QueueClient.CreateFromConnectionString(connectionString, queueName, ReceiveMode.ReceiveAndDelete);
BrokeredMessage msg = new BrokeredMessage(classe);
msg.MessageId = DateTime.Now.ToString("yyyyMMddHHmmss");
client.Send(msg);
Listening is a webjob with execution continues receiving the queue and activates the procedure to create the report.
This is the webjob code and configuration:
static void Main() {
using (IKernel kernel = new StandardKernel(new MyBindings())) {
_servicesBusConnectionString = ConfigurationManager.AppSettings["serviceBusConnectionString"];
_namespaceManager = NamespaceManager.CreateFromConnectionString(_servicesBusConnectionString);
JobHostConfiguration config = new JobHostConfiguration();
config.FunctionTimeout = new TimeSpan(1, 0, 0);
config.JobActivator = new MyJobActivator(kernel);
ServiceBusConfiguration serviceBusConfig = new ServiceBusConfiguration {
ConnectionString = _servicesBusConnectionString
};
config.UseServiceBus(serviceBusConfig);
var host = new JobHost(config);
host.RunAndBlock();
}
}
//Function
public void ProcessQueueMessage([ServiceBusTrigger("my-queue")] ReportExcel message, TextWriter log) {
[...]
}
If execution time for report creation is very long, job execution goes to state "Never finished" and start a new procedure (I think it happens after 10 minutes).
How do I leave a single active long execution?