[wildfly-extras] Wildfly and Apache Camel

December 14, 2014

Wildfly Camel

 

 

 

This quick tutorial  takes you through the first steps of getting Camel into WildFly[1][2] and provides the initial pointers to get up and running.

This explanation is based on the wildfly-camel Project[5].

First step is to download wilfly 8.1.0.Final at the following link : http://download.jboss.org/wildfly/8.1.0.Final/wildfly-8.1.0.Final.zip

Second step is to download the WildFly Camel Patch at the following link : https://repository.jboss.org/nexus/content/groups/public-jboss/org/wildfly/camel/wildfly-camel-patch/2.0.0.CR1/wildfly-camel-patch-2.0.0.CR1.tar.gz

Third step is to install the Camel Subsystem by applying  the patch into the wildfly 8.1.0.Final directory

[fhornain@localhost Project]$ ls
wildfly-8.1.0.Final  wildfly-8.1.0.Final.zip  wildfly-camel-patch-2.0.0.CR1.tar
[fhornain@localhost Project]$ cd wildfly-8.1.0.Final
[fhornain@localhost wildfly-8.1.0.Final]$ tar -xvf ../wildfly-camel-patch-2.0.0.CR1.tar

Then you have to create few users in order to have access to the wildfly administrator console and hawtio administration console/

[fhornain@localhost wildfly-8.1.0.Final]$ bin/add-user.sh 

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): a              

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : fhornainWildfly
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
 - The password should be different from the username
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]:
About to add user 'fhornainWildfly' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'fhornainWildfly' to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/standalone/configuration/mgmt-users.properties'
Added user 'fhornainWildfly' to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/domain/configuration/mgmt-users.properties'
Added user 'fhornainWildfly' with groups  to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/standalone/configuration/mgmt-groups.properties'
Added user 'fhornainWildfly' with groups  to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="XXXXXXXXXXXXXXXXXXX" /></pre>
<pre>[fhornain@localhost wildfly-8.1.0.Final]$
[fhornain@localhost wildfly-8.1.0.Final]$
[fhornain@localhost wildfly-8.1.0.Final]$ bin/add-user.sh 

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : fhornainHawtio
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
 - The password should be different from the username
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: admin
About to add user 'fhornainHawtio' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'fhornainHawtio' to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/standalone/configuration/application-users.properties'
Added user 'fhornainHawtio' to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/domain/configuration/application-users.properties'
Added user 'fhornainHawtio' with groups admin to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/standalone/configuration/application-roles.properties'
Added user 'fhornainHawtio' with groups admin to file '/home/fhornain/OttoProject/YttyProject2/wildfly-8.1.0.Final/domain/configuration/application-roles.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="XXXXXXXXXXXXXXXXXXX" /></code></pre>
<pre>

Finally, you can start your wildfly 8.1.0.Final java application server with the following command :

</pre>
<pre>[fhornain@localhost wildfly-8.1.0.Final]$ <code>bin/standalone.sh -c standalone-camel.xml</code></pre>
<pre>

Then you can log on the wildfly admin console via the following URL :  http://localhost:9990/console/App.html

Wildfly admin console

 

 

 

 

 

 

 

Or you can log on the hawtio[8] console via the following URL : http://127.0.0.1:8080/hawtio/login

Hawtio Console

 

 

 

 

 

 

 

Then you can see the sample camel route created by default for you through hawtio console :

Camel route diagram

 

 

 

 

 

 

 

Camel Route Source

 

 

 

 

 

 

 

FYI, this Camel XML route sample is located in your “standalone-camel.xml” configuration file you used to start your wildfly application server few minutes ago.

 <subsystem xmlns="urn:jboss:domain:camel:1.0">
 <camelContext id="system-context-1">
 <![CDATA[
 <route>
 <from uri="direct:start"/>
 <transform>
 <simple>Hello #{body}</simple>
 </transform>
 </route>
 ]]>
 </camelContext>
 </subsystem>

In conclusion, you are now ready to create camel route on top of wildfly[2].

N.B. if you are looking for certified and supported enterprise solutions please consider Red Hat JBoss EAP[6] or Red Hat JBoss Fuse[7]

Kind Regards

Frederic

[1] Based on the definition written on Wikipedia :

WildFly, formerly known as JBoss AS, or simply JBoss, is an application server authored by JBoss, now developed by Red Hat. WildFly is written in Java, and implements the Java Platform, Enterprise Edition (Java EE) specification. It runs on multiple platforms. http://en.wikipedia.org/wiki/WildFly

[2] http://wildfly.org/

[3] Based on the definition written on Wikipedia :

Apache Camel is a rule-based routing and mediation engine that provides a Java object-based implementation of the Enterprise Integration Patterns using an API (or declarative Java Domain Specific Language) to configure routing and mediation rules. The domain-specific language means that Apache Camel can support type-safe smart completion of routing rules in an integrated development environment using regular Java code without large amounts of XML configuration files, though XML configuration inside Spring is also supported. http://en.wikipedia.org/wiki/Apache_Camel

[4] https://camel.apache.org/

[5] https://github.com/wildfly-extras

[6] http://www.redhat.com/en/technologies/jboss-middleware/application-platform

[7] http://www.redhat.com/en/technologies/jboss-middleware/fuse

[8] http://hawt.io/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: