1 | <!-- setup Camel EJB component --> |
2 | < bean class = "org.apache.camel.component.ejb.EjbComponent" id = "ejb" > |
3 | < property name = "properties" ref = "jndiProperties" > |
4 | </ property ></ bean > |
1 | <!-- use OpenEJB context factory --> |
2 | < p:properties id = "jndiProperties" > |
3 | <!--prop key="java.naming.factory.initial">org.jboss.naming.remote.client.InitialContextFactory</prop--> |
4 | <!--prop key="java.naming.factory.url.pkg">false</prop--> |
5 |
6 | </ p:properties > |
Then by invoking the EJB, you need to have identified the JNDI name which can be browsed in the Wildfly/JBoss console mostly under "JNDI tree view"
1 | < to uri = "ejb:java:global/promo-engine-ejb/ExampleServiceImpl!com.expressco.ams.ExampleServiceLocal?method=greet" > |
2 |
3 | </ to > |
Here is the EJB and impl used:
01 | @Stateless |
02 | public class ExampleServiceImpl implements ExampleService, ExampleServiceLocal { |
03 |
04 | public String greet(String name) { |
05 | // TODO Auto-generated method stub |
06 | return "Hello " + name + "!" ; |
07 | } |
08 |
09 | public Map<Object> getSystemProperties() { |
10 | // TODO Auto-generated method stub |
11 | return new HashMap<>(System.getProperties()); |
12 | } |
13 |
14 | } |
1 | @Local |
2 | public interface ExampleServiceLocal { |
3 | |
4 | public String greet(String name); |
5 | |
6 | public Map<Object> getSystemProperties(); |
7 | |
8 | } |