Chapter 13. Developing an application for the JBoss EAP image To develop Fuse applications on JBoss EAP, an alternative is to use the S2I source workflow to create an OpenShift project for Red Hat Camel CDI with EAP. Prerequisites Ensure that OpenShift is running correctly and the Fuse image streams are already installed in OpenShift. See Getting Started for Administrators . Ensure that Maven Repositories are configured for fuse, see Configuring Maven Repositories . 13.1. Creating a JBoss EAP project using the S2I source workflow To develop Fuse applications on JBoss EAP, an alternative is to use the S2I source workflow to create an OpenShift project for Red Hat Camel CDI with EAP. Procedure Add the view role to the default service account to enable clustering. This grants the user the view access to the default service account. Service accounts are required in each project to run builds, deployments, and other pods. Enter the following oc client commands in a shell prompt: View the installed Fuse on OpenShift templates. Enter the following command to create the resources required for running the Red Hat Fuse 7.13 Camel CDI with EAP quickstart. It creates a deployment config and build config for the quickstart. The information about the quickstart and the resources created is displayed on the terminal. Navigate to the OpenShift web console in your browser ( https://OPENSHIFT_IP_ADDR , replace OPENSHIFT_IP_ADDR with the IP address of the cluster) and log in to the console with your credentials (for example, with username developer and password, developer ). In the left hand side panel, expand Home . Click Status to view the Project Status page. All the existing applications in the selected namespace (for example, openshift) are displayed. Click s2i-fuse7-eap-camel-cdi to view the Overview information page for the quickstart. Click the Resources tab and then click the link displayed in the Routes section to access the application. The link has the form http://s2i-fuse7-eap-camel-cdi-OPENSHIFT_IP_ADDR . This shows a message like the following in your browser: You can also specify a name using the name parameter in the URL. For example, if you enter the URL, http://s2i-fuse7-eap-camel-cdi-openshift.apps.cluster-name.openshift.com/?name=jdoe , in your browser you see the response: Click View Logs to view the logs for the application. To shut down the running pod, Click the Overview tab to return to the overview information page of the application. Click the icon to Desired Count. The Edit Count window is displayed. Use the down arrow to scale down to zero to stop the pod. 13.2. Structure of the JBoss EAP application You can find the source code for the Red Hat Fuse 7.13 Camel CDI with EAP example at the following location: The directory structure of the Camel on EAP application is as follows: Where the following files are important for developing a JBoss EAP application: pom.xml Includes additional dependencies. 13.3. JBoss EAP quickstart templates The following S2I templates are provided for Fuse on JBoss EAP: Table 13.1. JBoss EAP S2I templates Name Description JBoss Fuse 7.13 Camel A-MQ with EAP ( eap-camel-amq-template ) Demonstrates using the camel-activemq component to connect to an AMQ message broker running in OpenShift. It is assumed that the broker is already deployed. Red Hat Fuse 7.13 Camel CDI with EAP ( eap-camel-cdi-template ) Demonstrates using the camel-cdi component to integrate CDI beans with Camel routes. Red Hat Fuse 7.13 CXF JAX-RS with EAP ( eap-camel-cxf-jaxrs-template ) Demonstrates using the camel-cxf component to produce and consume JAX-RS REST services. Red Hat Fuse 7.13 CXF JAX-WS with EAP ( eap-camel-cxf-jaxws-template ) Demonstrates using the camel-cxf component to produce and consume JAX-WS web services.

Commands:
login -u developer -p developer policy add-role-to-user view -z default
get template -n openshift
new-app s2i-fuse7-eap-camel-cdi --> Creating resources service "s2i-fuse7-eap-camel-cdi" created service "s2i-fuse7-eap-camel-cdi-ping" created route.route.openshift.io "s2i-fuse7-eap-camel-cdi" created imagestream.image.openshift.io "s2i-fuse7-eap-camel-cdi" created buildconfig.build.openshift.io "s2i-fuse7-eap-camel-cdi" created deploymentconfig.apps.openshift.io "s2i-fuse7-eap-camel-cdi" created --> Success Access your application via route 's2i-fuse7-eap-camel-cdi-OPENSHIFT_IP_ADDR' Build scheduled, use 'oc logs -f bc/s2i-fuse7-eap-camel-cdi' to track its progress. Run 'oc status' to view your app.
Hello world from 172.17.0.3
Hello jdoe from 172.17.0.3
https://github.com/wildfly-extras/wildfly-camel-examples/tree/wildfly-camel-examples-5.2.0.fuse-720021/camel-cdi
├── pom.xml ├── README.md ├── configuration │ └── settings.xml └── src └── main ├── java │ └── org │ └── wildfly │ └── camel │ └── examples │ └── cdi │ └── camel │ ├── MyRouteBuilder.java │ ├── SimpleServlet.java │ └── SomeBean.java └── webapp └── WEB-INF └── beans.xml