Versions Compared

Key

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

...

From 1.5 onwards Camel supports annotations for specifying the message exchange pattern on regular Java methods, classes or interfaces.

Specifying InOnly methods

Typically the default InOut is what most folks want but you can customize to use InOnly using an annotation.

...

The above code shows three methods on an interface; the first two use the default InOut mechanism but the someInOnlyMethod uses the InOnly annotation to specify it as being a oneway method call.

Class level annotations

You can also use class level annotations to default all methods in an interface to some pattern such as

Code Block
java
java

@InOnly
public interface Foo {
  void someInOnlyMethod(Document input);
  void anotherInOnlyMethod(String input);
}

Annotations will also be detected on base classes or interfaces. So for example if you created a client side proxy for

Code Block
java
java

public class MyFoo implements Foo {
  ...
}

Then the methods inherited from Foo would be InOnly.

Overloading a class level annotation

You can overload a class level annotation on specific methods. A common use case for this is if you have a class or interface with many InOnly methods but you want to just annote one or two methods as InOut

Code Block
java
java

@InOnly
public interface Foo {
  void someInOnlyMethod(Document input);
  void anotherInOnlyMethod(String input);
  
  @InOut
  void 
}