Fuse technology-2015
- 2. Agenda
What is Fuse Technology
Integration Platform
Routing & Mediation : Apache Camel, CXF
Modular Container : Apache Karaf
Management & Provisioning : Fabric8, Hawtio
Security Policy Management : ApiMan, Keycloak
Demo
- 3. Who
Principal Solution Architect & Fuse Expert
Blog:
Twitter: @cmoulliard
Email:
Committer on Apache Camel, Karaf, Fabric8, Hawtio … & PMC
Technology evangelist
Mountain Biker, Blogger
http://cmoulliard.github.io
cmoulliard@redhat.com
- 6. Integration platform
Manage Complex use cases
correlation, orchestration, routing,
mediation, transformation
Provide BUS exchange
messages
Designed around different specs:
JBI, SCA
- 7. ESB & JBI
Services & Components
communicate using NMR
bus
Packaged as zip (=SU) in a
big zip (=SA) including xml
config, target service
Constraint : messages
formated as XML
EIP not included in the
spec
- 13. Convert Type
Type Converter Strategy
Allow to convert the body payloads from one
type to another
To and From these types
File
String
byte[] and ByteBuffer
InputStream and OutputStream
Reader and Writer
- 14. Data Format
Data Transformation for complex use case
Marshalling : Object XML (JAXB)
Unmarshalling : XML Object (JAXB)
packagemy.cool.demo;
importjava.io.InputStream;
importjava.io.OutputStream;
importorg.apache.camel.Exchange;
publicinterfaceDataFormat{
voidmarshal(Exchangeexchange,Objectgraph,OutputStreamstream)throwsException;
Objectunmarshal(Exchangeexchange,InputStreamstream)throwsException;
}
- 30. Facts
In-Memory bus
Support Object : XML, File, Stream, Bytes
Predicate & Expression language (xslt, xpath, …)
Sync/Async exchanges
Threads Management
Tx Architecture
Error & Exception handling
Policy driven
Container Agnostic
- 32. Architecture
Technology Camel, CXF, ActiveMQ, Spring, Fabric, …
Modular platform deploy or remove container/libraries
- 33. Core features
SSH server
Allow to administrate/create instances
Provide provisioning solution features
Hot deployment
Configure & manage instances
JAAS Security layer
Role Base Access Control (RBAC)
- 34. Integration container
Camel routes isolated from each other (classloader)
Bundle CamelContext boundary acting as a Local BUS
Camel routes can have different SLA (Threads, Policies, …)
- 39. Features
Manage container creation (locally, remotely, cloud, openshift, docker, …)
Visualise what is running into JVM to understand your platform
Monitor whats running and easily scaling up or down
Support Upgrade via Version changes and Rollback
Virtualize services (endpoints), processes
Search and storage engine for logs, camel, messages, metrics
- 40. Karaf limitations
Karaf can create new instances
(locally) & administrate them (locally
or remotely)
Instances are not cloned
Configurations must be managed (manually, script)
- 42. Coordinating System : Zoo
Rely on Zookeeper server (ensemble of 1,3, 5 or servers)
Coordinating distributed systems in a reliable way (electing leaders,
implementing master/slave, sharding or federation of services).
- 43. Fabric Agents
Are the clients of the Zookeeper server(s)
They will communicate with Zk server to :
register container info (ports, services, endpoints, processes)
get their provisioning
- 44. Profiles
Behavior of a container
Envelope(s) containing artifacts to be deployed, parameters (system, jvm,
services) to be configured
Can be versioned, facilitate mngt - rollback
- 49. Info collected
Logs, Camel metrics, JMX metrics, your own
data/JSON metrics
importorg.apache.camel.Header;
importorg.fusesource.insight.storage.StorageService;
importjava.sql.Timestamp;
importjava.util.Date;
publicclassStoreService{
privatestaticStringES_TYPE="insight-tweet";
privatestaticStorageServicestorageService;
publicstaticvoidstore(@Header("tweet-full")Stringdata){
storageService.store(ES_TYPE,generateTimeStamp(),data);
}
- 54. Jolokia ?
Command line tools jmx4perl, j4psh
JMX / HTTP Bridge
REST API : read attributes, execute
operations
- 55. Modern HTML5 Architecture
Hawtio = A combination of the most powerful web technologies
Front end : HTML5 with AngularJS & JSON / REST
Backend : Java Servlet & Jolokia JMX gateway
- 56. Communication …
Web client communicates to Jolokia agent over HTTP(S)
Send Messages represented in JSON Format to Jolokia REST Servlet
Jolokia translates the request/response & map the JSON payload with JMX
Calls
- 57. Domain
JMX Domain / context
java.lang,
com.sun.management,
java.util
org.apache.camel
io.hawt
…
Attributes & operations
- 58. Plugin
What is a plugin ?
Collection of UI
JSON
request(s)/response(s)
JS lib to do the
rendering
- 59. Plugin Front
Mix of HTML tags & angular directives ng-*
Angular ng-controller defined within HTML <div> tag
<divclass="row-fluid"ng-controller="Tomcat.TomcatController">
<divclass="row-fluid">
<divclass="pull-left">
<formclass="form-inlineno-bottom-margin">
<fieldset>
<divclass="controlscontrol-groupinline-blockcontrols-row">
<divclass="btn-group">
<buttonng-disabled="selected.length==0"class="btn"ng-click="start()"title="Start"
class="icon-play-circle"></i></button>
<buttonng-disabled="selected.length==0"class="btn"ng-click="stop()"title="Stop">
class="icon-off"></i></button>
<buttonng-disabled="selected.length==0"class="btn"ng-click="reload()"title="Refresh"
class="icon-refresh"></i></button>
<buttonng-disabled="selected.length==0"class="btn"ng-click="uninstallDialog.open()"
class="icon-eject"></i></button>
</div>
</div>
</fieldset>
</form>
1
1
- 60. Plugin Controller
Map HTTP request with applicationsHTML page
Idem for the connectorspage
moduleTomcat{
varpluginName='tomcat';
exportvar_module=angular.module(pluginName,['bootstrap','ngResource','ui.bootstrap.dialog',
_module.config(["$routeProvider",($routeProvider)=>{
$routeProvider.
when('/tomcat/server',{templateUrl:'app/tomcat/html/server.html'}).
when('/tomcat/apps',{templateUrl:'app/tomcat/html/apps.html'}).
when('/tomcat/connectors',{templateUrl:'app/tomcat/html/connectors.html'}).
when('/tomcat/sessions',{templateUrl:'app/tomcat/html/sessions.html'});
}]);
1
2
1
2
- 61. Jolokia Request
Javascript function called to execute a GET request of type execor read
Mbean & Attributes OR Operation are passed as parameters
onSuccess calls function for the rendering
jolokia.request({
type:'exec',
mbean:id,
operation:op,
arguments:null
},
onSuccess($scope.onResponse,{error:$scope.onResponse}));
- 62. Jolokia Search
Search operation is supported
Find MBeans according to a search querybased on the type of the MBean
to find
A search query to find the type Connector
Anoter search query for mbeans based on the type
"*:j2eeType=WebModule,*"
functionloadData(){
varconnectors=jolokia.search("*:type=Connector,*");
if(connectors){
varfound=false;
angular.forEach(connectors,function(key,value){
varmbean=key;
if(!found){
vardata=jolokia.request({type:"read",mbean:mbean,attribute:["port","scheme","protocol"
...
jolokia.search("*:j2eeType=WebModule,*",onSuccess(render));
}
1
2
1
2
- 63. Jolokia Response
Response rendered & parsed
JSON result mapped with angular objects $scope.*
functionrender(response){
response=Tomcat.filerTomcatOrCatalina(response);
$scope.webapps=[];
$scope.mbeanIndex={};
$scope.selected.length=0;
functiononAttributes(response){
varobj=response.value;
if(obj){
obj.mbean=response.request.mbean;
varmbean=obj.mbean;
//computetheurlforthewebapp,andwewanttousehttpasscheme
varhostname=Core.extractTargetUrl($location,$scope.httpScheme,$scope.httpPort);
obj.url=hostname+obj['path'];
1
2
1
2
- 64. Plugins
Plug-an-play architecture ( > 25 plugins )
UI updated in real time
Some are Packaged : jvm, threads, dashboard, camel, activemq, …
Some are Server side : git, maven, aether, log
Some are External : insight, elasticsearch, kibana
Reusable for developers (branding, datatable, forms, ide, perspective, tree,
ui)
- 68. Integration & Mediation Platform
> 100 components : file, jms, ftp, …
> 50 EIP Patterns : content based router, splitter, aggregator, …
- 71. Point-to-Point Messaging
Producer sends message(s) to queue using JMS API
Consumer listens for message(s) from queue
Messages stored until read or expired
Messages can be persisted, are read only once
- 73. Publish and Subscribe
Client sends message to topic
Broker sends message to all currently connected subscribers
Messages are consumed x times (1-to-many)
- 74. Durable Subscriber
Messages usually expire when subscriber(s) not connected
Supports connection/disconnection
DurableSubscriberproperty = unique client ID registered to broker
Subscriber client ID controls messages delivered to broker
- 75. Request/Reply
Producer sets 2 properties to send message
JMSReplyTo: Destination for response message
JMSCorrelationID: Unique ID matches/correlates messages
(request/response)
Consumer replies to JMSReplyTodestination using JMSCorrelationIDin
message
- 76. Network of Brokers
Created when one broker establishes network connection to another broker:
Supports multiple connectors
To define as bi-directional, use duplex=true:
- 78. Future - Fuse 7
Fabric8 - V2
More integrated Openshift v3, Kubernetes & Docker
Service Management & Governance : ApiMan
OAuth2 Server, IDM : KeyCloak
- 79. JBoss Fuse in action
DEMO
Design REST Service using Camel
Deploy on JBoss Fuse using a profile
Create container & expose REST Service using Fabric
Define Security Policy for the endpoint
Authenticate the user (BASIC - static realm)
Authorize using Oauth2
Rest DSL in Action :
Camel & Mobile :
https://github.com/FuseByExample/rest-dsl-in-action
https://github.com/cmoulliard/feedhenry-camel