title: How to create a custom Apache Camel Timer object
body: <p>Is there a way create a custom Apache Camel Timer as an object defined in java code rather than defining it as a dsl string pattern in the endpoint URI?</p>
  
  <p>In the docs:  <a href="https://camel.apache.org/components/latest/timer-component.html" rel="nofollow noreferrer">https://camel.apache.org/components/latest/timer-component.html</a>  there is mention of this timer URI query param: </p>
  
  <p><a href="https://i.stack.imgur.com/CHtsg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CHtsg.png" alt="timer (advanced) - To use a custom Timer"></a></p>
  
  <p>but I haven't found examples of creating that "advanced" custom Timer.</p>
  
  <p>Rather than specify a timer like this:</p>
  
  <pre><code>from("timer://foo?fixedRate=true&amp;period=60000").to("bean:myBean?method=someMethodName");
  </code></pre>
  
  <p>I would like to specify it as:</p>
  
  <pre><code>from("timer://foo?timer=com.MyCustomTimer").to("bean:myBean?method=someMethodName");
  </code></pre>
  
  <p>which would be accompanied by:</p>
  
  <pre><code>class MyCustomTimer implements TimerInterfaceICantFind{
  
      public MyCustomTimer(){
          setFixedRate(true);
          setPeriod(60000);   
      }
  }
  </code></pre>
  
  <p>I'm wanting to do this so I can specify timer properties dynamically through java setters rather than substituting them into a string URI being constructed.</p>
  
  <p>At the time of this writing, others have asked of Timer URI string syntax, but not of custom timers. Ex:</p>
  
  <p><a href="https://stackoverflow.com/questions/25088154/apache-camel-timer-route-uri-syntax">Apache Camel timer route URI syntax</a></p>
  
  <p>I saw in the camel source code, it looks like TimerComponent.getTimer() is returning a <strong>java.util</strong>.Timer</p>
  
  <p>Would that imply that one needs to create the core java class: java.util.Timer - and set properties on it rather than using a camel version of a Timer object for a custom Timer?</p>
  
  <p><a href="https://i.stack.imgur.com/i4C2m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i4C2m.png" alt="timer component"></a></p>