diff --git a/eap/parent/pom.xml b/eap/parent/pom.xml index 552094d..e047b04 100644 --- a/eap/parent/pom.xml +++ b/eap/parent/pom.xml @@ -1,280 +1,297 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - com.redhat.consulting.fusequickstarts.eap - eap-parent - 6.2.1 - pom + com.redhat.consulting.fusequickstarts.eap + eap-parent + 6.2.1 + pom - Fuse Quickstart :: EAP :: Parent + Fuse Quickstart :: EAP :: Parent - - 5.11.0.redhat-621084 - 3.2 - 1.7.6 - 2.15.1.redhat-621084 - 1.2 - 1.0.0.Final - 1.0.0.Final - 2.5 - 7.6.Final - 1.0.1.Final - + + 5.11.0.redhat-621084 + 3.2 + 1.7.6 + 2.15.1.redhat-621084 + 1.2 + 1.0.0.Final + 1.0.0.Final + 2.5 + 7.6.Final + 1.0.1.Final + 3.2.16.RELEASE + - - - - org.jboss.ejb3 - jboss-ejb3-ext-api - 2.1.0 - - - javax.annotation - javax.annotation-api - ${version.javax.enterprise} - - - org.apache.camel - camel-core - ${camel.version} - provided - - - org.apache.camel - camel-jms - ${camel.version} - provided - - - org.apache.camel - camel-test - ${camel.version} - provided - - - org.apache.camel - camel-cdi - ${camel.version} - provided - - - javax.enterprise - cdi-api - ${version.javax.enterprise} - provided - - - org.apache.camel - camel-servlet - ${camel.version} - provided - - - org.apache.camel - camel-jpa - ${camel.version} - provided - - - org.jboss.spec.javax.ejb - jboss-ejb-api_3.2_spec - ${version.jboss.spec.javax.ejb} - provided - - - org.jboss.spec.javax.servlet - jboss-servlet-api_3.1_spec - ${version.jboss.spec.javax.servlet} - provided - - - org.jboss.spec.javax.ws.rs - jboss-jaxrs-api_1.1_spec - ${version.jboss.jaxrs-api.spec} - provided - - - org.slf4j - slf4j-log4j12 - ${version.slf4j} - - - org.slf4j - slf4j-api - ${version.slf4j} - - - org.apache.activemq - activemq-camel - ${version.activemq} - - - org.apache.activemq - activemq-all - ${version.activemq} - - - + + + + org.springframework + spring-web + ${version.spring} + + + org.springframework + spring-core + ${version.spring} + + + org.jboss.ejb3 + jboss-ejb3-ext-api + 2.1.0 + + + javax.annotation + javax.annotation-api + ${version.javax.enterprise} + + + org.apache.camel + camel-core + ${camel.version} + provided + + + org.apache.camel + camel-jms + ${camel.version} + provided + + + org.apache.camel + camel-test + ${camel.version} + provided + + + org.apache.camel + camel-cdi + ${camel.version} + provided + + + javax.enterprise + cdi-api + ${version.javax.enterprise} + provided + + + org.apache.camel + camel-servlet + ${camel.version} + provided + + + org.apache.camel + camel-jpa + ${camel.version} + provided + + + org.apache.camel + camel-spring + ${camel.version} + provided + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.2_spec + ${version.jboss.spec.javax.ejb} + provided + + + org.jboss.spec.javax.servlet + jboss-servlet-api_3.1_spec + ${version.jboss.spec.javax.servlet} + provided + + + org.jboss.spec.javax.ws.rs + jboss-jaxrs-api_1.1_spec + ${version.jboss.jaxrs-api.spec} + provided + + + org.slf4j + slf4j-log4j12 + ${version.slf4j} + + + org.slf4j + slf4j-api + ${version.slf4j} + + + org.apache.activemq + activemq-camel + ${version.activemq} + + + org.apache.activemq + activemq-all + ${version.activemq} + + + - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${version.maven.compiler.plugin} - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-war-plugin - ${maven.war.plugin.version} - - - default-war - package - - war - - - - - false - - - - org.jboss.as.plugins - jboss-as-maven-plugin - ${jboss.as.plugin.version} - - - deploy-app - install - - deploy - - - admin - Password1! - true - - - - - admin - password - false - - - - - + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${version.maven.compiler.plugin} + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-war-plugin + ${maven.war.plugin.version} + + + default-war + package + + war + + + + + false + + + + org.jboss.as.plugins + jboss-as-maven-plugin + ${jboss.as.plugin.version} + + + deploy-app + install + + deploy + + + admin + Password1! + true + + + + + admin + password + false + + + + + - - - redhat-techpreview-all-repository - Red Hat Tech Preview repository (all) - http://maven.repository.redhat.com/techpreview/all/ - default - - true - - - true - - - - redhat-ea-repository - Red Hat Early Access repository (all) - https://maven.repository.redhat.com/earlyaccess/all/ - default - - true - - - true - - - - fusesource.releases - FuseSource Release Repository - http://repo.fusesource.com/nexus/content/repositories/releases - - true - - - false - - - - fusesource.public - FuseSource Release Repository - http://repo.fusesource.com/nexus/content/groups/public/ - - true - - - false - - - + + + redhat-techpreview-all-repository + Red Hat Tech Preview repository (all) + http://maven.repository.redhat.com/techpreview/all/ + default + + true + + + true + + + + redhat-ea-repository + Red Hat Early Access repository (all) + https://maven.repository.redhat.com/earlyaccess/all/ + default + + true + + + true + + + + fusesource.releases + FuseSource Release Repository + http://repo.fusesource.com/nexus/content/repositories/releases + + true + + + false + + + + fusesource.public + FuseSource Release Repository + http://repo.fusesource.com/nexus/content/groups/public/ + + true + + + false + + + - - - redhat-techpreview-all-repository - Red Hat Tech Preview repository (all) - http://maven.repository.redhat.com/techpreview/all/ - default - - true - - - false - - - - redhat-ea-repository - Red Hat Early Access repository (all) - https://maven.repository.redhat.com/earlyaccess/all/ - default - - true - - - false - - - - fusesource.releases - FuseSource Release Repository - http://repo.fusesource.com/nexus/content/repositories/releases - - true - - - false - - - - fusesource.public - FuseSource Release Repository - http://repo.fusesource.com/nexus/content/groups/public/ - - true - - - false - - - - eviwarePluginRepository - http://www.soapui.org/repository/maven2/ - - - Parent POM for Fuse on EAP Quickstarts. Defines all Dependencies and Plugins. + + + redhat-techpreview-all-repository + Red Hat Tech Preview repository (all) + http://maven.repository.redhat.com/techpreview/all/ + default + + true + + + false + + + + redhat-ea-repository + Red Hat Early Access repository (all) + https://maven.repository.redhat.com/earlyaccess/all/ + default + + true + + + false + + + + fusesource.releases + FuseSource Release Repository + http://repo.fusesource.com/nexus/content/repositories/releases + + true + + + false + + + + fusesource.public + FuseSource Release Repository + http://repo.fusesource.com/nexus/content/groups/public/ + + true + + + false + + + + eviwarePluginRepository + http://www.soapui.org/repository/maven2/ + + + Parent POM for Fuse on EAP Quickstarts. Defines all Dependencies and Plugins. diff --git a/eap/spring_route_deployment/.gitignore b/eap/spring_route_deployment/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/eap/spring_route_deployment/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/eap/spring_route_deployment/README.md b/eap/spring_route_deployment/README.md new file mode 100644 index 0000000..28f5e15 --- /dev/null +++ b/eap/spring_route_deployment/README.md @@ -0,0 +1,50 @@ +Spring Route Deployment Camel EAP example +==================================== +This example deploys two basic Camel routes using the Camel Subsystem in EAP. + +### Requirements: + * JBoss Fuse 6.2.1 + * JBoss EAP 6.4.0 + * Maven 3.0 or Greater (http://maven.apache.org/) + * Java 8 + +Building +----------------------- +To build the project. + + mvn clean install + +This will build the war including the dependencies. + +Building and Deploying to JBoss EAP +----------------------- + +To start up EAP browse to your EAP install directory. Then run + + /bin/standalone.sh + +This will bring up EAP. Once you see logging like this, EAP is up: + + 11:08:55,464 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.4.0.GA started in 10870ms - + Started 151 of 189 services (56 services are lazy, passive or on-demand) + +If you do not already have a user set up for the JBoss Management console you can set one up buy running `$EAP_HOME/bin/add-user.sh` in a separate window. It will walk you through the process. Select 'Management user' when given the option. One this is done and EAP is up, navigate to `http://localhost:9990` and login with your newly created user. + +### To Deploy your war: + +From the management console navigate to the Runtime tab and select 'Management Deployments' on the left hand side. Once here, select 'Add' and browse to your war file. You can either use the one in your .m2 directory or the one in `fuse-quickstarts/eap/spring_route_deployment/target`. After choosing the war file, click the 'En/Disable' button to start it. + +Alternatively you can deploy your code using the jboss-as-maven-plugin. To do so go into `eap/parent/pom.xml` and change the configuration of the `jboss-as-maven-plugin` to use your management user's `username` and `password` and switch `` to `false`. Then run: + + mvn clean install + + +Results +----------------------- +Once you have the route started you should be able to look in jboss/standalone/log/server.log and see the following logging: + + 14:39:21,130 INFO [com.redhat.consulting.fusequickstarts.eap.deployment.route] (Camel (spring-camel-eap) thread #1 - timer://myEapTimer) Hello World + 14:39:21,135 INFO [HelloWorldLog] (Camel (spring-camel-eap) thread #1 - timer://myEapTimer) Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]] + 14:39:21,135 INFO [GoodbyeWorldLog] (Camel (spring-camel-eap) thread #0 - timer://myOtherEapTimer) Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]] + 14:39:23,109 INFO [com.redhat.consulting.fusequickstarts.eap.deployment.route.scan] (Camel (spring-camel-eap) thread #0 - timer://myOtherEapTimer) Goodbye World + diff --git a/eap/spring_route_deployment/pom.xml b/eap/spring_route_deployment/pom.xml new file mode 100644 index 0000000..3bb3594 --- /dev/null +++ b/eap/spring_route_deployment/pom.xml @@ -0,0 +1,63 @@ + + 4.0.0 + + com.redhat.consulting.fusequickstarts.eap + eap-parent + 6.2.1 + ../parent/pom.xml + + spring-route-deployment + war + Fuse Quickstart :: EAP :: Spring Route Deployment + + + + + org.slf4j + slf4j-log4j12 + compile + + + org.slf4j + slf4j-api + compile + + + org.springframework + spring-web + compile + + + org.springframework + spring-core + compile + + + org.apache.camel + camel-core + compile + + + org.apache.camel + camel-spring + compile + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-war-plugin + + + org.jboss.as.plugins + jboss-as-maven-plugin + + + + \ No newline at end of file diff --git a/eap/spring_route_deployment/src/main/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/AnotherSampleRoute.java b/eap/spring_route_deployment/src/main/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/AnotherSampleRoute.java new file mode 100644 index 0000000..eb1f57b --- /dev/null +++ b/eap/spring_route_deployment/src/main/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/AnotherSampleRoute.java @@ -0,0 +1,22 @@ +package com.redhat.consulting.fusequickstarts.eap.deployment.route; + +import org.apache.camel.LoggingLevel; +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; + +/* + * The Annotations below are required for Spring to find and start the Camel Route. + */ +@Component +public class AnotherSampleRoute extends RouteBuilder { + + @Override + public void configure() throws Exception { + + // Logs Goodbye World every 2000 milliseconds + from("timer://myEapTimer?fixedRate=true&period=2000").log(LoggingLevel.INFO, "com.redhat.consulting.fusequickstarts.eap.deployment.route", "Goodbye World").to( + "log:GoodbyeWorldLog?level=INFO"); + + } + +} diff --git a/eap/spring_route_deployment/src/main/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/SampleRoute.java b/eap/spring_route_deployment/src/main/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/SampleRoute.java new file mode 100644 index 0000000..70221d5 --- /dev/null +++ b/eap/spring_route_deployment/src/main/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/SampleRoute.java @@ -0,0 +1,23 @@ +package com.redhat.consulting.fusequickstarts.eap.deployment.route; + +import org.apache.camel.LoggingLevel; +import org.apache.camel.builder.RouteBuilder; +import org.springframework.stereotype.Component; + +/* + * The Annotations below are required for Spring to find and start the Camel Route. + */ +@Component +public class SampleRoute extends RouteBuilder { + + @Override + public void configure() throws Exception { + + // Logs Hello World every 2000 milliseconds + from("timer://myEapTimer?fixedRate=true&period=2000") + .log(LoggingLevel.INFO, "com.redhat.consulting.fusequickstarts.eap.deployment.route", "Hello World") + .to("log:HelloWorldLog?level=INFO"); + + } + +} diff --git a/eap/spring_route_deployment/src/main/resources/META-INF/spring/camel-context.xml b/eap/spring_route_deployment/src/main/resources/META-INF/spring/camel-context.xml new file mode 100644 index 0000000..edf01e5 --- /dev/null +++ b/eap/spring_route_deployment/src/main/resources/META-INF/spring/camel-context.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/eap/spring_route_deployment/src/main/webapp/WEB-INF/web.xml b/eap/spring_route_deployment/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..111152e --- /dev/null +++ b/eap/spring_route_deployment/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,17 @@ + + + spring-jms + + + contextConfigLocation + classpath:META-INF/spring/*.xml + + + + org.springframework.web.context.ContextLoaderListener + + \ No newline at end of file