This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8f6d701ea1c6c999e94191cbd6a973e51be077a7 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Feb 13 15:06:56 2021 +0100 CAMEL-16170: Modularize camel-spring --- .../src/main/java/org/apache/camel/InOnly.java | 3 +- .../src/main/java/org/apache/camel/InOut.java | 3 +- .../src/main/java/org/apache/camel/Pattern.java | 3 +- docs/user-manual-nav.adoc.template | 1 - docs/user-manual/modules/ROOT/nav.adoc | 1 - .../modules/ROOT/pages/bean-injection.adoc | 3 +- .../modules/ROOT/pages/bean-integration.adoc | 3 +- .../modules/ROOT/pages/hiding-middleware.adoc | 10 +- .../modules/ROOT/pages/pojo-producing.adoc | 3 +- .../modules/ROOT/pages/spring-remoting.adoc | 522 --------------------- .../pages/using-exchange-pattern-annotations.adoc | 3 +- 11 files changed, 8 insertions(+), 547 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/InOnly.java b/core/camel-api/src/main/java/org/apache/camel/InOnly.java index be270f3..69088ae 100644 --- a/core/camel-api/src/main/java/org/apache/camel/InOnly.java +++ b/core/camel-api/src/main/java/org/apache/camel/InOnly.java @@ -24,8 +24,7 @@ import java.lang.annotation.Target; /** * Marks methods as being {@link ExchangePattern#InOnly} for one way asynchronous invocation when using - * <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a> or - * <a href="http://camel.apache.org/spring-remoting.html">Spring Remoting</a> to overload the default value which is + * <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a> to overload the default value which is * {@link ExchangePattern#InOut} for request/reply if no annotations are used. * * This annotation can be added to individual methods or added to a class or interface to act as a default for all diff --git a/core/camel-api/src/main/java/org/apache/camel/InOut.java b/core/camel-api/src/main/java/org/apache/camel/InOut.java index d4a2343..8f7479a 100644 --- a/core/camel-api/src/main/java/org/apache/camel/InOut.java +++ b/core/camel-api/src/main/java/org/apache/camel/InOut.java @@ -24,8 +24,7 @@ import java.lang.annotation.Target; /** * Marks a method as being {@link ExchangePattern#InOut} when a class or interface has been annotated with - * {@link InOnly} when using <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a> or - * <a href="http://camel.apache.org/spring-remoting.html">Spring Remoting</a>. + * {@link InOnly} when using <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a>. * * This annotation is only intended to be used on methods which the class or interface has been annotated with a default * exchange pattern annotation such as {@link InOnly} or {@link Pattern} diff --git a/core/camel-api/src/main/java/org/apache/camel/Pattern.java b/core/camel-api/src/main/java/org/apache/camel/Pattern.java index 31b0d9b..70fdc55 100644 --- a/core/camel-api/src/main/java/org/apache/camel/Pattern.java +++ b/core/camel-api/src/main/java/org/apache/camel/Pattern.java @@ -24,8 +24,7 @@ import java.lang.annotation.Target; /** * Marks a method as having a specific kind of {@link ExchangePattern} for use with - * <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a> or - * <a href="http://camel.apache.org/spring-remoting.html">Spring Remoting</a> to overload the default value which is + * <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a> to overload the default value which is * {@link ExchangePattern#InOut} for request/reply if no annotations are used. * * There are abbreviation annotations like {@link InOnly} or {@link InOut} which are typically used for the common diff --git a/docs/user-manual-nav.adoc.template b/docs/user-manual-nav.adoc.template index 13efd99..791f1ec 100644 --- a/docs/user-manual-nav.adoc.template +++ b/docs/user-manual-nav.adoc.template @@ -42,7 +42,6 @@ ** xref:routes.adoc[Routes] ** xref:transformer.adoc[Transformer] ** xref:validator.adoc[Validator] - ** xref:spring-remoting.adoc[Spring Remoting] ** xref:hiding-middleware.adoc[Hiding Middleware] ** xref:health-check.adoc[Health Checks] * Domain Specific Languages diff --git a/docs/user-manual/modules/ROOT/nav.adoc b/docs/user-manual/modules/ROOT/nav.adoc index 3096dd6..e736f36 100644 --- a/docs/user-manual/modules/ROOT/nav.adoc +++ b/docs/user-manual/modules/ROOT/nav.adoc @@ -97,7 +97,6 @@ ** xref:uris.adoc[URIs] ** xref:uuidgenerator.adoc[UuidGenerator] ** xref:validator.adoc[Validator] -** xref:spring-remoting.adoc[Spring Remoting] ** xref:hiding-middleware.adoc[Hiding Middleware] ** xref:health-check.adoc[Health Checks] * Domain Specific Languages diff --git a/docs/user-manual/modules/ROOT/pages/bean-injection.adoc b/docs/user-manual/modules/ROOT/pages/bean-injection.adoc index d698e91..948c06b 100644 --- a/docs/user-manual/modules/ROOT/pages/bean-injection.adoc +++ b/docs/user-manual/modules/ROOT/pages/bean-injection.adoc @@ -9,8 +9,7 @@ when used with xref:components::mock-component.adoc[Mock] endpoints; see the xref:spring-testing.adoc[Spring Testing] for an example. * xref:producertemplate.adoc[ProducerTemplate] instances for xref:pojo-producing.adoc[POJO Producing] -* client side proxies for xref:pojo-producing.adoc[POJO Producing] which -is a simple approach to xref:spring-remoting.adoc[Spring Remoting] +* client side proxies for xref:pojo-producing.adoc[POJO Producing] [[BeanInjection-Using-BeanInject]] == Using @BeanInject diff --git a/docs/user-manual/modules/ROOT/pages/bean-integration.adoc b/docs/user-manual/modules/ROOT/pages/bean-integration.adoc index 551b20c..1b04820 100644 --- a/docs/user-manual/modules/ROOT/pages/bean-integration.adoc +++ b/docs/user-manual/modules/ROOT/pages/bean-integration.adoc @@ -70,8 +70,7 @@ headers and so forth. *Bean binding* Whenever Camel invokes a bean method via one of the above methods -(xref:components::bean-component.adoc[Bean] component, xref:spring-remoting.adoc[Spring -Remoting] or POJO Consuming) then the +(xref:components::bean-component.adoc[Bean] component, or POJO Consuming) then the *Bean Binding* mechanism is used to figure out what method to use (if it is not explicit) and how to bind the Message to the parameters possibly using the diff --git a/docs/user-manual/modules/ROOT/pages/hiding-middleware.adoc b/docs/user-manual/modules/ROOT/pages/hiding-middleware.adoc index 2c683b2..8c7756e 100644 --- a/docs/user-manual/modules/ROOT/pages/hiding-middleware.adoc +++ b/docs/user-manual/modules/ROOT/pages/hiding-middleware.adoc @@ -30,15 +30,7 @@ bean / table as a queue [[HidingMiddleware-HowtodecouplefrommiddlewareAPIs]] == How to decouple from middleware APIs -The best approach when using remoting is to use -xref:spring-remoting.adoc[Spring Remoting] which can then use any -messaging or remoting technology under the covers. When using Camel's -implementation you can then use any of the Camel -xref:components::index.adoc[Components] along with any of the -xref:{eip-vc}:eips:enterprise-integration-patterns.adoc[Enterprise Integration -Patterns]. - -Another approach is to bind Java beans to Camel endpoints via the +You can bind Java beans to Camel endpoints via the xref:bean-integration.adoc[Bean Integration]. For example using xref:pojo-consuming.adoc[POJO Consuming] and xref:pojo-producing.adoc[POJO Producing] you can avoid using any Camel diff --git a/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc b/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc index de2d2a7..2c37a43 100644 --- a/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc +++ b/docs/user-manual/modules/ROOT/pages/pojo-producing.adoc @@ -67,8 +67,7 @@ public class MyBean { Here Camel will automatically inject a smart client side proxy at the *`@Produce`* annotation - an instance of the *`MyListener`* instance. When we invoke methods on this interface the method call is -turned into an object and using the Camel -xref:spring-remoting.adoc[Spring Remoting] mechanism it is sent to the +turned into an object and it is sent to the endpoint - in this case the xref:components::activemq-component.adoc[ActiveMQ] endpoint to queue *`foo`*; then the caller blocks for a response. diff --git a/docs/user-manual/modules/ROOT/pages/spring-remoting.adoc b/docs/user-manual/modules/ROOT/pages/spring-remoting.adoc deleted file mode 100644 index 22aff9b..0000000 --- a/docs/user-manual/modules/ROOT/pages/spring-remoting.adoc +++ /dev/null @@ -1,522 +0,0 @@ -[[SpringRemoting-SpringRemoting]] -= Spring Remoting - -We support Spring Remoting in Camel. The implementing of Spring Remoting uses Camel as -the underlying transport mechanism. The nice thing about this approach -is we can use any of the Camel transport -xref:components::index.adoc[Components] to communicate between beans. - -It also means we can use xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based -Router] and the other -xref:{eip-vc}:eips:enterprise-integration-patterns.adoc[Enterprise Integration -Patterns] in between the beans; in particular we can use -xref:{eip-vc}:eips:message-translator.adoc[Message Translator] to be able to convert -what the on-the-wire messages look like in addition to adding various -headers and so forth. - -[[SpringRemoting-UsingCamelSpringRemoting]] -== Using Camel Spring Remoting - -In your Spring XML just use the -`org.apache.camel.spring.remoting.CamelProxyFactoryBean` -to create a client side proxy implementing some interface which then -sends messages to some remote Camel xref:endpoint.adoc[Endpoint] such as -xref:components::activemq-component.adoc[ActiveMQ], xref:components::jms-component.adoc[JMS], xref:components::file-component.adoc[File], -xref:components::http-component.adoc[HTTP], xref:components::xmpp-component.adoc[XMPP] etc. - -Then to implement the service you use -`org.apache.camel.spring.remoting.CamelServiceExporter`. - -The following -https://github.com/apache/camel/blob/master/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter.xml[example] -shows how to create a proxy which when invoked with fire a message to -the *direct:say* endpoint - -Error rendering macro 'code': Invalid value specified for parameter -'java.lang.NullPointerException' - -.... -<!-- Creates a proxy to the direct:say endpoint. --> -<bean id="sayProxy" class="org.apache.camel.spring.remoting.CamelProxyFactoryBean"> - <property name="serviceUrl" value="direct:say"/> - <property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/> - <property name="binding" value="true"/> -</bean> -.... - -Then we expose the service on an endpoint so that messages from -*direct:sayImpl* will be dispatched to the service (note that we have a -route in between these two endpoints). - -Error rendering macro 'code': Invalid value specified for parameter -'java.lang.NullPointerException' - -.... -<!-- Exposes the above bean as via the pojo:say endpoint --> -<bean id="say" class="org.apache.camel.spring.remoting.CamelServiceExporter"> - <property name="uri" value="direct:sayImpl"/> - <property name="service"> - <bean class="org.apache.camel.spring.remoting.SayService"/> - </property> - <property name="method" value="say"/> - <property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/> -</bean> -.... - -[[SpringRemoting-UsingCustomNamespaces]] -== Using Custom Namespaces - -In -https://github.com/apache/camel/blob/master/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-namespace.xml[this -example] we use the Camel custom namespaces to make the XML much more -concise. First, create a proxy via the proxy element - -Error rendering macro 'code': Invalid value specified for parameter -'java.lang.NullPointerException' - -.... -<!-- Creates a proxy to the direct:say endpoint. --> -<camel:proxy id="sayProxy" serviceUrl="direct:say" - serviceInterface="org.apache.camel.spring.remoting.ISay"/> -.... - -Then we expose the service via the export element - -Error rendering macro 'code': Invalid value specified for parameter -'java.lang.NullPointerException' - -.... -<camel:export id="say" uri="direct:sayImpl" serviceRef="sayService" method="say" - serviceInterface="org.apache.camel.spring.remoting.ISay"/> -<!-- - The bean is defined out side of the camel - <bean id="sayService" class="org.apache.camel.spring.remoting.SayService"/> ---> -.... - -Its much cleaner - use whichever approach you prefer as they are both -equivalent. - -[[SpringRemoting-ServiceExporterisOptional]] -== ServiceExporter is Optional - -Note that the service is not mandatory; since the xref:bean-binding.adoc[Bean] -component and the various other forms of xref:bean-integration.adoc[Bean -Integration] can be used to route any message exchange to a bean, so you -can miss out the serviceExporter if you prefer. The main value of the -service exporter is its a single XML element to bind a URI to a bean and -it allows the full API of the bean to be restricted by a -serviceInterface. - -[[SpringRemoting-WorkingwithInOnlymethodcalls]] -== Working with InOnly method calls - -As of 1.5 Camel supports the @InOnly and @Pattern annotations to let you -specify which methods are not InOut (xref:{eip-vc}:eips:requestReply-eip.adoc[Request -Reply]) but are InOnly (oneway or fire and forget -xref:{eip-vc}:eips:event-message.adoc[Event Message]). - -For more details see xref:using-exchange-pattern-annotations.adoc[Using -Exchange Pattern Annotations] - -[[SpringRemoting-BeanBinding]] -== Bean Binding - -Bean Binding in Camel defines both which methods are invoked and also -how the xref:{eip-vc}:eips:message.adoc[Message] is converted into the parameters of -the method when it is invoked. - -[[SpringRemoting-Choosingthemethodtoinvoke]] -== Choosing the method to invoke - -The binding of a Camel xref:{eip-vc}:eips:message.adoc[Message] to a bean method call -can occur in different ways, in the following order of importance: - -* if the message contains the header *CamelBeanMethodName* then that -method is invoked, converting the body to the type of the method's -argument. -** From *Camel 2.8* onwards you can qualify parameter types to select -exactly which method to use among overloads with the same name (see -below for more details). -** From *Camel 2.9* onwards you can specify parameter values directly in -the method option (see below for more details). -* you can explicitly specify the method name in the xref:dsl.adoc[DSL] -or when using xref:pojo-consuming.adoc[POJO Consuming] or -xref:pojo-producing.adoc[POJO Producing] -* if the bean has a method marked with the `@Handler` annotation, then -that method is selected -* if the bean can be converted to a xref:processor.adoc[Processor] using -the xref:type-converter.adoc[Type Converter] mechanism, then this is -used to process the message. The xref:components::activemq-component.adoc[ActiveMQ] component -uses this mechanism to allow any JMS MessageListener to be invoked -directly by Camel without having to write any integration glue code. You -can use the same mechanism to integrate Camel into any other -messaging/remoting frameworks. -* if the body of the message can be converted to a -`org.apache.camel.component.bean.BeanInvocation` -(the default payload used by the -`org.apache.camel.component.bean.ProxyHelper`) -component - then that is used to invoke the method and pass its -arguments -* otherwise the type of the body is used to find a matching method; an -error is thrown if a single method cannot be chosen unambiguously. -* you can also use Exchange as the parameter itself, but then the return -type must be void. -* if the bean class is private (or package-private), interface methods -will be preferred (from *Camel 2.9* onwards) since Camel can't invoke -class methods on such beans - -In cases where Camel cannot choose a method to invoke, an -`AmbiguousMethodCallException` is thrown. - -By default the return value is set on the outbound message body. - -[[SpringRemoting-Asynchronousprocessing]] -== Asynchronous processing - -From *Camel 2.18* onwards you can return a CompletionStage -implementation (e.g. a CompletableFuture) to implement asynchronous -processing. - -Please be sure to properly complete the CompletionStage with the result -or exception, including any timeout handling. Exchange processing would -wait for completion and would not impose any timeouts automatically. -It's extremely useful to -monitor `org.apache.camel.spi.InflightRepository` for any hanging messages. - -Note that completing with "null" won't set outbody message body to null, -but would keep message intact. This is useful to support methods that -don't modify exchange and return CompletableFuture<Void>. To set body to -null, just add Exchange method parameter and directly modify exchange -messages. - -Examples: - -Simple asynchronous processor, modifying message body. - -[source,syntaxhighlighter-pre] ----- -public CompletableFuture<String> doSomethingAsync(String body) ----- - -Composite processor that do not modify exchange - -[source,syntaxhighlighter-pre] ----- - public CompletableFuture<Void> doSomethingAsync(String body) { - return CompletableFuture.allOf(doA(body), doB(body), doC()); - } ----- - -[[SpringRemoting-Parameterbinding]] -== Parameter binding - -When a method has been chosen for invocation, Camel will bind to the -parameters of the method. - -The following Camel-specific types are automatically bound: - -* `org.apache.camel.Exchange` -* `org.apache.camel.Message` -* `org.apache.camel.CamelContext` -* `org.apache.camel.TypeConverter` -* `org.apache.camel.spi.Registry` -* `java.lang.Exception` - -So, if you declare any of these types, they will be provided by Camel. -*Note that `Exception` will bind to the caught exception of the -xref:exchange.adoc[Exchange]* - so it's often usable if you employ a -xref:components::bean-component.adoc[Bean] to handle, e.g., an `onException` route. - -What is most interesting is that Camel will also try to bind the body of -the xref:exchange.adoc[Exchange] to the first parameter of the method -signature (albeit not of any of the types above). So if, for instance, -we declare a parameter as `String body`, then Camel will bind the IN -body to this type. Camel will also automatically convert to the type -declared in the method signature. - -Let's review some examples: - -Below is a simple method with a body binding. Camel will bind the IN -body to the `body` parameter and convert it to a `String`. - -[source,syntaxhighlighter-pre] ----- -public String doSomething(String body) ----- - -In the following sample we got one of the automatically-bound types as -well - for instance, a `Registry` that we can use to lookup beans. - -[source,syntaxhighlighter-pre] ----- -public String doSomething(String body, Registry registry) ----- - -We can use xref:exchange.adoc[Exchange] as well: - -[source,syntaxhighlighter-pre] ----- -public String doSomething(String body, Exchange exchange) ----- - -You can also have multiple types: - -[source,syntaxhighlighter-pre] ----- -public String doSomething(String body, Exchange exchange, TypeConverter converter) ----- - -And imagine you use a xref:components::bean-component.adoc[Pojo] to handle a given custom -exception `InvalidOrderException` - we can then bind that as well: - -[source,syntaxhighlighter-pre] ----- -public String badOrder(String body, InvalidOrderException invalid) ----- - -Notice that we can bind to it even if we use a sub type of -`java.lang.Exception` as Camel still knows it's an exception and can -bind the cause (if any exists). - -So what about headers and other stuff? Well now it gets a bit tricky - -so we can use annotations to help us, or specify the binding in the -method name option. -See the following sections for more detail. - -[[SpringRemoting-BindingAnnotations]] -== Binding Annotations - -You can use the xref:parameter-binding-annotations.adoc[Parameter -Binding Annotations] to customize how parameter values are created from -the xref:{eip-vc}:eips:message.adoc[Message] - -[[SpringRemoting-Examples]] -=== Examples - -For example, a xref:components::bean-component.adoc[Bean] such as: - -[source,syntaxhighlighter-pre] ----- -public class Bar { - public String doSomething(String body) { - // process the in body and return whatever you want - return "Bye World"; -} ----- - -Or the Exchange example. Notice that the return type must be *void* when -there is only a single parameter of the type -`org.apache.camel.Exchange`: - -[source,syntaxhighlighter-pre] ----- - public class Bar { - public void doSomething(Exchange exchange) { - // process the exchange - exchange.getIn().setBody("Bye World"); - } ----- - -[[SpringRemoting-Handler]] -=== @Handler - -You can mark a method in your bean with the `@Handler` annotation to -indicate that this method should be used for xref:bean-binding.adoc[Bean -Binding]. -This has an advantage as you need not specify a method name in the Camel -route, and therefore do not run into problems after renaming the method -in an IDE that can't find all its references. - -[source,syntaxhighlighter-pre] ----- -public class Bar { - @Handler - public String doSomething(String body) { - // process the in body and return whatever you want - return "Bye World"; - } -} ----- - -[[SpringRemoting-Parameterbindingusingmethodoption]] -=== Parameter binding using method option - -*Since Camel 2.9* - -Camel uses the following rules to determine if it's a parameter value in -the method option - -* The value is either `true` or `false` which denotes a boolean value -* The value is a numeric value such as `123` or `7` -* The value is a String enclosed with either single or double quotes -* The value is null which denotes a `null` value -* It can be evaluated using the xref:components:languages:simple-language.adoc[Simple] language, which -means you can use, e.g., body, header.foo and other -xref:components:languages:simple-language.adoc[Simple] tokens. Notice the tokens must be enclosed with -${ }. - -Any other value is consider to be a type declaration instead - see the -next section about specifying types for overloaded methods. - -When invoking a xref:{eip-vc}:eips:bean-eip.adoc[Bean] you can instruct Camel to invoke a -specific method by providing the method name: - -[source,syntaxhighlighter-pre] ----- -.bean(OrderService.class, "doSomething") ----- - -Here we tell Camel to invoke the doSomething method - Camel handles the -parameters' binding. Now suppose the method has 2 parameters, and the -2nd parameter is a boolean where we want to pass in a true value: - -[source,syntaxhighlighter-pre] ----- -public void doSomething(String payload, boolean highPriority) { - ... -} ----- - - - -This is now possible in *Camel 2.9* onwards: - -[source,syntaxhighlighter-pre] ----- -.bean(OrderService.class, "doSomething(*, true)") ----- - -In the example above, we defined the first parameter using the wild card -symbol *, which tells Camel to bind this parameter to any type, and let -Camel figure this out. The 2nd parameter has a fixed value of `true`. -Instead of the wildcard symbol we can instruct Camel to use the message -body as shown: - -[source,syntaxhighlighter-pre] ----- -.bean(OrderService.class, "doSomething(${body}, true)") ----- - -The syntax of the parameters is using the xref:components:languages:simple-language.adoc[Simple] -expression language so we have to use ${ } placeholders in the body to -refer to the message body. - -If you want to pass in a `null` value, then you can explicit define this -in the method option as shown below: - -[source,syntaxhighlighter-pre] ----- -.to("bean:orderService?method=doSomething(null, true)") ----- - -Specifying `null` as a parameter value instructs Camel to force passing -a `null` value. - -Besides the message body, you can pass in the message headers as a -`java.util.Map`: - -[source,syntaxhighlighter-pre] ----- -.bean(OrderService.class, "doSomethingWithHeaders(${body}, ${headers})") ----- - -You can also pass in other fixed values besides booleans. For example, -you can pass in a String and an integer: - -[source,syntaxhighlighter-pre] ----- -.bean(MyBean.class, "echo('World', 5)") ----- - -In the example above, we invoke the echo method with two parameters. The -first has the content 'World' (without quotes), and the 2nd has the -value of 5. + -Camel will automatically convert these values to the parameters' types. - -Having the power of the xref:components:languages:simple-language.adoc[Simple] language allows us to -bind to message headers and other values such as: - -[source,syntaxhighlighter-pre] ----- -.bean(OrderService.class, "doSomething(${body}, ${header.high})") ----- - -You can also use the OGNL support of the xref:components:languages:simple-language.adoc[Simple] -expression language. Now suppose the message body is an object which has -a method named `asXml`. To invoke the `asXml` method we can do as -follows: - -[source,syntaxhighlighter-pre] ----- -.bean(OrderService.class, "doSomething(${body.asXml}, ${header.high})") ----- - -Instead of using `.bean` as shown in the examples above, you may want to -use `.to` instead as shown: - -[source,syntaxhighlighter-pre] ----- -.to("bean:orderService?method=doSomething(${body.asXml}, ${header.high})") ----- - -[[SpringRemoting-Usingtypequalifierstoselectamongoverloadedmethods]] -=== Using type qualifiers to select among overloaded methods - -*Since Camel 2.8* - -If you have a xref:{eip-vc}:eips:bean-eip.adoc[Bean] with overloaded methods, you can now -specify parameter types in the method name so Camel can match the method -you intend to use. - -Given the following bean: - -[source,syntaxhighlighter-pre] ----- - from("direct:start") - .bean(MyBean.class, "hello(String)") - .to("mock:result"); ----- - -Then the `MyBean` has 2 overloaded methods with the names `hello` and -`times`. So if we want to use the method which has 2 parameters we can -do as follows in the Camel route: - -[source,syntaxhighlighter-pre] ----- -from("direct:start") - .bean(MyBean.class, "hello(String,String)") - .to("mock:result"); ----- - -We can also use a `*` as wildcard so we can just say we want to execute -the method with 2 parameters we do - -[source,syntaxhighlighter-pre] ----- - from("direct:start") - .bean(MyBean.class, "hello(*,*)") - .to("mock:result"); ----- - -By default Camel will match the type name using the simple name, e.g. -any leading package name will be disregarded. However if you want to -match using the FQN, then specify the FQN type and Camel will leverage -that. So if you have a `com.foo.MyOrder` and you want to match against -the FQN, and *not* the simple name "MyOrder", then follow this example: - -[source,syntaxhighlighter-pre] ----- -.bean(OrderService.class, "doSomething(com.foo.MyOrder)") ----- - -Camel currently only supports either specifying parameter binding or -type per parameter in the method name option. You *cannot* specify both -at the same time, such as - -[source,syntaxhighlighter-pre] ----- - doSomething(com.foo.MyOrder ${body}, boolean ${header.high}) ----- - -This may change in the future. diff --git a/docs/user-manual/modules/ROOT/pages/using-exchange-pattern-annotations.adoc b/docs/user-manual/modules/ROOT/pages/using-exchange-pattern-annotations.adoc index 44abd03..bc9f584 100644 --- a/docs/user-manual/modules/ROOT/pages/using-exchange-pattern-annotations.adoc +++ b/docs/user-manual/modules/ROOT/pages/using-exchange-pattern-annotations.adoc @@ -1,8 +1,7 @@ [[UsingExchangePatternAnnotations-UsingExchangePatternAnnotations]] = Using Exchange Pattern Annotations -When working with xref:pojo-producing.adoc[POJO Producing] or -xref:spring-remoting.adoc[Spring Remoting] you invoke methods which +When working with xref:pojo-producing.adoc[POJO Producing] you invoke methods which typically by default are InOut for xref:{eip-vc}:eips:requestReply-eip.adoc[Request Reply]. That is there is an In message and an Out for the result. Typically invoking this operation will be synchronous, the caller will