...
Code Block |
---|
public class Foo {
@MessageDriven(uri="activemq:cheese")
public void onCheese(String name) {
...
}
}
h4. |
Using
...
an
...
explicit
...
route
...
If
...
you
...
want
...
to
...
invoke
...
a
...
bean
...
method
...
from
...
many
...
different
...
endpoints
...
or
...
within
...
different
...
complex
...
routes
...
in
...
different
...
circumstances
...
you
...
can
...
just
...
use
...
the
...
normal
...
routing
...
...
or
...
the
...
...
XML
...
configuration
...
file.
...
For
...
example
Code Block |
---|
from(uri).beanRef("myBean", "methodName"); |
...
which
...
will
...
then
...
look
...
up
...
in
...
the
...
...
and
...
find
...
the
...
bean
...
and
...
invoke
...
the
...
given
...
bean
...
name.
...
(You
...
can
...
omit
...
the
...
method
...
name
...
and
...
have
...
Camel
...
figure
...
out
...
the
...
right
...
method
...
based
...
on
...
the
...
method
...
annotations
...
and
...
body
...
type).
...
Use
...
the
...
Bean
...
endpoint
...
You
...
can
...
always
...
use
...
the
...
bean
...
endpoint
Code Block |
---|
from(uri).to("bean:myBean/methodName"); |
...
|
Which approach to use?
Using the @MessageDriven/@Consume annotations are simpler when you are creating a simple route with a single well defined input URI.
...