Red Hat Benelux Workshop

 

Red Hat JBoss Middleware Hands-On Labs, join us for a free hands-on lab at one of our Benelux locations


Have you ever wondered how to get started with the Red Hat JBoss Middleware products? Are you unsure where to begin?
You like to receive information, but would prefer to work with the products on the spot?
Join us for one of our free JBoss Hands on Labs, (formerly known as Red Hat in-house Hackathons).
The next one will be on Jboss Fuse @ Arrow – http://www.arrowecs.be
on Thursday June 04 2015 from 17:00
Woluwedal 30, Sint-Stevens-Woluwe, Brussels- 3rd floor

fuseserviceworks_workshop

 

/!\ Do not forget to register at the following URL :

http://www.redhatonline.com/benelux/workshops.php

Kind Regards

Frederic

TriedTestedTrusted

 

 

 

 

 

 

 

From the trading floor to air traffic control, industries around the world rely on Red Hat.

 

Ref :

http://www.redhat.com/en/about/trusted

Kind Regards

Frederic

Red Hat JBoss Web Server 3.0 is GA

 

 

 

 

 

 

 

Red Hat JBoss Web Server (JWS) 3.0 is generally available.

This major version release updates Apache httpd and the versions of Apache Tomcat to recent versions, including updates to all of the mod* extensions for httpd, and the version of Hibernate for the JWS Plus product.

Some highlights of the release are:
Support for Java 8 with OpenJDK, Oracle JDK, and IBM JDK
Addition of Tomcat version 8.0.18
Update to Tomcat version 7.0.59
Update to Apache httpd version 2.4.6
Update to Hibernate 4.2.18
Support for WebSockets with Apache and Tomcat.

More information at https://access.redhat.com/articles/111723

Ref :

http://www.redhat.com/en/technologies/jboss-middleware/web-server

Kind Regards

Frederic

JEE App. Go To The Cloud

 

 

 

 

 

 

Enterprises are under pressure to deliver new applications fast; however, many factors, including rigid proprietary stacks, inflexible licensing agreements, and cultural silos in IT can prevent enterprises from achieving the agility they need to stay competitive. Enterprises are increasingly implementing DevOps methodologies, and technologies that complement them, to break down siloed communications between development and operations teams and accelerate application development and delivery. As DevOps adoption increases, so does the demand for technologies that complement DevOps methodologies and enable high productivity of developers and operations teams working closely together.

“Although DevOps emphasizes people (and culture) over tools and processes, implementation utilizes technology. As a result, Gartner, Inc. expects strong growth opportunities for DevOps toolsets, with the total for DevOps tools reaching $2.3 billion in 2015, up 21.1 percent from $1.9 billion in 2014. By 2016, DevOps will evolve from a niche strategy employed by large cloud providers to a mainstream strategy employed by 25 percent of Global 2000 organizations.”1

Red Hat is committed to helping enterprises get more out of their technology by allowing for greater freedom of choice. JBoss EAP supports a broad range of third-party frameworks, operating systems, databases, security, and identity systems to make integration into existing infrastructure easier. In addition, new subscription flexibility expands support for customers deploying JBoss EAP across multiple environments based on their individual needs and business requirements, including on-premise, in a Platform-as-a-Service (PaaS) environment, or in hybrid cloud scenarios.

Additional enhancements introduced in JBoss EAP 6.4 include:

  • Support for Java 8 applications, as well as for the Java API WebSockets implementation protocol, JSR 356, enabling developers to build real-time, rich client and mobile applications with reduced overhead and complexity.
  • Expanded JBoss EAP console and Red Hat Customer Portal integration, giving users direct access to the Red Hat Customer Portal, including the ability to receive support, open and manage tickets, and access the knowledge base.
  • New console functionality with an updated user interface enabling users to view log files more easily and manage security configuration for applications.
  • Kerberos authorization for greater application security.

As one of the only open source application platforms that commercially supports Java EE applications deployed in PaaS environments, JBoss EAP deployed on OpenShift provides developers with a fully certified Java EE 6 container and all the tools needed to build, run, and manage a wide range of Java applications. The combination of JBoss EAP and OpenShift Enterprise helps enterprises to optimize both development and operations by offering the ability to build enterprise-grade Java applications in a streamlined PaaS environment more quickly.

Ref :

http://www.redhat.com/en/about/press-releases/red-hat-expands-jboss-enterprise-application-platform-subscription-greater-flexibility-move-cloud

