...
In the above Foo interface the someInOutMethod will be InOut
Using your own annotations
You might want to create your own annotations to represent a group of different bits of metadata; such as combining synchrony, concurrency and transaction behaviour.
So you could annotate your annotation with the @Pattern annotation to default the exchange pattern you wish to use.
For example lets say we want to create our own annotation called MyAsyncService
Code Block | ||||
---|---|---|---|---|
| ||||
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
// lets add the message exchange pattern to it
@Pattern(ExchangePattern.InOnly)
// lets add some other annotations - maybe transaction behaviour?
public @interface MyAsyncService {
}
|
Now we can use this annotation and Camel will figure out the correct exchange pattern...
Code Block | ||||
---|---|---|---|---|
| ||||
public interface Foo {
void someInOnlyMethod(Document input);
void anotherInOnlyMethod(String input);
@MyAsyncService
String someInOutMethod(String input);
}
|