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.
Related Whitepaper:

Java Essential Training

Author David Gassner explores Java SE (Standard Edition), the language used to build mobile apps for Android devices, enterprise server applications, and more!

The course demonstrates how to install both Java and the Eclipse IDE and dives into the particulars of programming. The course also explains the fundamentals of Java, from creating simple variables, assigning values, and declaring methods to working with strings, arrays, and subclasses; reading and writing to text files; and implementing object oriented programming concepts. Exercise files are included with the course.

Get it Now!  

Leave a Reply


8 × = sixty four



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
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.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books