You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Pavel Grushetzky (JIRA)" <ji...@apache.org> on 2011/01/05 01:34:45 UTC

[jira] Commented: (CAMEL-3491) Introduce scala DSL for schedule-triggered routes

    [ https://issues.apache.org/jira/browse/CAMEL-3491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977552#action_12977552 ] 

Pavel Grushetzky commented on CAMEL-3491:
-----------------------------------------

Basically, attached patch introduces one shortcut for timer, and another one for quartz.

{code}
schedule("myTimer") every(2 minutes 30 seconds) to("whatever")
{code}

{code}
schedule("myTimer") cron("0 0/15 * * * ?") to("whatever")
{code}

timer name is optional; one can use
{code}
schedule every(2 minutes 30 seconds) to("whatever")
{code}
{code}
schedule cron("0 0/15 * * * ?") to("whatever")
{code}
and then generated timer name will be "scalaScheduleN", where N is a static counter.


Both single-line and block syntax supported, _but_ this patch introduces "block" keyword to make that happen. 
{code}
schedule every(2 minutes 30 seconds) block {
  to("foo")
  to("bar")
}
{code}
{code}
schedule cron("0 0/15 * * * ?") block {
  to("foo")
  to("bar")
}
{code}
"block" is an alias for "==>" . The problem it solves is operator precedence: "==>" has higher precedence, thus alphanumeric infix operators on left hand side won't evaluate properly. "block" is of same precedence, so it will work. Mode details in section "6.12.3 Infix Operations" from [scala spec|http://www.scala-lang.org/docu/files/ScalaReference.pdf]



> Introduce scala DSL for schedule-triggered routes
> -------------------------------------------------
>
>                 Key: CAMEL-3491
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3491
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-scala
>            Reporter: Pavel Grushetzky
>            Priority: Minor
>         Attachments: schedule-dsl
>
>
> Introduce DSL to generate exchanges
> * periodically, with a defined interval between fires. This is synonymous to [timer component|http://camel.apache.org/timer.html]
> * per cron schedule, just like  [quartz component|http://camel.apache.org/quartz.html] does
> The resulting DSL intends to be a shortcut/replacement to "from" clause for typical schedule-triggered routes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.