Enterprise grade Java.
You'll read about Conferences, Java User Groups, Java, Integration, Reactive, Microservices and other technologies.

Wednesday, December 24, 2014

2014, twenty fourteen going on fifteen. Happy Holidays!

00:00 Wednesday, December 24, 2014 Posted by Test No comments:
, ,
I can't recall when I started doing those end-of-the-year blog-posts. But it became something that I am really looking forward to do. Getting into the mood of looking back at 12 months, 365.242 days, 8765.808 hours and even more seconds. By the average 6.8 hours of sleep per night, this gives us ~17 hours per day. A decent percentage of this went into my jobs and hobbies. I've always been passionate about what I've been doing. And this did not change since mid July, when I decided to join Red Hat. I've meet so many great people and it was fun to explore and learn the Red Hat way.
My special thanks to the communities around the many amazing JBoss open source projects. You guys rock! It is fun to watch how everything evolves and all the pieces come together. I am truly looking forward to spread the word about all the exciting new things coming to a bunch of my favorite projects.

But for now, this year is over. And it is time to close a book with may colorful pages. It'll take some time, until I open the first page of 2015. The time in between the years will be all about family and presents and food and smiles and glazing eyes for Christmas.
I wish you a prosperous and happy new year and hope to see you soon somewhere on any of the upcoming conferences or Java User Group sessions or on the virtual JBUG.

“We are the authors of our destinies. No one can see the vision any clearer, believe in and work any harder to make it a reality more than the visionary.”
― Nike Campbell-Fatoki

Tuesday, December 23, 2014

Riding Camel on Java EE 7 - REST Services with Swagger Documentation

11:05 Tuesday, December 23, 2014 Posted by Test No comments:
, , ,
Camel comes with a bunch of features out of the box. One of them is the Swagger integration. Unfortunately, most of the already-there features heavily rely on Spring. But this should not stop us from using them in plain Java EE 7 applications, because it sometimes is just the more lightweight variant of doing things. But I don't want to start a discussion about this again. Instead, I think that there is a technology choice for all situations and if you run across a project you just want to use Camel with Java EE 7 and you need REST services and want to document them with Swagger, this is the right post for you.

Bootstrapping Camel in EE 7
The first thing you need, is to bootstrap Camel in a singleton startup bean. I already wrote an article, about how to do this. The other option is to actually use the wildfly-camel subsystem which is also available, but this requires you to be on JBoss WildFly 8.x.

Swagger And Camel Rest Dependencies
The Swagger integration in Camel as of today is supported for Spring applications only. So, to make this work, we do have to implement a bit and configure a bit more than usual. But I promise, that it is not too complicated and done in a minute. Let's start:
First thing to add to the basic Camel EE 7 example are the additional dependencies for camel:


Returning The Camel Context For Swagger
If we can't use what is there, we need to implement our own CdiRestSwagger-Camel context lookup. There are some things cooking for upcoming Camel versions, but for now we have to do it on our own. Which is surprisingly simple, because we need to overwrite one method of the  RestSwaggerApiDeclarationServlet. And this does nothing else than simply return the injected CdiCamelContext.

public class CdiRestSwaggerApiDeclarationServlet extends RestSwaggerApiDeclarationServlet {

    CdiCamelContext context;