Kind Regards

Frederic

CloudAndApplication

 

  • Do you want to build and deliver Java™ EE apps faster?
  • Are your customers demanding more?
  • What if you could develop new business critical Java EE applications using your existing skills and deliver them faster?

http://www.youtube.com/watch?v=Iquk68o1Q-k

Learn how Red Hat accelerates application development and delivery, allowing you to get to market faster and deliver new features and value more frequently.

Learn more at :

Kind Regards
Frederic

Resources Optimization

Organizations of all sizes and across many industries must orchestrate and plan daily business operations, such as scheduling, vehicle routing, or timetabling. Many organizations must be able to cope with changing and increasing demands on the business with a limited set of resources, and quickly adapt plans when established processes are interrupted by unanticipated resource changes.

Red Hat’s business resource planning technology helps enterprises use limited resources in a more cost effective manner. Applying rules-based technology in conjunction with business resource planning provides a unique and powerful combination that allows for greater scale and adaptability. The planner is included with a subscription to JBoss BRMS at no additional cost. All of the resource planning and business rules management components are included in Red Hat’s business process management offering, JBoss BPM Suite.

Ref :

http://www.redhat.com/en/about/press-releases/red-hat-helps-enterprises-optimize-complex-planning-and-scheduling-challenges-new-business-resource-planner

https://fhornain.wordpress.com/2015/04/14/devoxx-france-2015-optaplanner-session/

http://slides-fhornain.rhcloud.com/#/

KR

/f

Devoxx_Optaplanner_2015

 

Here is the presentation “OptaPlanner ou comment optimiser les itinéraires, les plannings et bien plus encore…” Geoffrey and I did at Devoxx France on the Friday April 10 2015.

http://slides-fhornain.rhcloud.com/#/

BTW, slides are in French

 

Optaplanner presentation @ Devoxx

N.B. : Only Chrome, Safari, Firefox, Opera and IE10-11 are supported

What is OptaPlanner?

OptaPlanner is a constraint satisfaction solver. It optimizes business resource planning. Every organization faces scheduling puzzles: assign a limited set of constrained resources (employees, assets, time and money) to provide products or services to customers. OptaPlanner optimizes such planning problems to do more business with less resources. Use cases include Vehicle Routing, Employee Rostering, Job Scheduling, Bin Packing and many more.

More inforation at http://www.optaplanner.org/

Optaplanner and CDI guys

 http://www.devoxx.fr/wp-content/uploads/2015/04/DSC_2596.jpg

Ref:

http://www.devoxx.fr/

http://cfp.devoxx.fr/2015/talk/ZUC-9786/OptaPlanner_ou_comment_optimiser_les_itineraires,_les_plannings_et_bien_plus_encore…

Kind Regards

Frederic

 

Can Not Keep Up with Application Demand

 

 

 

 

 

 

 

 

 

 

When application requests start piling up, OpenShift Enterprise by Red Hat® can help you keep up with demand. This Platform-as-a-Service (PaaS) lets developers deploy on their time, optimizes your compute resources, and frees you up to focus on the future.

Enable your developers with velocity and stability.

Learn more at :

http://www.openshift.com

http://www.redhat.com/en/technologies/platform-as-a-service

http://www.redhat.com/en/technologies/cloud-computing/openshift

Kind Regards

Frederic

wildfly Camel

In one of my previous posts[1], I explain how you can install Apache Camel[2] on top of Wildfly[3].

In that small tutorial, I am not going to reinvent the wheel. I am just going to explain how you can transform/convert data stored in XML format and upload it to a database of your choice  – In this example H2[4] was the chosen default database -.

Note: H2 is not recommended to be used in production. I would rather recommend you to look at  postgresq[5], MongoDB[6], MariaDB[7], etc… instead.

This example named “camel-jpa”  is coming from the ones provided with the wildfly-camel project[8]

First of all here is the tree of that project :


[fhornain@localhost camel-jpa]$ tree
.
├── pom.xml
└── src
├── main
│   ├── java
│   │   └── org
│   │       └── wildfly
│   │           └── camel
│   │               └── examples
│   │                   └── jpa
│   │                       ├── CustomerRepository.java
│   │                       ├── JpaRouteBuilder.java
│   │                       ├── model
│   │                       │   ├── Customer.java
│   │                       │   └── package-info.java
│   │                       ├── Resources.java
│   │                       └── SimpleServlet.java
│   ├── resources
│   │   ├── META-INF
│   │   │   └── persistence.xml
│   │   └── org
│   │       └── wildfly
│   │           └── camel
│   │               └── examples
│   │                   └── jpa
│   │                       └── model
│   │                           └── jaxb.index
│   └── webapp
│       └── WEB-INF
│           ├── beans.xml
│           ├── customers.jsp
│           ├── customer.xml
│           └── jboss-web.xml
└── test
└── java
└── org
└── wildfly
└── camel
└── examples
└── jpa
└── JPAIntegrationTest.java

