locked
Webjob continuos execution problem RRS feed

  • Question

  • 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?

    Tuesday, December 20, 2016 9:50 AM

All replies

  • User1296332936 posted

    I think webjobs have TimeoutAttribute.Please check that

    Friday, December 23, 2016 2:34 PM
  • User541108374 posted

    Hi,

    an alternative might be Azure Functions to do the stuff you need.

    Also: 10 minutes is pretty long to generate a report and likely beyond the intended scope of Web Jobs. Either optimize the generation code or look into another tooling set to generate it like a seperate VM.

    Grz, Kris.

    Monday, January 2, 2017 10:30 AM