Interface BeanProxyFactory


public interface BeanProxyFactory
Factory for creating a Proxy facade that routes method invocations to a Camel Endpoint as messages.

The generated proxy implements one or more caller-supplied interfaces. Each method call on the proxy is translated into a Camel Exchange and sent to the configured endpoint, making it straightforward to invoke Camel routes from plain Java code without depending on Camel APIs at the call site. This capability is part of the bean integration feature and requires camel-bean on the classpath; the implementation is loaded via the META-INF service key FACTORY.

When binding is true, multi-parameter methods are mapped using the standard Camel bean-parameter binding algorithm (matching by type, annotation, or position).

Since:
3.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Service factory key.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    createProxy(Endpoint endpoint, boolean binding, Class<T>... interfaceClasses)
    Creates a proxy bean facade with the interfaces that when invoked will send the data as a message to a Camel endpoint.
  • Field Details

  • Method Details

    • createProxy

      <T> T createProxy(Endpoint endpoint, boolean binding, Class<T>... interfaceClasses) throws Exception
      Creates a proxy bean facade with the interfaces that when invoked will send the data as a message to a Camel endpoint.
      Parameters:
      endpoint - the endpoint to send to when the proxy is invoked
      binding - whether to use bean parameter binding which would be needed if invoking a bean method with multiple parameters
      interfaceClasses - the interface(s) to use as bean facade
      Returns:
      the created bean proxy
      Throws:
      Exception - is thrown if error creating the proxy