26 directories, 14 files

And here is the pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
 #%L
 Wildfly Camel :: Example :: Camel JPA
 %%
 Copyright (C) 2013 - 2014 RedHat
 %%
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 #L%
 -->


<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/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>

 <parent>
 <groupId>org.wildfly.camel</groupId>
 <artifactId>wildfly-camel-example</artifactId>
 <version>2.0.0.CR1</version>
 </parent>

 <name>Wildfly Camel :: Example :: Camel JPA</name>

 <artifactId>example-camel-jpa</artifactId>
 <packaging>war</packaging>

 <dependencies>

 <!-- Provided -->
 <dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-core</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-cdi</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-jpa</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-jaxb</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>javax.enterprise</groupId>
 <artifactId>cdi-api</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>org.hibernate.javax.persistence</groupId>
 <artifactId>hibernate-jpa-2.1-api</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>org.jboss.spec.javax.servlet</groupId>
 <artifactId>jboss-servlet-api_3.1_spec</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>org.jboss.spec.javax.ejb</groupId>
 <artifactId>jboss-ejb-api_3.2_spec</artifactId>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>org.jboss.spec.javax.transaction</groupId>
 <artifactId>jboss-transaction-api_1.1_spec</artifactId>
 <scope>provided</scope>
 </dependency>

 <!-- Test Scope -->
 <dependency>
 <groupId>org.wildfly.camel</groupId>
 <artifactId>example-camel-common</artifactId>
 <version>${project.version}</version>
 <scope>test</scope>
 </dependency>
 <dependency>
 <groupId>org.jboss.arquillian.junit</groupId>
 <artifactId>arquillian-junit-container</artifactId>
 <scope>test</scope>
 </dependency>
 <dependency>
 <groupId>org.wildfly</groupId>
 <artifactId>wildfly-arquillian-container-remote</artifactId>
 <scope>test</scope>
 </dependency>
 <dependency>
 <groupId>junit</groupId>
 <artifactId>junit</artifactId>
 <scope>test</scope>
 </dependency>
 <dependency>
 <groupId>org.slf4j</groupId>
 <artifactId>slf4j-simple</artifactId>
 <scope>test</scope>
 </dependency>
 </dependencies>

 <!-- Build -->
 <build>
 <plugins>
 <plugin>
 <groupId>org.wildfly.plugins</groupId>
 <artifactId>wildfly-maven-plugin</artifactId>
 <executions>
 <execution>
 <id>wildfly-deploy</id>
 <phase>integration-test</phase>
 <goals>
 <goal>deploy</goal>
 </goals>
 </execution>
 </executions>
 </plugin>
 </plugins>
 </build>

 <!-- Profiles -->
 <profiles>
 <profile>
 <id>ts.all</id>
 <activation>
 <property>
 <name>ts.all</name>
 </property>
 </activation>
 <properties>
 <jboss.home>${basedir}/../target/wildfly-${version.wildfly}</jboss.home>
 </properties>
 </profile>
 </profiles>
</project>

As you can see the project in based on a MVC pattern and is composed of four directories but for the time being we will only cover three of them.
That is to say :

- camel-jpa/src/main/java
- camel-jpa/src/main/resources
- camel-jpa/src/main/webapp

Indeed, the project can be then cut in two parts.

The first part which is taking care of the content routing and the transformation of information of the following XML data sample.


<?xml version="1.0" encoding="UTF-8"?>
<cus:customer xmlns:cus="http://org/wildfly/camel/examples/jpa/model/Customer"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://org/wildfly/camel/examples/jpa/model/Customer">
<cus:firstName>John</cus:firstName>
<cus:lastName>Doe</cus:lastName>
<cus:dateOfBirth>1975-12-25</cus:dateOfBirth>
</cus:customer>

Note : You can retrieve these data in the camel-jpa/src/main/webapp/WEB-INF/customer.xml xml file.
The Second part which transcribes the content of the database in a web page.  – See below – We will call it the servlet[12] part.

