DevOps

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.

Christian Posta

Christian is a Principal Consultant at FuseSource specializing in developing enterprise software applications with an emphasis on software integration and messaging. His strengths include helping clients build software using industry best practices, Test Driven Design, ActiveMQ, Apache Camel, ServiceMix, Spring Framework, and most importantly, modeling complex domains so that they can be realized in software. He works primarily using Java and its many frameworks, but his favorite programming language is Python. He's in the midst of learning Scala and hopes to contribute to the Apache Apollo project.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button