--- apiVersion: v1 kind: List items: - apiVersion: v1 kind: ConfigMap metadata: labels: funktion.fabric8.io/kind: Connector provider: fabric8 project: connector-ejb version: 1.1.23 group: io.fabric8.funktion.connector name: ejb data: deployment.yml: | --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: funktion.fabric8.io/kind: Subscription connector: ejb spec: replicas: 1 template: metadata: labels: funktion.fabric8.io/kind: Subscription connector: ejb spec: containers: - image: fabric8/connector-ejb:1.1.23 name: connector schema.yml: | --- component: kind: component scheme: ejb syntax: ejb:beanName title: EJB description: The ejb component is for invoking EJB Java beans from Camel. label: endpoint,java deprecated: false async: false producerOnly: true javaType: org.apache.camel.component.ejb.EjbComponent groupId: org.apache.camel artifactId: camel-ejb version: 2.18.1 componentProperties: context: kind: property type: object javaType: javax.naming.Context deprecated: false secret: false description: The Context to use for looking up the EJBs properties: kind: property type: object javaType: java.util.Properties deprecated: false secret: false description: Properties for creating javax.naming.Context if a context has not been configured. properties: beanName: kind: path group: producer required: true type: string javaType: java.lang.String deprecated: false secret: false description: Sets the name of the bean to invoke method: kind: parameter group: producer type: string javaType: java.lang.String deprecated: false secret: false description: Sets the name of the method to invoke on the bean cache: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: If enabled Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. multiParameterArray: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: true secret: false defaultValue: false description: 'How to treat the parameters which are passed from the message body.true means the message body should be an array of parameters. Note: This option is used internally by Camel and is not intended for end users to use.' parameters: kind: parameter group: advanced label: advanced type: object javaType: java.util.Map prefix: bean. multiValue: true deprecated: false secret: false description: Used for configuring additional properties on the bean synchronous: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). documentation.adoc: "[[EJB-EJBComponent]]\nEJB Component\n~~~~~~~~~~~~~\n\n*Available\ \ as of Camel 2.4*\n\nThe *ejb:* component binds EJBs to Camel message exchanges.\n\ \nMaven users will need to add the following dependency to their `pom.xml`\n\ for this component:\n\n[source,xml]\n------------------------------------------------------------\n\ \n org.apache.camel\n camel-ejb\n\ \ x.x.x\n \n\n------------------------------------------------------------\n\ \n[[EJB-URIformat]]\nURI format\n^^^^^^^^^^\n\n[source,java]\n---------------------\n\ ejb:ejbName[?options]\n---------------------\n\nWhere *ejbName* can be any string\ \ which is used to look up the EJB in\nthe Application Server JNDI link:registry.html[Registry]\n\ \n[[EJB-Options]]\nOptions\n^^^^^^^\n\n\n\n// component options: START\nThe\ \ EJB component supports 2 options which are listed below.\n\n\n\n{% raw %}\n\ [width=\"100%\",cols=\"2,1m,7\",options=\"header\"]\n|=======================================================================\n\ | Name | Java Type | Description\n| context | Context | The Context to use for\ \ looking up the EJBs\n| properties | Properties | Properties for creating javax.naming.Context\ \ if a context has not been configured.\n|=======================================================================\n\ {% endraw %}\n// component options: END\n\n\n\n\n// endpoint options: START\n\ The EJB component supports 6 endpoint options which are listed below:\n\n{%\ \ raw %}\n[width=\"100%\",cols=\"2,1,1m,1m,5\",options=\"header\"]\n|=======================================================================\n\ | Name | Group | Default | Java Type | Description\n| beanName | producer |\ \ | String | *Required* Sets the name of the bean to invoke\n| method | producer\ \ | | String | Sets the name of the method to invoke on the bean\n| cache |\ \ advanced | false | boolean | If enabled Camel will cache the result of the\ \ first Registry look-up. Cache can be enabled if the bean in the Registry is\ \ defined as a singleton scope.\n| multiParameterArray | advanced | false |\ \ boolean | How to treat the parameters which are passed from the message body.true\ \ means the message body should be an array of parameters. Note: This option\ \ is used internally by Camel and is not intended for end users to use.\n| parameters\ \ | advanced | | Map | Used for configuring additional properties on the bean\n\ | synchronous | advanced | false | boolean | Sets whether synchronous processing\ \ should be strictly used or Camel is allowed to use asynchronous processing\ \ (if supported).\n|=======================================================================\n\ {% endraw %}\n// endpoint options: END\n\n\n[[EJB-BeanBinding]]\nBean Binding\n\ ^^^^^^^^^^^^\n\nHow bean methods to be invoked are chosen (if they are not specified\n\ explicitly through the *method* parameter) and how parameter values are\nconstructed\ \ from the link:message.html[Message] are all defined by the\nlink:bean-binding.html[Bean\ \ Binding] mechanism which is used throughout\nall of the various link:bean-integration.html[Bean\ \ Integration]\nmechanisms in Camel.\n\n[[EJB-Examples]]\nExamples\n^^^^^^^^\n\ \nIn the following examples we use the Greater EJB which is defined as\nfollows:\n\ \n*GreaterLocal.java*\n\n[source,java]\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ public interface GreaterLocal {\n \n String hello(String name);\n \n String\ \ bye(String name);\n \n}\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \nAnd the implementation\n\n*GreaterImpl.java*\n\n[source,java]\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ @Stateless\npublic class GreaterImpl implements GreaterLocal {\n \n public\ \ String hello(String name) {\n return \"Hello \" + name;\n }\n \n\ \ public String bye(String name) {\n return \"Bye \" + name;\n \ \ }\n \n}\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \n[[EJB-UsingJavaDSL]]\nUsing Java DSL\n++++++++++++++\n\nIn this example we\ \ want to invoke the `hello` method on the EJB. Since\nthis example is based\ \ on an unit test using Apache OpenEJB we have to\nset a `JndiContext` on the\ \ link:ejb.html[EJB] component with the OpenEJB\nsettings.\n\n[source,java]\n\ -------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ @Override\nprotected CamelContext createCamelContext() throws Exception {\n\ \ CamelContext answer = new DefaultCamelContext();\n \n // enlist EJB\ \ component using the JndiContext\n EjbComponent ejb = answer.getComponent(\"\ ejb\", EjbComponent.class);\n ejb.setContext(createEjbContext());\n \n \ \ return answer;\n}\n \nprivate static Context createEjbContext() throws NamingException\ \ {\n // here we need to define our context factory to use OpenEJB for our\ \ testing\n Properties properties = new Properties();\n properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,\ \ \"org.apache.openejb.client.LocalInitialContextFactory\");\n \n return\ \ new InitialContext(properties);\n}\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \nThen we are ready to use the EJB in the Camel route:\n\n[source,java]\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ from(\"direct:start\")\n // invoke the greeter EJB using the local interface\ \ and invoke the hello method\n .to(\"ejb:GreaterImplLocal?method=hello\"\ )\n .to(\"mock:result\");\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \n*In a real application server*\n\nIn a real application server you most likely\ \ do not have to setup a\n`JndiContext` on the link:ejb.html[EJB] component\ \ as it will create a\ndefault `JndiContext` on the same JVM as the application\ \ server, which\nusually allows it to access the JNDI registry and lookup the\n\ link:ejb.html[EJB]s. However if you need to access a application server on a\ \ remote JVM or\nthe likes, you have to prepare the properties beforehand.\n\ \n[[EJB-UsingSpringXML]]\nUsing Spring XML\n++++++++++++++++\n\nAnd this is\ \ the same example using Spring XML instead:\n\nAgain since this is based on\ \ an unit test we need to setup the\nlink:ejb.html[EJB] component:\n\n[source,XML]\n\ -------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \n\n \n\n \n\ \n\n\ \ org.apache.openejb.client.LocalInitialContextFactory\n\ \n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \nBefore we are ready to use link:ejb.html[EJB] in the Camel routes:\n\n[source,XML]\n\ -------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \n \n\ \ \n \n \n \n\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ \n[[EJB-SeeAlso]]\nSee Also\n^^^^^^^^\n\n* link:configuring-camel.html[Configuring\ \ Camel]\n* link:component.html[Component]\n* link:endpoint.html[Endpoint]\n\ * link:getting-started.html[Getting Started]\n* link:bean.html[Bean]\n* link:bean-binding.html[Bean\ \ Binding]\n* link:bean-integration.html[Bean Integration]\n\n"