Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

...

DSL

...

or

...

the

...

Spring

...

XML

...

configuration

...

file.

...

For

...

example

Code Block


from(uri).beanRef("myBean", "methodName");

...

code




which

...

will

...

then

...

look

...

up

...

in

...

the

...

Registry

...

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");

...

code

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.

...