SlideShare a Scribd company logo
Scalable Integration
JBoss Fuse
&
JBoss Data Grid
Chris&na	
  Lin	
  
Agenda	
  
•�� Background	
  
– JBoss	
  Fuse	
  
– JBoss	
  Data	
  Grid	
  
•  When	
  size	
  and	
  &me	
  does	
  ma<er	
  
•  Technical	
  Details	
  
•  Hands-­‐on	
  
– 11:45	
  done	
  
JBoss	
  Fuse	
  
Heavy	
  LiGing	
  
Class	
  MyFileReader{	
  
….	
  
while	
  ((line=reader.readLine())	
  !
=	
  null)	
  {	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
writer.write(line);	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
writer.newLine();	
  	
  	
  //	
  Write	
  
system	
  dependent	
  end	
  of	
  
line.	
  	
  	
  	
  	
  	
  	
  	
  }	
  
……	
  
}	
  
Class	
  MyJAXBConverter{	
  
…..	
  
JAXBContext.newInstanceUnm
arshaller	
  unmarshaller	
  =	
  
jc.createUnmarshaller();	
  
unmarshaller.unmarshal(xml);	
  	
  	
  	
  	
  	
  	
  	
  	
  
marshaller.setProperty(Marshal
ler.JAXB_FORMATTED_OUTPUT
,	
  true);	
  
….}	
  	
  	
  	
  	
  	
  	
  	
  	
  
Class	
  JMSConnector{	
  
…..	
  
Connec&onFactory	
  
connec&onFactory	
  =	
  
null;Des&na&on	
  dest	
  =	
  null;try	
  
{	
  	
  connec&onFactory	
  =	
  
(Connec&onFactory)	
  	
  	
  	
  
jndiContext.lookup("jms/
Connec&onFactory");	
  	
  dest	
  =	
  
(Des&na&on)	
  
jndiContext.lookup(destName);	
  	
  
}}	
  catch	
  (Excep&on	
  e)	
  	
  
….}	
  	
  	
  	
  	
  	
  	
  	
  	
  
