forked from rhtconsulting/fuse-quickstarts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mkcochran
authored and
Greg Tinsley
committed
Nov 29, 2016
1 parent
dcddfb4
commit b71eef0
Showing
8 changed files
with
485 additions
and
270 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 `<skip>` 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.redhat.consulting.fusequickstarts.eap</groupId> | ||
<artifactId>eap-parent</artifactId> | ||
<version>6.2.1</version> | ||
<relativePath>../parent/pom.xml</relativePath> | ||
</parent> | ||
<artifactId>spring-route-deployment</artifactId> | ||
<packaging>war</packaging> | ||
<name>Fuse Quickstart :: EAP :: Spring Route Deployment</name> | ||
<!-- Any dependencies needed by your project --> | ||
<!-- With spring the dependencies often need to be packaged with the war to avoid classloading issues in EAP --> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-web</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-core</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-core</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-spring</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jboss.as.plugins</groupId> | ||
<artifactId>jboss-as-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
...n/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/AnotherSampleRoute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
|
||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...src/main/java/com/redhat/consulting/fusequickstarts/eap/deployment/route/SampleRoute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
|
||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
eap/spring_route_deployment/src/main/resources/META-INF/spring/camel-context.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:camel="http://camel.apache.org/schema/spring" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xsi:schemaLocation=" | ||
http://www.springframework.org/schema/beans | ||
http://www.springframework.org/schema/beans/spring-beans.xsd | ||
http://camel.apache.org/schema/spring | ||
http://camel.apache.org/schema/spring/camel-spring.xsd | ||
http://www.springframework.org/schema/context | ||
http://www.springframework.org/schema/context/spring-context-3.1.xsd"> | ||
|
||
<!-- The context scan and annotation config elements allow the use of the Component annotation to pick up the routes --> | ||
<context:annotation-config/> | ||
<context:component-scan base-package="com.redhat.consulting.fusequickstarts.eap.deployment.route"/> | ||
|
||
<camel:camelContext id="spring-camel-eap" xmlns="http://camel.apache.org/schema/spring"> | ||
<contextScan/> | ||
</camel:camelContext> | ||
|
||
</beans> |
17 changes: 17 additions & 0 deletions
17
eap/spring_route_deployment/src/main/webapp/WEB-INF/web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | ||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
version="2.5"> | ||
<display-name>spring-jms</display-name> | ||
<!-- location of spring xml files --> | ||
<context-param> | ||
<param-name>contextConfigLocation</param-name> | ||
<param-value>classpath:META-INF/spring/*.xml</param-value> | ||
</context-param> | ||
<!-- the listener that kick-starts Spring --> | ||
<listener> | ||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | ||
</listener> | ||
</web-app> |