Note: This outcome can be found at http://localhost:8080/example-camel-jpa/customers

Screenshot from 2014-12-15 13:37:35

 

 

 


First part of the Project (Content routing and transformation of information)

Here the idea is to unmarshall[11] or deserialize the content of the XML file through Camel Route (Here implemented in the JpaRouteBuilder.java) to an Entity Bean (here in Customer.java) which will then persisted to the H2 Database.

In the camel-jpa/src/java you have got : JpaRouteBuilder.java which is where the Camel route is going to be implemented.


/*
* #%L
* Wildfly Camel :: Example :: Camel JPA
* %%
* Copyright (C) 2013 - 2014 RedHat
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package org.wildfly.camel.examples.jpa;

import javax.ejb.Startup;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.transaction.UserTransaction;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.cdi.ContextName;
import org.apache.camel.component.jpa.JpaEndpoint;
import org.apache.camel.model.dataformat.JaxbDataFormat;
import org.springframework.transaction.jta.JtaTransactionManager;
import org.wildfly.camel.examples.jpa.model.Customer;

@Startup
@ApplicationScoped
@ContextName("jpa-cdi-context")
public class JpaRouteBuilder extends RouteBuilder {

@Inject
private EntityManager em;

@Inject
UserTransaction userTransaction;

@Override
public void configure() throws Exception {

// Configure our JaxbDataFormat to point at our 'model' package
JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
jaxbDataFormat.setContextPath(Customer.class.getPackage().getName());

EntityManagerFactory entityManagerFactory = em.getEntityManagerFactory();

// Configure a JtaTransactionManager by looking up the JBoss transaction manager from JNDI
JtaTransactionManager transactionManager = new JtaTransactionManager();
transactionManager.setUserTransaction(userTransaction);
transactionManager.afterPropertiesSet();

// Configure the JPA endpoint to use the correct EntityManagerFactory and JtaTransactionManager
JpaEndpoint jpaEndpoint = new JpaEndpoint();
jpaEndpoint.setCamelContext(getContext());
jpaEndpoint.setEntityType(Customer.class);
jpaEndpoint.setEntityManagerFactory(entityManagerFactory);
jpaEndpoint.setTransactionManager(transactionManager);

/*
* Simple route to consume customer record files from directory input/customers,
* unmarshall XML file content to a Customer entity and then use the JPA endpoint
* to persist the it to the 'ExampleDS' datasource (see standalone.camel.xml for datasource config).
*/
from("file://{{jboss.server.data.dir}}/customers")
.unmarshal(jaxbDataFormat)
.to(jpaEndpoint)
.to("log:input?showAll=true");
}
}

In addition to that, We will use JaxbDataFormat to point at our 'model' package in camel-jpa/src/main/java/org/wildfly/camel/examples/jpa/model/package-info.java


@javax.xml.bind.annotation.XmlSchema(namespace = "http://org/wildfly/camel/examples/jpa/model/Customer", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.wildfly.camel.examples.jpa.model;


 

Second part of the Project

In that part of that project,  the idea is to transcribes the content of the database in a web page through a Servlet[12].

In the camel-jpa/src/java you have got : CustomerRepository.java which is only there to send back customer information from the Database to the Servlet SimpleServlet.java


/*
 * #%L
 * Wildfly Camel :: Example :: Camel JPA
 * %%
 * Copyright (C) 2013 - 2014 RedHat
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package org.wildfly.camel.examples.jpa;

import java.util.List;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;

import org.wildfly.camel.examples.jpa.model.Customer;

public class CustomerRepository {
    
    @Inject
    private EntityManager em;

    /**
     * Find all customer records
     *
     * @return A list of customers
     */
    public List<Customer> findAllCustomers() {

        CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
        CriteriaQuery<Customer> query = criteriaBuilder.createQuery(Customer.class);
        query.select(query.from(Customer.class));

        return em.createQuery(query).getResultList();
    }
}</pre>
<pre>

Entity Manager which is going to use details defined in your camel-jpa/src/main/resources/META-INF/persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Wildfly Camel :: Example :: Camel JPA
%%
Copyright (C) 2013 - 2014 RedHat
%%
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#L%
-->
<persistence version="2.0"
 xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
 http://java.sun.com/xml/ns/persistence
 http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
 <persistence-unit name="camel">
 <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
 <class>org.wildfly.camel.examples.jpa.model.Customer</class>
 <properties>
 <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
 <property name="hibernate.show_sql" value="true"/>
 </properties>
 </persistence-unit>
