Skip to content

Custom Scheduler Name

Paul Sterl edited this page Jan 13, 2025 · 6 revisions
To customize the way how the default `SchedulerService` is build the `SchedulerCustomizer` interface can be used. In this example we use the azure web-application environment variables to set the scheduler name:

@Bean
SchedulerCustomizer schedulerCustomizer(Environment env) {
  return new SchedulerCustomizer() {
    public String name() {
      var hostname = env.getProperty("COMPUTERNAME");
      var role = env.getProperty("APPSETTING_APPLICATIONINSIGHTS_ROLE_NAME", "").toLowerCase();
      if (role != "") {
        hostname = hostname + "-" + role;
      }
      return hostname;
    }
  };
}
Clone this wiki locally