[
https://issues.apache.org/jira/browse/CAMEL-7725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103034#comment-14103034
]
Edin Hodzic commented on CAMEL-7725:
------------------------------------
Patch attached. This is my first patch on the project, didn't write a unit test
but below is some code exercising the functionality.
{code:title=Main.scala}
object Main {
import org.apache.camel.impl.DefaultCamelContext
def main(args: Array[String]) {
val context = new DefaultCamelContext
context.addRoutes(new MyRoute("one", 3))
context.addRoutes(new MyRoute("two", 2))
context.addRoutes(new MyRoute("three", 1))
context.start
}
import org.apache.camel.scala.dsl.builder.RouteBuilder
class MyRoute(id: String, startupOrder: Int) extends RouteBuilder {
s"direct:$id" ==> {
id(id)
startupOrder(startupOrder) // this is now available
to("mock:end")
}
}
}
{code}
And the output is:
{noformat}
[main] INFO DefaultCamelContext - Apache Camel 2.14-SNAPSHOT (CamelContext:
camel-1) is starting
[main] INFO ManagedManagementStrategy - JMX is enabled
[main] INFO DefaultTypeConverter - Loaded 219 type converters
[main] INFO DefaultCamelContext - AllowUseOriginalMessage is enabled. If access
to the original message is not needed, then its recommended to turn this option
off as it may improve performance.
[main] INFO DefaultCamelContext - StreamCaching is not in use. If using streams
then its recommended to enable stream caching. See more details at
http://camel.apache.org/stream-caching.html
[main] INFO DefaultCamelContext - Route: three started and consuming from:
Endpoint[direct://three]
[main] INFO DefaultCamelContext - Route: two started and consuming from:
Endpoint[direct://two]
[main] INFO DefaultCamelContext - Route: one started and consuming from:
Endpoint[direct://one]
[main] INFO DefaultCamelContext - Total 3 routes, of which 3 is started.
[main] INFO DefaultCamelContext - Apache Camel 2.14-SNAPSHOT (CamelContext:
camel-1) started in 0.430 seconds
{noformat}
> camel-scala - Startup order not available in Scala DSL
> ------------------------------------------------------
>
> Key: CAMEL-7725
> URL: https://issues.apache.org/jira/browse/CAMEL-7725
> Project: Camel
> Issue Type: Bug
> Components: camel-scala
> Affects Versions: 2.13.2
> Reporter: Edin Hodzic
> Priority: Critical
> Attachments: camel-7725-patch.txt
>
>
> The
> [{{startupOrder}}|http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html]
> method is missing from the Scala DSL.
> {code:title=MyRoute.scala}
> import org.apache.camel.scala.dsl.builder.RouteBuilder
> class MyRoute extends RouteBuilder {
> "direct:start" ==> {
> startupOrder(1) // this is not available
> to("mock:end")
> }
> }
> {code}
> This is an important piece of functionality to have for any non-trivial route
> integration.
--
This message was sent by Atlassian JIRA
(v6.2#6252)