Class	
  Appraiser{	
  
	
  	
  …..	
  
	
  	
  if(houseInfo	
  !=	
  null){	
  
	
  	
  appraisedValue	
  +=	
  
houseInfo.getLandSize()*	
  1000	
  
	
  	
  appraisedValue	
  +=	
  
houseInfo.getBathroom()	
  *	
  2000;	
  
	
  	
  appraisedValue	
  +=	
  
houseInfo.getBedroom()	
  *	
  2500;	
  
	
  	
  houseInfo.setAppraisedValue(	
  
appraisedValue);….}	
  	
  	
  	
  	
  	
  	
  	
  	
  
etc...	
  
Easier	
  with	
  JBoss	
  Fuse	
  
A-MQ
File
JDBC
SFTP
Salesforce
SAP
Twitter
Facebook
JBoss	
  Data	
  Grid	
  
NOSQL	
   Cache	
   JBoss	
  Data	
  Grid	
  +	
   =	
  
JBoss	
  Data	
  Grid	
  
Applica&on	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
RDBMS	
  
In-Memory	
  
Cache	
  
Applica&on	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
In-Memory	
  
Cache	
  
Applica&on	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
In-Memory	
  
Cache	
  
Applica&on	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
In-Memory	
  
Cache	
  
Applica&on	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
In-Memory	
  
Cache	
  
Applica&on	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
In-Memory	
  
Cache	
  
JBoss	
  Data	
  Grid	
  
Applica&on	
   Applica&on	
   Applica&on	
  
In-Memory	
  
Cache	
   In-Memory	
  
Cache	
  
In-Memory	
  
Cache	
  
In-Memory	
  
Cache	
  
In-Memory	
  
Cache	
  
In-Memory	
  
Cache	
  
In-Memory	
  
Cache	
  
In-Memory	
  
Cache	
  
In-Memory	
  
Cache	
  In-Memory	
  
Cache	
  
JBoss	
  Data	
  Grid	
  
Applica&on	
  
	
  
	
  
	
  
	
  
	
  
Data	
  Grid	
  
API	
  access	
  to	
  Data	
  
Data	
  Grid	
  
C++	
   Java	
  
.Net	
  
When	
  SIZE	
  and	
  
TIME	
  does	
  
ma<er	
  !!??	
  
JBoss	
  Fuse	
  &	
  JBoss	
  Data	
  Grid	
  
Large	
  amount	
  of	
  Data	
  	
  
•  Incoming	
  data	
  	
  
•  Processing	
  Data	
  
•  Providing	
  output	
  	
  
Incoming	
  data	
  	
  
•  Polling	
  Consumer	
  
•  Thro<ler	
  Pa<ern	
  
Incoming	
  data	
  	
  
Integra&on	
  Service	
  
Integra&on	
  Service	
  
Integra&on	
  Service	
  
Processing	
  Data	
  
•  Splimng	
  your	
  content	
  
•  Enable	
  streaming	
  
Processing	
  Data	
  
•  Filter	
  your	
  content	
  
Providing	
  output	
  	
  
•  Publish	
  and	
  subscribe(Topic)	
  in	
  messaging	
  
	
  
•  Caching	
  medium	
  
The	
  	
  
Technical	
  	
  
Details	
  
Setup	
  JDG	
  
•  Setup	
  Data	
  Grid	
  in	
  Fuse	
  
<bean id="cacheManager"
class="org.infinispan.manager.DefaultCacheManager"!
! !init-method="start" destroy-method="stop">!
!<argument value="infinispan.xml" />!
</bean>!
Setups	
  
•  In	
  infinispan.xml	
  
<transport>	
  
	
  	
  <proper&es>	
  
	
  	
  	
  	
  	
  	
  	
  <property	
  name="configura*onFile"	
  value="jgroups-­‐tcp-­‐sample.xml"/>	
  
	
  	
  	
  </proper&es>	
  
	
  </transport>	
  
	
  	
  	
  	
  	
  	
  	
  <namedCache	
  name="stock-­‐file-­‐cache">	
  
	
  	
  	
  	
   	
  <jmxSta&s&cs	
  enabled="true"/>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <clustering	
  mode="replica*on">	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <async/>	
  
	
  	
  	
  	
  	
  	
  	
  	
  </clustering>	
  
	
  	
  	
  	
  	
  	
  	
  	
  <evic&on	
  maxEntries="30"	
  strategy="FIFO"/>	
  
	
  </namedCache>	
  
CAMEL-­‐JBOSSDATAGRID	
  
COMPONENT	
  	
  
	
  
•  Support	
  camel	
  endpoints	
  	
  
•  Supports	
  both	
  in	
  library	
  and	
  in	
  remote/
standalone	
  	
  
JBoss	
  Fuse	
  
	
  
	
  
	
   JDG	
  
JDG	
  
Camel	
  Endpoint	
  for	
  JDG	
  
•  Component	
  for	
  JDG	
  infinispan	
  	
  
– URI	
  uses	
  host	
  and	
  port	
  for	
  remote(hotrod)	
  
endpoints.	
  	
  
	
  
<to uri="infinispan://localhost:11222?
cacheName=ConversationCache"/>!
JBoss	
  Fuse	
  
	
  
	
  
	
  
JDG	
  
CAMEL-­‐JBOSSDATAGRID	
  
COMPONENT	
  	
  
Producer	
  are	
  for	
  PUT,	
  GET,	
  REMOVE	
  or	
  CLEAR	
  
commands	
  	
  
<to	
  uri="infinispan://localhost?command=GET"/>	
  
	
  
Consumers	
  are	
  listeners	
  for	
  different	
  
eventTypes	
  (library	
  mode	
  only)	
  	
  
<from	
  uri="infinispan://foo?cacheContainer=#cacheManager"/>	
  	
  
Camel	
  Endpoint	
  for	
  JDG	
  
•  Uses	
  header	
  parameters	
  for	
  keys	
  and	
  values	
  
JDG	
  
CamelInfinispanKey	
  
CamelInfinispanValue	
  
Semng	
  up	
  JDG	
  in	
  Camel	
  
!
<bean id="cacheManager" !
class="org.infinispan.manager.DefaultCacheManager"!
! ! init-method="start" destroy-method="stop">!
!<argument value="infinispan.xml" />!
</bean>!
<service ref="cacheManager"
interface="org.infinispan.manager.EmbeddedCacheManager" />!
Fuse	
  OSGi	
  container	
  
	
  
	
  
	
  
	
  
	
  
cacheManager	
  
The	
  event	
  listener	
  
Client	
  
Client	
  
Listener	
  
Listener	
  
JDG	
  
Route	
  
Hands-­‐on	
  
Workshop	
  
Stock	
  Market	
  Broker	
  
A	
  stock	
  market	
  broker	
  needs	
  to	
  provide	
  it's	
  
brokers	
  with	
  historical	
  data	
  of	
  past	
  stock	
  close	
  
value,	
  and	
  show	
  how	
  much	
  will	
  earn	
  if	
  customer	
  
sell	
  their	
  stock	
  today.	
  
The	
  Problem	
  
Integra&on	
  Service	
  
<	
  10	
  ms	
  processing	
  &me	
  
The	
  Problem	
  
Integra&on	
  Service	
  
Client	
  
Client	
  
Client	
  
Client	
  
Client	
  
Client	
  
The	
  incoming	
  data	
  
Stock	
  Symbol	
  
Orders	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
Integra&on	
  Service	
  
Get	
  All	
  Historical	
  
Order	
  value	
  
Get	
  All	
  
Historical	
  Data	
  
TASK	
  ONE	
  –	
  Claim	
  Check	
  Pa<ern	
  
Stock	
  	
  
	
  Symbol	
  
Orders	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  Customer	
  
	
  	
  
JDG	
  
Stock	
  	
  
	
  Symbol	
  
TASK	
  TWO	
  –	
  Process	
  Historical	
  Data	
  	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
JDG	
  
TASK	
  Three–	
  Remote	
  Event	
  Listener	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
Daily	
  Stock	
  quote	
  
JDG	
  
Client	
  
Listener	
  
TASK	
  Four–	
  RUN!	
  

More Related Content

Scalable Integration with JBoss Fuse

  • 1. Scalable Integration JBoss Fuse & JBoss Data Grid Chris&na  Lin  
  • 2. Agenda   •  Background   – JBoss  Fuse   – JBoss  Data  Grid   •  When  size  and  &me  does  ma<er   •  Technical  Details   •  Hands-­‐on   – 11:45  done  
  • 4. Heavy  LiGing   Class  MyFileReader{   ….   while  ((line=reader.readLine())  ! =  null)  {                           writer.write(line);                         writer.newLine();      //  Write   system  dependent  end  of   line.                }   ……   }   Class  MyJAXBConverter{   …..   JAXBContext.newInstanceUnm arshaller  unmarshaller  =   jc.createUnmarshaller();   unmarshaller.unmarshal(xml);                   marshaller.setProperty(Marshal ler.JAXB_FORMATTED_OUTPUT ,  true);   ….}                   Class  JMSConnector{   …..   Connec&onFactory   connec&onFactory  =   null;Des&na&on  dest  =  null;try   {    connec&onFactory  =   (Connec&onFactory)         jndiContext.lookup("jms/ Connec&onFactory");    dest  =   (Des&na&on)   jndiContext.lookup(destName);     }}  catch  (Excep&on  e)     ….}                   Class  Appraiser{      …..      if(houseInfo  !=  null){      appraisedValue  +=   houseInfo.getLandSize()*  1000      appraisedValue  +=   houseInfo.getBathroom()  *  2000;      appraisedValue  +=   houseInfo.getBedroom()  *  2500;      houseInfo.setAppraisedValue(   appraisedValue);….}                   etc...  
  • 5. Easier  with  JBoss  Fuse   A-MQ File JDBC SFTP Salesforce SAP Twitter Facebook
  • 6. JBoss  Data  Grid   NOSQL   Cache   JBoss  Data  Grid  +   =  
  • 7. JBoss  Data  Grid   Applica&on                     RDBMS   In-Memory   Cache   Applica&on                     In-Memory   Cache   Applica&on                     In-Memory   Cache   Applica&on                     In-Memory   Cache   Applica&on                     In-Memory   Cache   Applica&on                     In-Memory   Cache  
  • 8. JBoss  Data  Grid   Applica&on   Applica&on   Applica&on   In-Memory   Cache   In-Memory   Cache   In-Memory   Cache   In-Memory   Cache   In-Memory   Cache   In-Memory   Cache   In-Memory   Cache   In-Memory   Cache   In-Memory   Cache  In-Memory   Cache  
  • 9. JBoss  Data  Grid   Applica&on             Data  Grid  
  • 10. API  access  to  Data   Data  Grid   C++   Java   .Net  
  • 11. When  SIZE  and   TIME  does   ma<er  !!??   JBoss  Fuse  &  JBoss  Data  Grid  
  • 12. Large  amount  of  Data     •  Incoming  data     •  Processing  Data   •  Providing  output    
  • 13. Incoming  data     •  Polling  Consumer   •  Thro<ler  Pa<ern  
  • 14. Incoming  data     Integra&on  Service   Integra&on  Service   Integra&on  Service  
  • 15. Processing  Data   •  Splimng  your  content   •  Enable  streaming  
  • 16. Processing  Data   •  Filter  your  content  
  • 17. Providing  output     •  Publish  and  subscribe(Topic)  in  messaging     •  Caching  medium  
  • 18. The     Technical     Details  
  • 19. Setup  JDG   •  Setup  Data  Grid  in  Fuse   <bean id="cacheManager" class="org.infinispan.manager.DefaultCacheManager"! ! !init-method="start" destroy-method="stop">! !<argument value="infinispan.xml" />! </bean>!
  • 20. Setups   •  In  infinispan.xml   <transport>      <proper&es>                <property  name="configura*onFile"  value="jgroups-­‐tcp-­‐sample.xml"/>        </proper&es>    </transport>                <namedCache  name="stock-­‐file-­‐cache">            <jmxSta&s&cs  enabled="true"/>                  <clustering  mode="replica*on">                          <async/>                  </clustering>                  <evic&on  maxEntries="30"  strategy="FIFO"/>    </namedCache>  
  • 21. CAMEL-­‐JBOSSDATAGRID   COMPONENT       •  Support  camel  endpoints     •  Supports  both  in  library  and  in  remote/ standalone     JBoss  Fuse         JDG   JDG  
  • 22. Camel  Endpoint  for  JDG   •  Component  for  JDG  infinispan     – URI  uses  host  and  port  for  remote(hotrod)   endpoints.       <to uri="infinispan://localhost:11222? cacheName=ConversationCache"/>! JBoss  Fuse         JDG  
  • 23. CAMEL-­‐JBOSSDATAGRID   COMPONENT     Producer  are  for  PUT,  GET,  REMOVE  or  CLEAR   commands     <to  uri="infinispan://localhost?command=GET"/>     Consumers  are  listeners  for  different   eventTypes  (library  mode  only)     <from  uri="infinispan://foo?cacheContainer=#cacheManager"/>    
  • 24. Camel  Endpoint  for  JDG   •  Uses  header  parameters  for  keys  and  values   JDG   CamelInfinispanKey   CamelInfinispanValue  
  • 25. Semng  up  JDG  in  Camel   <!-- Setup DataGrid in Fuse -->! <bean id="cacheManager" ! class="org.infinispan.manager.DefaultCacheManager"! ! ! init-method="start" destroy-method="stop">! !<argument value="infinispan.xml" />! </bean>! <service ref="cacheManager" interface="org.infinispan.manager.EmbeddedCacheManager" />! Fuse  OSGi  container             cacheManager  
  • 26. The  event  listener   Client   Client   Listener   Listener   JDG   Route  
  • 28. Stock  Market  Broker   A  stock  market  broker  needs  to  provide  it's   brokers  with  historical  data  of  past  stock  close   value,  and  show  how  much  will  earn  if  customer   sell  their  stock  today.  
  • 29. The  Problem   Integra&on  Service   <  10  ms  processing  &me  
  • 30. The  Problem   Integra&on  Service   Client   Client   Client   Client   Client   Client  
  • 31. The  incoming  data   Stock  Symbol   Orders    Customer    Customer    Customer    Customer    Customer    Customer    Customer   Integra&on  Service   Get  All  Historical   Order  value   Get  All   Historical  Data  
  • 32. TASK  ONE  –  Claim  Check  Pa<ern   Stock      Symbol   Orders    Customer    Customer    Customer    Customer    Customer    Customer       JDG   Stock      Symbol  
  • 33. TASK  TWO  –  Process  Historical  Data     Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   JDG  
  • 34. TASK  Three–  Remote  Event  Listener   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   Daily  Stock  quote   JDG   Client   Listener