Christian Posta

About Christian Posta

Christian is a Principal Consultant at FuseSource specializing in developing enterprise software applications with an emphasis on software integration and messaging.

Fabric8 HTTP Gateway

I recently put together a quick Github project to show the Fabric8 HTTP gateway in action. It shows a sample project that you can use to test out the HTTP Gateway. The example/camel/cxf profile that comes with Fabric8 basically does the same thing now.

Fabric8 Gateway

The Fabric8 project — pronounced fabricate — is a practical DevOps framework for services running on the JVM. Things like automated deployment and centralized configuration management come out of the box and are consistent regardless of JVM container (or no container — microservices) you use.

 
One of the other cool features that Fabric8 gives you out of the box is the ability to dynamically lookup, load balance, and version your services (MQ, REST/http SOAP/http, etc). Clients that live within a “fabric” created by “fabric8″ can automatically take advantage of this. Your external clients can too with the Fabric8 Gateway feature. When combined with Apache Camel routes that expose CXF you can get very powerful service discovery using Fabric8.

The sample project comes with three simple REST implementations and deployments that you can use to exercise and test out the Gateway for yourself.

How To

First, start by grabbing Fabric8 or its downstream, supported by Red Hat, cousin: JBoss Fuse.

Start it up:

fabric8-home$  ./bin/fabric8

Or on JBoss Fuse:

fuse-home$  ./bin/fuse

Next, you’ll need to build this project:

project-home$  mvn clean install

And navigate to one of the sub-projects in the sample distro (example: beer-service)

Now you’ll have to invoke the fabric8-maven-plugin to install the profile into Fabric8/JBoss Fuse. See the fabric8-maven-plugin for more details on what it does and how to set it up:

beer-service$  mvn fabric8:deploy

Now navigate to the web console (http://localhost:8181) and go to the Wiki tab. You should see your profile there under the loadbalancer group:

beer-service-wiki

 
These profiles are the declarative description of what resources need to be deployed to a JVM container. You can read more about Fabric8 Profiles to get a more thorough understanding. In this case, we’re deploying some Camel routes and describing its dependencies on some features that provide automatically registering the CXF endpoints into the API registry.

Now create a new container with that profile.

This new container will host your Camel routes that implement this REST service functionality.

create-new-beer
 

You should have a new beer container:

container-list-beer
 

Now add a new container and give it the http gateway profile:

create-new-gateway
 

Now you have your beercontainer and your http gateway container:

list-gateway-beer
 

Now you can ping the beer service through the gateway at: http://localhost:9000/cxf/beer:

final-output-beer

If you have any questions about this that the screen shots don’t capture, please let me know in the comments.
The HTTP Gateway is a very powerful feature of Fabric8. For JBoss Fuse this feature is in tech preview.

Reference: Fabric8 HTTP Gateway from our JCG partner Christian Posta at the Christian Posta – Software Blog blog.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


4 + nine =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close