camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Behrad <behr...@gmail.com>
Subject Building predicates/routes at runtime
Date Sat, 06 Dec 2014 20:42:45 GMT
This may not be the correct place to share this, but there's no dedicated
akka-camel, or scala-dsl camel community out there, so I ask it here.
I want to build my camel CBR when predicates at run-time based on user
input:
considering my CamelMessage bodies are of case class Book as below

case class Book( author: Person, title: String )
case class Person( name: String, age: Int )

when user inputs "author.name" and "startsWith" and "behrad" I should create

"fromEndpoint" when( _.in.asInstanceOf[Book].author.name.startsWith(
"behrad" ) ) to "actorPath"


I've decided to write when perdicate functions that use Scala's reflection,
or shapless lib to evaluate "author.name" and run "startsWith" on that and
check with the value.
Is this the best solution? or could I anyway take advantage of
PredicateBuilder's of Camel? or any other suggesstions?

-- 
--Behrad

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message