</persistence>

Note : ExampleDS should be the default datasource set in your Wildfly instance. – see for instance your /wildfly-8.1.0.Final/standalone/configuration/standalone-camel.xml configuration file in your wildfly instance with the additional Camel Patches[1]

Finally here is the Servlet [12] implementation  : SimpleServlet.java:

/*
 * #%L
 * Wildfly Camel :: Example :: Camel JPA
 * %%
 * Copyright (C) 2013 - 2014 RedHat
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package org.wildfly.camel.examples.jpa;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

import javax.inject.Inject;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.wildfly.camel.examples.jpa.model.Customer;

@SuppressWarnings("serial")
@WebServlet(name = "HttpServiceServlet", urlPatterns = { "/customers/*" }, loadOnStartup = 1)
public class SimpleServlet extends HttpServlet {

    static Path CUSTOMERS_PATH = new File(System.getProperty("jboss.server.data.dir")).toPath().resolve("customers");
    
    @Inject
    private CustomerRepository customerRepository;

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);

        // Copy WEB-INF/customer.xml to the data dir
        ServletContext servletContext = config.getServletContext();
        try {
            InputStream input = servletContext.getResourceAsStream("/WEB-INF/customer.xml");
            Path xmlPath = CUSTOMERS_PATH.resolve("customer.xml");
            Files.copy(input, xmlPath);
        } catch (IOException ex) {
            throw new ServletException(ex);
        }
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        /*
         * Simple servlet to retrieve all customers from the in memory database for
         * output and display on customers.jsp
         */

        List<Customer> customers = customerRepository.findAllCustomers();

        request.setAttribute("customers", customers);
        request.getRequestDispatcher("/WEB-INF/customers.jsp").forward(request, response);
    }
}

Object which will be called by the camel-jpa/src/main/webapp/WEB-INF/customers.jsp JSP file when you will access to the following URL  : http://localhost:8080/example-camel-jpa/customers

<%--
 #%L
 Wildfly Camel :: Example :: Camel JPA
 %%
 Copyright (C) 2013 - 2014 RedHat
 %%
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 #L%
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:forEach var="customer" items="${customers}">
 ${customer.firstName} ${customer.lastName}
</c:forEach>

Now up, you can compile you code using the following command at the root of your project /camel-jpa :


[fhornain@localhost camel-jpa]$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Wildfly Camel :: Example :: Camel JPA 2.0.0.CR1
[INFO] ------------------------------------------------------------------------
[INFO]
.......................
.......................
.......................
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.491s
[INFO] Finished at: Mon Dec 15 15:10:01 CET 2014
[INFO] Final Memory: 36M/333M
[INFO] ------------------------------------------------------------------------

and then deploy your code to your wildfly instance[1] with its additional camel patches.


[fhornain@localhost target]$ pwd
/camel-jpa/target
[fhornain@localhost target]$ cp -pR example-camel-jpa-2.0.0.CR1.war /wildfly-8.1.0.Final/standalone/deployments/

Then, you can play with the example.

You should have a customer directory in /wildfly-8.1.0.Final/standalone/data

Directory

 

 

 

 

 

 

Do a copy/paste of the the camel-jpa/src/main/webapp/WEB-INF/customer.xml xml file in that directory /wildfly-8.1.0.Final/standalone/data.


[fhornain@localhost WEB-INF]$ pwd

/camel-jpa/src/main/webapp/WEB-INF

[fhornain@localhost WEB-INF]$ cp -pR customer.xml /wildfly-8.1.0.Final/standalone/data/customers

You should now see an additional customer in the following web page : http://localhost:8080/example-camel-jpa/customers

New Web screenshot

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

Kind Regards

Frederic

[1] https://fhornain.wordpress.com/2014/12/14/wildfly-extras-wildfly-and-apache-camel/

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

[3] http://wildfly.org/

[4] http://www.h2database.com/html/main.html

[5] http://www.postgresql.org/

[6] http://www.mongodb.org/

[7] https://mariadb.org/

[8] https://github.com/wildfly-extras/wildfly-camel

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

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

[11] http://en.wikipedia.org/wiki/Marshalling_%28computer_science%29

[12] http://en.wikipedia.org/wiki/Java_Servlet

 

 

 

 

 

 

 

 

 

 

 

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/