2
votes

I am new to JBoss Fuse and the stack of Karaf, Camel, Fabic8, CXF.

I'd like to deploy a simple restful service to JBoss Fuse (6.2.1).

I'd like to ideally use Spring Boot, since it makes development/testing easier on standalone dev boxes (can boostrap servlet container, etc). I'd additionally like to minimize as much as possible (or eliminate) any XML configuration beyond the Maven POM. So Spring Java Configuration instead of XML configuration. I'm open to using either Spring-MVC or Jax-RS/CXF for the service.

Is this achievable and a "good" course to take?

I cannot seem to find any workable examples that are similar. Can someone point me to an example or offer some tips to get going with this? I'm already familiar with Spring/Spring-MVC/Jax-RS in general. But between Karaf/Camel/Fabric8/OSGi, various deployment options, etc., I'm spinning in circles and having trouble getting started.

Thanks!

Just to clarify, this is for JBOSS Fuse on Karaf, not Fuse EAP.

2

2 Answers

5
votes

I dont think this is achievable, and if it is, it probably shouldn't be.

Firstly, Java config:

Sure, you can have Spring java annotations with your Camel components on Fuse, bearing in mind that Fuse 6.2 utilises spring 3.2, so you are pretty much stuck with whatever support for Java config that provides. I haven't tried this but would definitely endorse it.

Secondly, Fuse and Spring Boot:

In terms of Spring Boot, Fuse and spring boot are not really compatible as they are both containers for running your application (The scope of the Fuse container is much wider than spring boot, but fundamentally they both want to be managing the execution environment for your application).

What to do?

If you just want to run a REST web service and don't require any of the other Fuse 'benefits', then Spring Boot is a very capable container for your services and you can just chuck out all the Fuse stuff (although you could utilise Camel and AMQ just by using the java libraries within your application).

If you need to use Fuse as your execution environment then you really don't want to use spring boot. Presumably there's a need for OSGI, Fabric and so on so you need to wear the Fuse straight jacket. For REST endpoints, I would look at the camel-rest component, however if you really want to use jax-rs JSR311 resource bindings then it's described in the camel docs, although I have not tried this using Fuse (6.2 uses camel 2.15 so this should work).

To throw another spanner in the works, I've had a great time recently using dropwizard as a container for my REST services, which heavily utilises Jax-RS and jersey (which I prefer to the horror of CXF configuration) and doesn't do as much magic auto configuration as spring boot.

2
votes

Since your questions has many parts, I shall try to break them down and give my opinion and the thought process behind that :

  1. "Spring BOOT makes development and testing easier" & "avoiding XML configurations"- True that. To prototype locally, you could use an embedded tomcat to develop, deploy and test quickly. Once you are ready to deploy to any application server (JBoss Fuse in your case), you can rmeove the embedded tomcat plugin from the POM and just deploy the generated artifact
  2. "Usage of Spring Java Configuration" - This is not necessary if you use Spring BOOT, it will give you all the options required for configuration.
  3. To get started (from usage of the framework like annotations to creating an artifact to deply on JBoss), the official docs cover all the steps [Example projectw with the embedded tomcat - https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-tomcat & tutorial - http://spring.io/guides/gs/rest-service]
  4. Deployment options - If you are using Maven, then compilation to artifact creation lifecycle is covered. And to automate deployment along with handling the Maven lifecycle on the server, Jenkins is a good candidate: Unfortunately I havent used the others candidates you have mentioned.