new bean expression language

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

new bean expression language

jstrachan
An issue some folks have hit has been how to write complex expressions
and predicates for non-XML payloads of messages without adding any new
dependency on some expression language like Groovy, EL, OGNL, Ruby
etc.

Well there's always Java :)

Folks could write a new Expression/Predicate class; but that can often
be a tad noisy when used in the DSL (and it doesn't translate too well
to describing routing rules in XML); so to simplify that I've
implemented a simple Bean Language so you can just refer to bean
methods as an expression or predicate...
http://cwiki.apache.org/CAMEL/bean-language.html

it also helps show some of the power of the Bean Integration annotations
http://activemq.apache.org/camel/bean-integration.html

The nice thing about this approach is if you write an expression in
Java code; your code can avoid the use of Camel APIs; namely to be
just business logic style code using whatever classes ou like.

The JIRA for this feature is here btw
http://issues.apache.org/activemq/browse/CAMEL-226

As usual, feedback always appreciated
--
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

Re: new bean expression language

Bruce Snyder
On Nov 16, 2007 9:24 AM, James Strachan <[hidden email]> wrote:

> An issue some folks have hit has been how to write complex expressions
> and predicates for non-XML payloads of messages without adding any new
> dependency on some expression language like Groovy, EL, OGNL, Ruby
> etc.
>
> Well there's always Java :)
>
> Folks could write a new Expression/Predicate class; but that can often
> be a tad noisy when used in the DSL (and it doesn't translate too well
> to describing routing rules in XML); so to simplify that I've
> implemented a simple Bean Language so you can just refer to bean
> methods as an expression or predicate...
> http://cwiki.apache.org/CAMEL/bean-language.html
>
> it also helps show some of the power of the Bean Integration annotations
> http://activemq.apache.org/camel/bean-integration.html
>
> The nice thing about this approach is if you write an expression in
> Java code; your code can avoid the use of Camel APIs; namely to be
> just business logic style code using whatever classes ou like.
>
> The JIRA for this feature is here btw
> http://issues.apache.org/activemq/browse/CAMEL-226
>
> As usual, feedback always appreciated

Are there any full working examples of this new bean expression
language? Docs are never as good as seeing some example code that
actually runs.

Bruce
--
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/
Reply | Threaded
Open this post in threaded view
|

Re: new bean expression language

jstrachan
On 16/11/2007, Bruce Snyder <[hidden email]> wrote:

> On Nov 16, 2007 9:24 AM, James Strachan <[hidden email]> wrote:
> > An issue some folks have hit has been how to write complex expressions
> > and predicates for non-XML payloads of messages without adding any new
> > dependency on some expression language like Groovy, EL, OGNL, Ruby
> > etc.
> >
> > Well there's always Java :)
> >
> > Folks could write a new Expression/Predicate class; but that can often
> > be a tad noisy when used in the DSL (and it doesn't translate too well
> > to describing routing rules in XML); so to simplify that I've
> > implemented a simple Bean Language so you can just refer to bean
> > methods as an expression or predicate...
> > http://cwiki.apache.org/CAMEL/bean-language.html
> >
> > it also helps show some of the power of the Bean Integration annotations
> > http://activemq.apache.org/camel/bean-integration.html
> >
> > The nice thing about this approach is if you write an expression in
> > Java code; your code can avoid the use of Camel APIs; namely to be
> > just business logic style code using whatever classes ou like.
> >
> > The JIRA for this feature is here btw
> > http://issues.apache.org/activemq/browse/CAMEL-226
> >
> > As usual, feedback always appreciated
>
> Are there any full working examples of this new bean expression
> language? Docs are never as good as seeing some example code that
> actually runs.

Good point! :)

Here's a Java DSL test case...
https://svn.apache.org/repos/asf/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MethodFilterTest.java

also we use this in the Aggregator Spring XML test case
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aggregator.xml

I've added these links to the wiki page
http://cwiki.apache.org/CAMEL/bean-language.html
--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com