    public CamelContext lookupCamelContext(ServletConfig config) {
        return context;

Some Further Configuration
We're not done yet. You still have some more configuration to do. As Camel is designed to run in many different environments and there is no specific Java EE 7 version, it still rely on web.xml configuration for the mapping servlets. Please pay extra attention to the CdiRestSwaggerApiDeclarationServlet init-parameters. In this simple example, I did not bother with finding them out, but still rely on them. So, depending on the final name of your application that you set in the Maven build, this needs to be tweaked.

        <!-- to use Java DSL -->

    <!-- to setup Camel Servlet -->
       <display-name>Camel Http Transport Servlet</display-name>

    <!-- to setup Camel Swagger api servlet -->
        <!-- we are using our own swagger-cdi binding servlet -->
            <param-value>         http://localhost:8080/camel/api-docs          </param-value>
            <param-value>User Services</param-value>
            <param-value>Camel Rest Example with Swagger that provides an User REST service</param-value>

    <!-- swagger api declaration -->

    <!-- define that url path for the Camel Servlet to use -->

    <!-- enable CORS filter so people can use swagger ui to browse and test the apis -->


Enough Configuration - To The Logic!
When you're done with that, you need some logic. The example I'm using here was taken from the official Camel examples and is called camel-example-servlet-rest-tomcat. Please note, that this example contains both, a XML DSL based definition and the Java DSL based definition of the rest-service. I only used the Java DSL and specifically the route defined in the UserRouteBuilder class.
Make sure to add a @Named annotation to the UserService and the User and add the route from the UserRouteBuilder to your startup bean.

   context.addRoutes(new UserRouteBuilder());

That is it. Now you can browser your API by accessing http://localhost:8080/camel/api-docs. If you want to use the Swagger UI you have to add it to your application. The example application contains everything in the build section, that is needed to do this. So, have a look at the complete GitHub project to find out how to browse the API with the Swagger UI.

Monday, December 22, 2014

I'm speaking at JDK.IO 2015, 19 - 20 January in Copenhagen, Denmark

12:00 Monday, December 22, 2014 Posted by Test No comments:
Another confirmation came in. JDK.IO will be my first stop in 2015. This is the annual conference of the Danish Java User Group (Java Gruppen) and it has been extended this year. Instead of one day it is going to be a full two day conference.
The name is an acronym for Java Denmark Input Output - ie a conference for people who reside and work in Denmark with an interest in the Java programming language as such, and all the libraries and platform based on Java.

The confirmed sessions:

Monday 19th January 2015, 12.30-14.00
Architecting Large Enterprise Java Projects
In the past I've been building component oriented applications with what I had at hand. Mostly driven by the features available in the Java EE standard to be "portable" and easy to use. Looking back this has been a perfect fit for many customers and applications. With an increasing demand for highly integrated applications which use already available services and processes from all over the place (departmental, central or even cloud services) this approach starts to feel more and more outdated. And this feel does not come from a technology perspective but from all the requirements around it. Having this in mind this post is the starting point of a series of how-to's and short tutorials which aim to showcase some more diverse ways of building (Java EE) applications that fit better into today's requirements and landscapes.

Tuesday 20th January 2015, 16.00-17.30
Wild Flies and a Camel - Java EE Integration Stories
Apache Camel is one of the most complete integration frameworks out there. With more than 150 components and a large community it clearly has it's fans. Deploying the lightweight core is easy. Getting into modules and even more components makes this challenging. There are different approaches to ride that Camel. How to get the most out of it with Java EE and WildFly is exactly the topic of this session. It will introduce you to both Java EE 7 and Apache Camel in a very brief way and follows up with the different integration and deployment scenarios along with introducing the tools which help you the most on the way to your integration solution.

Monday, December 15, 2014

Running Java Mission Control and Flight Recorder against WildFly and EAP

00:00 Monday, December 15, 2014 Posted by Test No comments:
, , ,
Java Mission Control (JMC) enables you to monitor and manage Java applications without introducing the performance overhead normally associated with these types of tools. It uses data which is already getting collected for normal dynamic optimization of the JVM resulting in a very lightweight approach to observe and analyze problems in the application code. The JMC consists of three different types of tools. A JMX browser which let's you browse all available JVM instances on a machine and a JMX console which let's you browse through the JMX tree on a connected JVM. Last but not least the most interesting aspect is the Java Flight Recorder (JFR). This is exactly the part of the tooling which does the low overhead profiling of JVM instances.

Disclaimer: A Word On Licensing
The tooling is part of the Oracle JDK downloads. In particular the JMC 5.4 is part of JDK 8u20 and JDK 7u71 and is distributed under the Oracle Binary Code License Agreement for Java SE Platform products and commercially available features for Java SE Advanced and Java SE Suite. IANAL, but as far as I know this allows for using it for your personal education and potentially also as part of your developer tests. Make sure to check back with whomever you know that could answer this question. This blog post looks at it as a small little how-to and assumes, that you know what you are doing from a license perspective.

Adding Java Optional Parameters
Unlocking the JFR features requires you to put in some optional parameters to your WildFly 8.x/EAP 6.x configuration. Find the  $JBOSS_HOME/bin/standalone.conf|conf.bat and add the following parameters:
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder

You can now use jcmd command like described in this knowledge-base entry to start a recording. Another way is actually to start a recording directly from JMC.

Starting A Recording From JMC
First step is to start JMC. Find it in the %JAVA_HOME%/bin folder. After it started you can use the JVM Browser to find the WildFly/EAP instance you want to connect to. Right click on it to see all the available options. You can either start the JMX Console or start a Flight Recording. The JMX console is a bit fancier than the JConsole and allows for a bunch of metrics and statistics. It also allows you to set a bunch of triggers and browser MBeans and whatnot. Please look at the documentation for all the details. What is really interesting is the function to start a Flight Recording. If you select this option, a new wizard pops up and lets you tweak the settings a bit. Beside having to select a folder where the recording gets stored you also have the choice between different recording templates.

A one minute recording with the "Server Profiling" template with barely any load on the server results in a 1.5 MB file. So, better keep an eye on the volume you're storing all that stuff at.
You can also decide the profiling granularity for a bunch of parameters further down the dialogues. But at the end, you click "Finish" and the recording session starts. You can decide to push it to the background and keep working while the data gets captured.

Analyzing Flight Recorder Files
This is pretty easy. You can open the recording with JMC and click through the results. If you enabled the default recording with the additional parameter:

you can also directly dump the recording via the JVM browser. It is easy to pick a time-frame that you want to download the data for or alternatively you can also decide to download the complete recording.

Thursday, December 11, 2014

Docker All The Things for Java EE Developers - On Windows with Maven

12:00 Thursday, December 11, 2014 Posted by Test 1 comment:
, , ,
Everybody seems to do Docker these days. And the whole topic gets even more attraction with Microsoft committed to integrate it into Windows. As many middleware developers are running Windows, I thought I give it a try myself and also give some more tips along the way about how to build and run images with the least possible amount of struggle with Docker containers, hosts and guests and command line options. Arun did a very nice introduction to Docker on a recent blog-post. I'm skipping this here and directly dive into it.

Installing Boot2Docker
The Docker Engine uses Linux-specific kernel features, so to run it on Windows we need to use a lightweight virtual machine. There is a helper application called Boot2Docker which makes installing and running everything pretty straight forward. The first step is to download the latest version of the binary installer and execute it. It will install Oracle VirtualBox, MSYS-git, the boot2docker Linux ISO, and the Boot2Docker management tool. Next stept is to run the Boot2Docker start script (there's a little whale icon on your desktop after the install). It will setup the Docker host and connect via ssh to the host. If you want to do that again at a later state, you can simply type: boot2docker ssh.

There is no Docker client for Windows based systems for now. So, ssh basically is a workaround which works pretty good and is probably also a well known way. With Microsoft's recently announced new partnership with Docker, this might change soonish. If you want to build your own Docker client, you find some more information in Khalid Mouss' blog post about it.
Some tips for you. You need to have the %MSYS-git_INSTALL%/bin directory in your PATH. It contains a  cmd line ssh client. If you want to use PUTTY make sure to connect to the Docker host using user "root" and password "tcuser".
If you are running any kind of VPN client, you will absolutely run into trouble. Docker normally runs in Host-only mode and and installed VPN client turns this into NAT. Go to the VirtualBox management console and open the settings for the boot2docker-vm and add a port forwarding rule for the Docker API. We will need this later.

A little warning: The default Docker API port is 2375. In my case this wasn't true, so I had to first find out which port the Docker API is listening on. Do this with netstat on your host. So, I basically used a direct guest to host mapping on 2376 in this example. All done. Now you're ready to launch the hello world example. Just type "docker run hello-world" and wait for a "Hello from Docker.". Now you're good to go.
If you need a complete reference for Boot2Docker, this is a very helpful site.

Why Exactly Do We Do Docker?
What is the hype around Docker these days? There is a little history in it and it might on the long run also support microservice deployments by just defining complete packages that can be deployed. Including the infrastructure requirements. Think of Docker containers as application servers which can run defined images. And think of images as large Maven archives which does not only contain your application but also the OS and all the parts that are needed to run your application. Like it or not, but everybody is playing around with it and at the end of the day, it is a way to solve some problems. I'm not telling you, that I fell in love with it instantly, but at least I want it to help me with demos and showcases. And the thought, that I only have to define a bunch of dependencies and Maven Plugins in my Java EE applications and everything magically just runs is something I like. But let's look at what it takes and how to do it.

Already Available Images - e.g. WildFly
Speaking of images: There are a bunch of images ready to go. We at JBoss have a special microsite ready for you with all the Docker images that we have ready for you to run. If you want to use any of them you basically just install them in your container and start it. By doing this, you can just have any component running, basically like you would have it running locally on your machine. The only difference is, that it runs in your "Docker Host". If you want to start WildFly all you have to do is to issue the following Docker command:
docker run -it -p 9990:99 jboss/wildfly
Docker automatically pulls the relevant bits (which might take a while) and starts a container from this image. The port mapping actually is between the host and the container. Remember the VPN problems from above? Make sure to add the port mapping in VirtualBox also if you want to try that out. The outcome is pretty clear: You now have a WildFly running in a container. Map the needed ports and just use it as you would normally use a remote instance. If you want even more images, you can browse and search the Docker Hub. There's plenty out there already.
Using Docker like that is not exactly the idea behind it. Actually, the image should contain not only the base component but also a completely configured application in it. 

Building You Own Images - All The Different Ways
Therefore you need to build your own images. There are different ways of doing that. You can either update a container created from an image and commit the results to an image. Or create your own Dockerfile to specify instructions to create an image or you can use a build tool like Maven to create your image. The Dockerfile approach is very powerful and requires quite a bit of typing and vi-magic. I was looking for an easy way to create an image from Maven. Because, this is what I use for projects anyway.

Building A Docker Image With Maven
There are many different Maven plugins out there which actually offer this kind of feature I was looking for. At the end of the day, the Fabric8 team was using the Maven-Docker-Plugin made by Roland Huß. The plugin can build and publish images but also start and stop containers for integration testing and development. I struggled a bit with setting it up and I am still playing around with the best ways to integrate it into my applications, so this is basically a first first list of my findings and solutions and no complete user-guide. Please look at the samples and the official user guide of the plugin for more details. I will build a complete example in one of my next blog posts and walk you through it.

DOCKER_HOST Environment variable
First thing for this plugin to work is obviously the DOCKER_HOST environment variable. As the whole experience of Windows is a bit clumsy for now, this variable isn't set when you start your vm. Good news is, that you already figured everything you need to know out by installing and doing the port mapping. So, you basically just set it:
set DOCKER_HOST=tcp://
Make sure to point your general <configuration> section in the maven-docker-plugin to the same

Certificates and HTTPS Connections
Since 1.3.0 Docker remote API requires communication via SSL and authentication with certificates when used with boot2docker. So, you need to configure the certificates. Find them in the .boot2docker/certs folder and make sure to also add this path to your plugin configuration.

That's it for now. Let me know if you also have experiences about how to work with Docker on Windows.

Saturday, December 6, 2014

Setting Timeout for the JAX-RS 2.0 / Resteasy Client

07:40 Saturday, December 6, 2014 Posted by Test No comments:
, ,
Adam asked me about that at NetBeans Day in Munich. One part of the JAX-RS Client API isn't fully standardized but still very important looking at today's microservice architectures. I am talking about timeouts here. Adam showed how to set them for Jersey and I just needed to find out how to do the same with Resteasy.

import javax.ws.rs.client.Client;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;

 Client client = new ResteasyClientBuilder()
                .establishConnectionTimeout(100, TimeUnit.SECONDS)
                .socketTimeout(2, TimeUnit.SECONDS)

ResteasyClientBuilder is basically an abstraction for creating Clients which uses Apache Http Client under the covers. That's it.

Friday, December 5, 2014

Camel Subsystem for WildFly 8 integrates Java EE - Getting Started

15:00 Friday, December 5, 2014 Posted by Test No comments:
, , , ,
Just three days ago, the team around Thomas Diesler (@tdiesler) released the 2.0.0.CR1 version of the WildFly-Camel subsystem it allows you to add Camel Routes as part of the WildFly configuration. Routes can be deployed as part of JavaEE applications. JavaEE components can access the Camel Core API and various Camel Component APIs.
This release in particular added a number of new camel components to the subsystem and added support for the WildFly domain mode. Other than packaging and bootstrapping Camel in Java EE 7 yourself, this subsystem installs Camel directly into your WildFly 8.x server. As far as I know it even works with the latest 8.2.0.Final but isn't tested against it. Not, that there is a very light and easy way to bootstrap Camel in Java EE 7, but this approach enables even more integrations with Java EE standards. The ultimate goal for the subsystem is to provide Camel features as a directly usable option in WildFly without the need to configure or deploy anything. This is the main difference between a simple module and a complete subsystem.

Getting Started
Install WildFly 8.x by downloading the "Java EE7 Full & Web Distribution" from wildfly.org. Install by just extracting it into a folder of your choice. Next step is to download the distribution patch (53 MB, tar.gz) for WildFly from the JBoss Maven repository. After the download, navigate to the WildFly folder and extract the archive into it. That's it. Now start either standalone or domain mode with the respective *-camel.xml:
$ bin/standalone.sh|bat -c standalone-camel.xml

Some More Configuration
After we did that, you need to add some more users. First of all the management user.
$ bin/add-user.sh|bat 
Call it whatever you like. For convenience reasons I tend to name it admin with the password admin. But please keep in mind, that this is the worst practice you could apply ;)
After you're done with that, add another application user. To make it simple, we just name it the same with the same, insecure password.

Exploring What's There
After you integrated the subsystem into your WildFly you can find the Apache Camel and JBoss modules in the module folder. The standalone\deployments folder contains two war-files. One of them is HawtIo and the other one is the wildfly-camel.war which is basically the camel-cdi example but more on that later. First of all, point your browser to: http://localhost:8080/hawtio/ and login with the application user you created.

You can see, that the ActiveMQ and Camel tabs are enabled, which means both modules have been deployed and discovered by HawtIo. Drilling down into the Camel tab you can see two deployed routes. The versions used for the integration are Apache Camel 2.14.0, HawtIo 1.4.22 and Arquillian 1.1.2.Final.

High Level Features
The strategy of wildfly-camel is, that a user can “just use” the camel core/component APIs in deployments that WildFly supports already. In other words, Camel should “just work” in standard Java EE deployments. The binaries are be provided by the platform. The deployment should not need to worry about module/wiring details.
Defining and Deploying Camel Contexts can be done in different ways. You either can directly define a Context in your standalone-camel.xml server configuration or deploy it as part of your web-app either as a single XML file with a predefined -camel-context.xml file suffix or as part of another WildFly supported deployment as META-INF/jboss-camel-context.xml file.
The WildFly Camel test suite uses the WildFly Arquillian managed container. This can connect to an already running WildFly instance or alternatively start up a standalone server instance when needed. A number of test enrichers have been implemented that allow you have these WildFly Camel specific types injected into your Arquillian test cases; you can inject a CamelContextFactory or a CamelContextRegistry as an  @ArquillianResource.

Next Steps
You can simply undeploy the wildfly-camel.war and start over with your own application. You can either dig into the existing examples on GitHub or wait for my next blog-post to walk you through that a bit.
If you don't want to mess around with installing and patching, you can look at the ready available docker images which were published at wildflyext/wildfly-camel.

More Information
Apache Camel Website
WildFly Camel Integration GitBook
Planned Roadmap

I'm now a NetBeans Dream Team Member!

09:00 Friday, December 5, 2014 Posted by Test No comments:
, , ,
The NetBeans Dream Team is a community-driven group of highly skilled NetBeans users and contributors. They participate at NetBeans developer events, on mailing lists and developer forums, providing new, interesting and informative content as well as developing new and creative ways to promote and enhance NetBeans. And as of today, I'm accepted as a new member to this exclusive group of passionate people.
This might look a little odd, as most of my readers know that I am working at Red Hat and we have our "own" IDE. This is a good time to remember all of you about what open source is and that contributing isn't limited to companies or products. As long as the software is great, there is always a chance to work together. And looking at NetBeans and Red Hat/JBoss technologies a lot has been done in the past and many other parts are evolving.

WildFly Integration
Emmanuel Hugonnet (@ehsavoie) is the maintainer of the WildFly Plugin for NetBeans. Since NetBeans 8.0.1 this is built into the core and available for everybody to use WildFly directly from NetBeans. If you want to know more, make sure watch my developer interview with him.

OpenShift Integration
Cojan van Ballegooijen (@cvanball) is working on tooling to integrate Red Hat OpenShift as a Cloud service into NetBeans. You can contribute to his efforts by just forking the repository and sending patches.

And There Is More
I am convinced, that there is a lot more to do. A Camel integration would be a perfect next step. I might start doing one myself. If you are interested, I would love to organize a little project around it.

A big thanks to the NB team and the dream team members for accepting me. It will be a pleasure to work with you.

Thursday, December 4, 2014

Developer Interview (#DI 9) - Antoine Sabot-Durand (@antoine_sd) about CDI 2.0 and Java EE 8

12:00 Thursday, December 4, 2014 Posted by Test No comments:
, , ,
Time for another episode in my developer interview series. Yesterday I had the pleasure to talk to Antoine Sabot-Durand (@antoine_sd) who is the co-spec-lead of JSR 365 (Contexts and Dependency Injection for Java 2.0). Besides working on the CDI specification, he is also responsible for the CDI ecosystem at Red Hat - currently focused on DeltaSpike. He's also tech lead on Agorava, a CDI framework helping social media consuming.
He has been an IT consultant since 1996, and a Java developer since 2000. Today he is a senior software engineer at Red Hat.

Antoine often fly from his Paris home to meet the community by speaking at Devoxx, Java One, or various JUGs. When not writing specification, coding, tweeting or giving talks, Antoine likes spending time with his wife and 3 children.

Sit back, relax and get a #Coffee+++! Thanks Antoine  for taking the time!

Tuesday, December 2, 2014

Java EE with NetBeans on OpenShift

15:00 Tuesday, December 2, 2014 Posted by Test No comments:
, , ,
Today was NetBeans Day in Munich. I had the pleasure to present one session about the integration of Red Hat's products with my famous IDE. So, I've been talking about WildFly, EAP, Git, OpenShift Online and showed all the different ways optimize your development workflow with that tool-set.

It's been roughly 100 attendees and it was a pleasure to be there. Thanks everybody for making it, even if half of Germany was on strike or close to a traffic collapse. Here are the slides for your viewing pleasure. Please make sure to check out all the links in it.

Wednesday, November 26, 2014

Developer Interview (#DI 8) - The Red Hat Devoxx Keynote Demo Team explains it all

12:00 Wednesday, November 26, 2014 Posted by Test No comments:
, , , , ,
The last blog post about Devoxx and what happened there. Promised. But I really wanted to do this very special developer interview with the team behind the Demo. You already know everything about the technical details behind it and now it it time to let those speak, who actually implemented it.

Sit back, relax and get a #Coffee+++! Thanks to the team for taking the time!

Sebastien Blanc (@sebi2706) - Red Hat, Mobile, AeroGear, Unified Push Server
Erik Jan De-Witt (@edewit) - Red Hat, JavaScript, Node.js, AeroGear
John Frizelle (@johnfriz) - Feedhenry by Red Hat, Architect
Arun Gupta (@arungupta) - Director of Developer Advocacy at Red Hat
Ben Pares (@bparees) - Red Hat, OpenShift, Lead for xPaaS

Tuesday, November 25, 2014

JMS with JBoss A-MQ on OpenShift. Lessons learned about remote Clients and Encryption.

13:00 Tuesday, November 25, 2014 Posted by Test No comments:
, , , ,
OpenShift is the "open hybrid cloud application platform by Red Hat". It comes in different flavors and the most interesting part for most of the things you want to do is the public cloud application development and hosting platform "OpenShift Online". You can easily try it out because using OpenShift Online in the cloud is free and it's easy. All it takes is an email address. The free offering allows for up to three basic small gears and host up to three applications from a variety of different languages and frameworks. If you need more, you can upgrade your plan to a paid version. For more details look at the online feature comparison website.

JBoss A-MQ on OpenShift
The Java Message Service is an effective method for cross-system communication, even among non-Java applications. By basing itself on open source technologies and strong standards, RedHat OpenShift allows developers to easily move their JMS applications to the cloud or write new systems that leverage JMS messages with encrypted internet connectivity.
This post will cover the means for using two major applications: WildFly 8 for hosting web applications, and JBoss A-MQ for asynchronous messaging. Both applications can run on gears within the free tier of OpenShift.

Creating an A-MQ Gear
By deploying A-MQ to the OpenShift cloud, your gear will receive several publicly accessible ports. Client systems can then use these remote ports to connect to your A-MQ service. The endpoints require encryption, so no JMS message will ever be sent in plain-text across the internet.
The first step in creating your A-MQ gear is to clone the existing JBoss Fuse A-MQ cartridge. For those interested in cartridge management, you can view full details on this cartridge. (Note: If you are looking for an upstream cartridge with ActiveMQ, take a look at this blog.)
rhc create-app amq http://is.gd/Q5ihum
Upon creating, the gear provides three important pieces of information:
1. The administrative password that you will use to log in to JBoss Fuse, for managing A-MQ.
2. A new public key that clients must have in order to communicate with A-MQ. This
information looks like

3. A list of public ports A-MQ is using for remote connections.

Managing the encryption on OpenShift
The difference between clients and your OpenShift gear is that OpenShift needs the private key. If you need to change the keys, the keystore file is FILENAME. If you change keys, clients must have the public key before they will trust it. If you change the keys, you must restart the gear. If you forgot to copy your certificate during gear creation of you changed the keystore and need to extract is, use the following commands:
keytool -list -keystore ~/jboss-amq/jboss-a-mq-6.1.0.redhat-378/etc/keystore.jks
keytool -exportcert -alias (whatever it says) -keystore -file openshiftamq.cer
Download the openshiftamq.cer file using an SFTP client and configure clients.

Managing the encryption on clients 
1. Copy the text of your key into a file called amqpublic.cer. Copy each line, inclusive of the BEGIN and END lines.
2. Import the public certificate into a trust store that your clients will use.
keytool -importcert -alias openshiftamq -file openshiftamq.cer openshiftamq.jks
3. Put the openshiftamq.jks file as a classpath resource of your application or somewhere memorable. You won’t need the .cer file anymore but can still keep it around.
4. Within client code, configure this trust store to be used with A-MQ connections. If you do not do this step, clients will not trust the server.

private ConnectionFactory connection(String url) {
    ActiveMQSslConnectionFactory connectionFactory = new ActiveMQSslConnectionFactory(url);
    try {
        connectionFactory.setTrustStore("openshiftamq.jks"); //or file if not in classpath root
    } catch (Exception ex) {
        Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Unable to load trust store.", ex);
    connectionFactory.setTrustStorePassword("put your password here");
    return connectionFactory;

Remote communication from clients
One benefit of using the OpenShift Fuse A-MQ gear is that is exposes several external ports. As a result, your A-MQ service is available without requiring the rhc port-forward command. The URL for your A-MQ clients will look like this:
  • Gearname – the name of your gear within the administrative console.
  • YourDomain – Your standard OpenShift domain.
  • PORT – the numeric port number provided when you created the cartridge.
Configure clients using the ConnectionFactory code from above.

Additional ActiveMQ Configurations in your OpenShift Gear
Many configuration options from a standard A-MQ instance are available within your OpenShift instance. The configuration file for this is


with a few caveats. Namely, you can change the protocol of a <transportConnector /> but must not change the IP or port. The ports are controlled by your OpenShift Gear and are the only ones actually allowed from external areas.

Prevent accidental Gear idling
OpenShift is designed as a resource sharing system, and idle resources will essentially be put to sleep until accessed. JMS poses a particular problem on OpenShift in that if it is idle, connections will not function and new clients cannot connect.
To prevent this behavior, automate a script that periodically interacts with the JBoss Fuse web console or always keep at least one client connected to your A-MQ.

Wednesday, November 19, 2014

Infinite Possibilities - Trip Report Devoxx Belgium 2014

13:54 Wednesday, November 19, 2014 Posted by Test No comments:
, ,
Just a short few days back I was at Devoxx Belgium. For those not in the know. Devoxx Belgium is the premier European java conference and is often referred to as the Java One of Europe. It's a developer centric conference. The folks in attendance are generally language geeks, jvm junkies, performance nuts and general java enthusiasts. We, Red Hat, have been sponsoring the event for a few years now and had a premier stand along with a keynote slot at this years event.

Infinite Possibilities with JBoss, xPaaS and OpenShift
This was a very special Devoxx for me, because I had the opportunity to be part of the official Red Hat keynote. The demo which was part of it came together over a couple of weeks with a lot of engagement by many many peers. I already did post a complete technical rundown of what the audience was able to see. The slides used by Mike are published to slideshare in the meantime (embedded below) and we're looking forward to the recording which should go out to parleys.com soon.

(Source: BJUG Flickr Devoxx Album)
Red Hat at Devoxx
We had a very blue booth this year. It was fun to take part in the team who build all around it and it was just incredibly satisfying to see it all come together. James did the artwork and design, I helped with many tiny things and Karen-Jo held all the loose ends together. Ray, Arun, Karin and many many more also took part in shaping every detail around it.

(Source: BJUG Flickr Devoxx Album)
Red Hatters at Devoxx
From Red Hat's side there were a few folks from engineering, the BU, pre-sales, consulting and marketing. There's been plenty of speakers and sessions by Red Hatters. A complete list is available via jboss.org (Speakers/Sessions) and it was an endless resource of great presentations around all the things that move JBoss and middleware in Red Hat.

Friday, November 14, 2014

The 2014 Guide to Enterprise Integration is available

15:00 Friday, November 14, 2014 Posted by Test No comments:
, , ,
DZone made it again. Another one of their famous guides got published yesterday. This time it is all about Enterprise Integration. It contains articles by industry experts and the complete result from a survey of over 500 practitioners and developers which is probably the most interesting part. So, looking at the distribution of the different integration solutions:

"Out of all integration frameworks (EIP), ESBs, and
integration suites, Spring Integration is the most popular (42%) and Apache Camel is a close second (38%). [...]
Overall, 63% of respondents use an integration framework (e.g. Spring Integration, Camel) and 53% use an ESB or Integration Suite (e.g. Mule ESB, Biztalk), while 18% say they use neither. Note that 69% of respondents are from large organizations, where bigger integration scenarios would be more common."
(Source: DZone 2014 Guide to EI)

There is still some way to go to make Apache Camel and the JBoss Fuse offerings even more attractive to users, but we are listening and I would be happy to hear what you need or would like us to do to further foster adoption of the integration bits (either upstream or productized). Reach out to me via email or in comments to this blog post.

Find a brief introduction to Fuse by Sameer Parulkar (@sparulkar) on page 21. And I nearly forgot to mention, that I had the pleasure to contribute an article about "The Future of Developing & Integrating Applications" which can be found on page 22. Here is a short teaser:

"Think about how far software development has come in just the past five years. It’s hard to believe  that there was a time when generations of developers spent months or years setting up infrastructures
and integrating different applications and backends with each other."
(Source: DZone 2014 Guide to EI)

Get your version for free today!

On Java EE and Community - Voxxed Interview

12:21 Friday, November 14, 2014 Posted by Test No comments:
, ,
Devoxx is nearly a wrap. Beside the general awesomeness, Stephan and his team launched a new content website to be the number one stop for all topics related to technologies which are relevant for Devoxx attendees. While I've been at GeeCon, Lucy asked me for an interview which I happily gave. So we get to chat about WildFly development and explains why the Java EE needs you. And about  JBUGs (http://www.jboss.org/usergroups) and the Virtual JBoss User Group.

Thursday, November 13, 2014

Trip Report: Joker Conf 2014

13:00 Thursday, November 13, 2014 Posted by Test No comments:
, ,
I am traveling a lot lately and catching up with the trip reports is not easy. One of my favorite trips lately was my visit in St. Petersburg, Russia for Jokerconf. It is one of the most technical and Java centered conferences I've seen in a while. The session schedule is an endless list of high quality speakers and topics. Given that, I was honored to present about Java EE and JavaScript while the organizers try to cover even more topics and platforms in the Java space.
The biggest challenge was probably the preparation in this case. I had to get a visa and prepare for travel into a country which language isn't exactly near my own or even English. But the organizers did an amazing job and supported their international speakers. A big thank you for that, because without it it probably wouldn't have happened at all.

The Venue
It is held in the Raddisson Park In Hotel which is a very large hotel roughly 4 km away from the airport. It's no surprise that it has a full blown conference venue build into it and there was everything you could wish for. The room sizes ranged from normal to the very large theater like keynote room.

My Sessions
I gave two presentations about the "Best Features of Java EE 7" and "JavaScript in the Enterprise". Both very well attended and I got some questions afterwards. Find the slides for the sessions on my speakerdeck account. I am very much looking forward to attend next years version.

I tried to capture some impressions from the conference in a Google Plus story. There is also a JokerConf album on Google Plus if you want to get even more. It was fun to bring some WildFly, Java EE and JBoss to Russia! Thank you for having me!

Wednesday, November 12, 2014

What is your "x"? The technical details about the Devoxx Keynote Demo

11:00 Wednesday, November 12, 2014 Posted by Test No comments:
, ,
If everything went fine, I just got off the stage and ended the demo part of Mike's (@mpiech) demo. We talked a lot about xPaaS. The different pieces of the puzzle that we integrated and about our newest acquisition FeedHenry. I think, that all this is worth a more detailed blog post about the inner workings of the demo.

RedHat released a new version of OpenShift Enterprise 2.2 on the 10/10/14. This version also adds support for the private integration solutions (iPaaS) Fuse. Beside this, we recently acquired FeedHenry (mPaaS) and it was about time to show how those technologies actually integrate and help customers build solutions for tomorrows applications. I've been using the following overview in my latest talks to outline what a decent integration with all the different PaaS platforms might look like.
Architecting large Enterprise Java Applications (Slideshare)
On a very high level it contains exactly the parts and setup we used for today's demo. Which is the following:

I have to admit that it is far more complicated, than what we came up with in the demo on stage, but let's not complain and get over the different parts in more details.

Mobile App
The mobile part of the demo was build using Cordova this is very well supported by FeedHenry, from their application console you can create builds for iOS and Android, but also easily test it locally. We used the FeedHenry client side javascript library which beside many other things allows us to generate statistics for the application management console, this can be very helpful when you have a production issue and try to diagnose the problem, for instance. Using Cordova together with Node is really nice, no need to switch paradigms and you can rapidly try out new ideas.

FeedHenry Mobile Application Platform
FeedHenry is a cloud-based mobile application platform to design, develop, deploy and mobile applications. The platform provides specific services for security, notification and data synchronization. You can build hybrid apps for mobile devices and it covers the complete development lifecycle. You can think of it as an Xcode IDE in the cloud which has three different components for applications. Obviously the mobile app, a server backend which you can built on top of Node.js and so-called mPaaS services which can be re-used across different applications. The interesting part of the demo are the two services.
One which connects to JBoss A-MQ for xPaaS running on OSE via TCP/STOMP protocol and the other one connecting to an AeroGear unified Push Server instance running on OpenShift Online via REST.
The new AeroGear MBaaS Integration Services leverages the  Node.js module already developed by the AeroGear team and provides a simple, secure way to integrate Push Notifications into your FeedHenry apps. The service itself is quick and painless to set up – simply provide the details of your AeroGear installation and credentials for the AeroGear app you want to use and you are ready to go. Using the service is just as easy – as a standard FeedHenry MBaaS service, you can call it in exactly the same way as you would any other MBaaS service – with a clean, crisp FeedHenry API call.

AeroGear UnifiedPush Server on Openshift Online
The AeroGear project is a one stop solution for all your Push Notification needs – covering Native iOS & Android, Cordova Hybrid as well as Simple Push for Web. It is available to use right now from the OpenShift Marketplace – so feel free to give it a whirl.

JBoss Fuse and A-MQ for xPaaS on OpenShift Enterprise
JBoss Fuse for xPaaS and JBoss A-MQ for xPaaS are based on Red Hat’s traditional on-premise integration and messaging offerings, Red Hat JBoss Fuse and Red Hat JBoss A-MQ. The latest versions of both products, announced at Red Hat Summit 2014, introduced features such as full support for AMQP 1.0, a vast library of connectors, improved high availability, and the ability to manage processes. In this particular example both instances running are managed via the Fuse Fabric. And the deployment of the Camel route to receive the twitter stream of tweets actually was done via a profile on the fabric. Distributing those applications and infrastructures gets insanely easy by doing it like that.
At the end, the Camel rout isn't very magical. Just a few lines of code for a log and a little conversion to JSON to make it easier for the FeedHenry A-MQ endpoint to consume it on the Node.js end. This screenshot was taken before the demo happened, I hope that we have some higher numbers after the keynote.
The A-MQ side is even more simple. A basic standalone broker setup with just one queue called "tweets" like you already might have guessed. We are using two different client connectors. The Camel instance pushes messages via OpenWire and the FeedHenry service listens to them using STOMP. We're actually not sending around binary content here, so this was the easiest setup.
To be clear at this point: The Twitter integration is a nice showcase which we used to have a contact point with the audience. In real life scenarios you're going to connect heavyweight stuff with Fuse. Like SAP, Oracle EBS, you name them.

The beauty of this is the overly complex architecture. We could have taken many shorter ways to make it work, but on the other hand, it was a very good exercise. In less than two weeks the RedHat and FeedHenry teams made both technical integrations possible. And we are very proud to have integrated this first chunk of services and help to better understand for what the different products are meant to be used.

My Thank You's
Even if I had the pleasure to be on stage for the demo, I only did the very simple backend part. There are a bunch of folks, I'd like to mention here:
- John Frizelle and Conor O'Neill for being our 24/7 contact into FeedHenry. There's not a single thing those two couldn't solve.
- Jay Balunas, Erik-Jan De Wit, Sebastien Blanc and Matthias Wessendorf for developing the mobile bit's and pieces and writing the Node.js service that we now have available in FeedHenry
- Ben Parees, Grant Shipley, Marek Jelen, Hiram Chirino for all their efforts aroun OpenShift Online AND the Enterprise deployment that we used for the demo
- Mike and Arun for all their support around the demo and their patience because we didn't have it ready until the very last minute.
- Christian Posta for holding my hand with all kinds of stupid Fuse questions

Further Readings
If you are curious, you can just get started with reading some more about what we did. Please keep in mind, that the acquisition is quite new and we still don't have a publicly available version of FeedHenry ready for you to play with. But this is in the works. Keep your eyes open.

Friday, October 24, 2014

Trip Report: OpenSlava 2014

12:00 Friday, October 24, 2014 Posted by Test No comments:
, , ,
I had the pleasure to attend OpenSlava conference in Bratislava last week. It is a one day event which is comparably new and launched last year. This year it grew even bigger and even expanded to another area at the Faculty of Electrical Engineering and Information Technologies (FEI STU) of Bratislava. And as there are no registration fees for the conference, it is a great chance to catch up with a lot of interesting speakers.

Bratislava is a wonderful city and it is a pity that there was barely enough time to see a little bit of it. The organization of the event was great and everything went smoothly. So, thank you to the whole team! If you want to receive updates on the event make sure to follow @OpenSlava on Twitter or like the OpenSlava Facebook page.

I gave a presentation about the 50 Best Features of Java EE 7. The slides are published on speakerdeck. Sorry for having to squeeze everything into 35 minutes. It was a funny rush and I hope the attendees enjoyed it!

And you can also watch the recording of the talk on youtube:

There are many other recordings on the youtube account, so make sure to also check out:
- Mark Little talking about "Open Source Trends"
- Marek Jelen abut how to "Bring DevOps to the Enterprise with PaaS"
- Karoly Nagy and "The next wave in BPM from Red Hat"

I leave you with a bunch of impressions from the venue and the city. Thanks for having me! Looking forward to next year!

Wednesday, October 15, 2014

Developer Interview (#DI 7) Matthias Wessendorf (@mwessendorf) about Openshift, Aerogear and how to bring Java EE to Mobiles

12:00 Wednesday, October 15, 2014 Posted by Test No comments:
, , ,
Welcome to another episode of my developer interviews. It is my pleasure to introduce Matthias Wessendorf (@mwessendorf, blog), whom I know since a long time already. We've been working in and around Java EE for quite a while and met again in Red Hat finally.

Matthias is working at Red Hat where he is leading the AeroGear project. Previously, he was the PMC Chair of the Apache MyFaces project. Matthias is a regular conference speaker.

We've been talking about all kinds of mobile and his project AeroGear and OpenShift and how to connect Java EE backends to Mobiles of any kind.

Sit back, relax and get a #Coffee+++! Thanks Matthias for taking the time!

Monday, October 13, 2014

Virtual JBUG at JavaOne - Infinispan, Java EE 7, Hibernate, CDI, Ceylon and Arquillian

00:00 Monday, October 13, 2014 Posted by Test No comments:
, ,
You have heard about the Virtual JBoss User Group before. It is your unique chance to catch up with all kinds of technologies and methodologies presented by well known Redhatters and community members from all around the world. Just a short week ago the vJBUG was live-streaming the Red Hat mini-booth sessions from JavaOne and we made all of them available for your to watch if you haven't been able to catch up.
Keep an eye on our Youtube Channel, join the Google+ page, follow us on Twitter @vJBUG and make sure to register on our Meetup group.

Test ride of the Arquillian Universe
Aslak Knutsen (@aslakknutsen, Blog, GitHub) & Bartosz Majsak (@majson, Blog, GitHub)
Learn about Arquillian's unknown features and how to use the testing related services which are provided by Drone and other extensions.

Ceylon's fast-growing ecosystem
Stéphane Épardaud (@UnFroMage, Blog, GitHub)
Learn all about Ceylon's fast growing ecosystem. Ceylon is a new modern JVM and JSVM language with a nice blend of functional and object, modularity and great tooling, designed first and foremost for team work.

Java and Mongo for a fun mapping experience
Steve Citron-Pousty (@TheSteve0, Blog, GitHub)
You have a great idea for quick and interesting mapping application with pins on a map with some basic search. Then you lose interest because of all the pieces to install. NOT ANYMORE! In this workshop we are going to use 1 command to spin up all our infrastructure (EAP and MongoDB). Then write some quick and easy Java EE code to build a REST service on MongoDB. To wrap it up we will use a simple Leaflet application to display the results. You will witness the transformation from idea to cool pinny map in this quick session.

Going Native: Bringing FFI to the JVM
Charles Nutter (@headius, Blog, GitHub)
How to make it easier to call native code on the JVM and what the future might be.

The Path to CDI 2.0
Antoine Sabot-Durand (@antoine_sd, Blog, GitHub)
CDI has proven itself to be a great asset for Java. The many features it provides (dependency injection, contextual lifecycle, configuration, interception, event notification, and more) and the innovative way it provides them (through the use of meta-annotations) explain its rapid adoption. This session reviews the features introduced in CDI 1.1 and 1.2 and discusses improvements planned for CDI 2.0.

Automatically scaling Java applications in the cloud
Steve Citron-Pousty (@TheSteve0, Blog, GitHub)
Steve shows how to automatically scale Java EE applications on a PaaS environment using JBoss EAP and OpenShift. In a live demo he deploys an application to the cloud and then turn up the heat by running a load test with thousands of users.

Building Java EE Applications FAST
George Gastaldi (@gegastaldi, Blog, GitHub) & Lincoln Baxter (@lincolnthree, Blog, GitHub)
George and Lincoln will demonstrate the power of JBoss Forge, while creating an end-to-end Java EE application in mere minutes.

Mythbusters: ORMs and SQL - Good or Bad?
Emmanuel Bernard (@emmanuelbernardBlogGitHub)
Java is an object-oriented kingdom where ORMs have flourished. This episode explores key myths and preconceptions about ORMs in a NoSQL and polyglot era. Join this journey to challenge these myths and find out if they are busted, plausible, or confirmed.

Developing Modern Mobile Applications
Sébastien Blanc (@sebi2706, Blog, GitHub)
This live coding session, driven by Java and using a familiar development environment, goes step by step through building a complete mobile, hybrid, multiplatform application ready to be distributed on different vendors’ stores, such as the Apple store or Google Play.

Develop Modern Java Web Applications with Java EE 7
Grant Shipley (@gshipleyBlogGitHub)
Grant showcases how easily you can develop Java EE 7 applications with OpenShift. A live coding session building a Java EE 7 application on WildFly application server using MongoDB as a database.

Scaling Your Database With Infinispan
Mircea Markus (@mirceamarkusBlogGitHub)
Ways of scaling out database systems using the Infinispan data grid.

Friday, October 10, 2014

Come and learn about OpenShift, JBoss Fuse, Fabric8 and HawtIO

12:00 Friday, October 10, 2014 Posted by Test No comments:
, , , ,
Attend Red Hat's complementary, hands-on technical workshop and experience Red Hat JBoss Fuse and OpenShift. Learn how middleware and cloud solutions bridge the theory with reality. Come and learn about OpenShift, JBoss Fuse, Fabric8 and HawtIO, and how these technologies can help you implement a successful DevOps strategy with Automation, Continuous Delivery, and a deep understanding of your middleware.

After attending this FREE 1-day workshop you’ll be able to:
  • Learn how integration Platform-as-a-Service (iPaaS) connects on premise and cloud solutions, and reap the operational efficiencies that OpenShift brings combined with the messaging and routing/mediation/transformation of Red Hat JBoss Fuse.
  • Work with hands-on labs based on real-world case studies led by experienced solution architects.
  • Learn how to use open source integration and messaging software safely and securely in your enterprise.
October 22, 2014 – San Francisco
October 23, 2014 – Los Angeles
October 28, 2014 – Chicago
October 29, 2014 – New York
November 4, 2014 – Houston
December 2, 2014 – Boston
December 3, 2014 – Atlanta

Please make sure to bring a laptop with a minimum of 2GB of RAM (4GB if using a virtual machine) and register at the official event website.

Thursday, October 9, 2014

Developer Interview (#DI 6) Geert Schuring (@geertschuring) about Fuse, Tinkerforge with Apache Camel and Open Source

12:00 Thursday, October 9, 2014 Posted by Test No comments:
, , , ,
I'm happy to welcome you to another episode of my developer interviews. This time happening in the same timezone and a bright awake Markus got the chance to talk to Geert Schuring (@geertschuring, blog) wo works for Dutch Luminis. We talked about his latest project with JBoss Fuse and why he loves it a lot. Beside that he gave a very impressive demo which will make my daughters jealous: He controlled a Tinkerforge LED panel with the help of Apache Camel routes (Find the source code for the Camel component in his Bitbucket repository).

Geert is working as a Java developer since 2006. He always loved the open source concept, and particularly anything that had to do with messaging. For him working on messaging systems and service oriented applications is like playing transport tycoon. He specialized in the Camel/ActiveMQ combination, and particularly in the RedHat Fuse product. At home he likes to install computers and attach a bunch of sensors to them to collect all data. So he is monitoring temperature, humidity, lighting levels, and motion in every room.

As usual, time to grab a coffee+++ and lean back while listening! Thank you Geert, for taking the time!!