Search code examples
sitecoreagents

Scheduled agents not being added


I am developing a Sitecore solution in which I have implemented an agent and registered it in an include configuration file as such:

<agent name="Start customer data import job"
       type="My.Namespace.MyJob" 
       method="DoSomething" interval="00:02:00" />

I can see in hostname/sitecore/admin/showconfig.aspx that the include file is correctly applied and tha the agent is next to the existing agents.

For now, the job simply logs INFO (I have given bogus namespace, class and method names, but the actual configuration is correct):

using Sitecore.Diagnostics;

namespace My.Namespace
{
    public class MyJob
    {
        public void DoSomething()
        {
            Log.Info("My custom job has started.", this);
        }
    }
}

Unfortunately, I could see that the log statements were not written at all. Logging level indeed allows for INFO to be logged. After looking around for a while, I could see that the scheduler never logs that it is adding the agents. From what I can find on google, the log should include statements like Adding agent: Sitecore.Tasks.DatabaseAgent, but it doesn't.

It seems that the scheduler is not running, but why?

I am using Sitecore 8.1 Update 3 (rev. 160519).

Edit: The job is being run on our test server, so it is definitely something wrong with my installation of Sitecore.


Solution

  • I had an old configuration file lying around in the Include folder, which had the following patch:

    <configuration>
      <sitecore>
        <pipelines>
          <initialize>
            <processor type="Sitecore.Pipelines.Loader.InitializeScheduler, Sitecore.Kernel">
              <patch:delete />
            </processor>
          </initialize>
        </pipelines>
      </sitecore>
    </configuration>
    

    This patch makes sure that the scheduler is never initialized and the agents are never run. Deleting the configuration file solved the problem.