Your SlideShare is downloading. ×
Spring integration with jBPM4
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Spring integration with jBPM4

8,223
views

Published on

Published in: Technology

1 Comment
10 Likes
Statistics
Notes
  • I have just downloaded jBPM4 beta 1 and can not see spring tag in the jPDL schema definition. I am assuming this is experimental at this point?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
8,223
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
10
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Spring Integration in jBPM 4 Andries Inzé [email_address] http://andries.inze.be
  • 2. About me
    • President of
    • Technical Project Leader at
    • Helping out with
  • 3. Content
    • Why do we need Spring Integration?
    • What’s In It For Us?
    • Architecture of jBPM 4 and Spring Integration
    • Configuration
    • Testing jBPM 4 with Spring Integration
    • Q&A
  • 4. Why do we need it?
    • Previous efforts on jBPM 3
      • Spring Modules (jBPM 3.0-3.1 but not up!)
      • Home brew frameworks
      • http://www.jorambarrez.be
  • 5. WIIFY
    • Deep integration, making the necessary changes
      • No need for hacks
    • Part of the jBPM 4 test suite
    • Expertise and insight of the jBPM Dev Team.
    What’s In It For YOU ?
  • 6. How much is realized?
    • Scope 4.0.0.GA  minimal scope jBPM 3
    • Further  Easy extension and integration
    • Spring Integration is ready but will not be fully supported in first release  looking for feedback!
  • 7. Content
    • Why do we need Spring Integration?
    • What’s In It For Us?
    • Architecture of jBPM 4 and Spring Integration
    • Configuration
    • Testing jBPM 4 with Spring Integration
    • Q&A
  • 8. jBPM 4 Architecture
    • Dependency Lookup
    • Transaction Management
    • Activity
  • 9. jBPM 4 Architecture
    • Dependency Lookup
    • Transaction Management
    • Activity
  • 10. jBPM 4 Architecture Dependency Lookup Environment Process Service Execution Service Management Service Hibernate Session Factory Transaction Manager …
    • Dependency resolution at runtime
  • 11. jBPM 4 Architecture Dependency Lookup (2) ProcessEngineContext TransactionContext Hibernate Session Hibernate Session Factory
  • 12. jBPM 4 Architecture Dependency Lookup (3) SpringContext ProcessEngineContext TransactionContext Hibernate Session Factory Transaction Manager … Activity Hibernate Session
  • 13. jBPM 4 Architecture
    • Dependency Lookup
    • Transaction Management
    • Activity
  • 14. Transaction Handling Process Service Execution Service History Service Command Service Commands Service API
  • 15. Transaction Handling (2)
    • Configuration Details for jBPM
    Process Service Execution Service History Service Command Service Standard Transaction Interceptor
  • 16. Transaction Handling (3)
    • Configuration Details for Spring
    Process Service Execution Service History Service Command Service Business Service Transaction Interceptor
  • 17. Transaction Handling (4)
    • A discrepancy between Spring and jBPM.
      • Spring  Transaction per service call
      • jBPM  Transaction per Command
    • Spring Integration provides support for the two!
  • 18. jBPM 4 Architecture
    • Dependency Lookup
    • Transaction Management
    • Activity
  • 19. Activity
    • Central focus of jBPM 4
      • <task />, <java />, <esb />, <sql />, …
    • SpringBeanActivity
    • Expression Language ( JSR 223, Juel)
      • #{myBean.property}
    < hql name = &quot;count activities&quot; var = &quot;activities&quot; unique = &quot;true&quot; > < query > select count(*) from org.jbpm.pvm.internal.model.ActivityImpl </ query > < transition to = &quot;wait&quot; /> </ hql >
  • 20. SpringBeanActivity
    • <? xml version = &quot;1.0&quot; encoding = &quot;UTF-8&quot; ?>
    • < process name = &quot;Spring&quot; >
    • < start >
    • < transition to = &quot;test&quot; />
    • </ start >
    • < spring name = &quot; test &quot; >
      • < bean > testBean </ bean >
      • < method > testMethodWithParameters </ method >
      • < parameters >
      • < string value = “J-Spring&quot; />
      • </ parameters >
      • < transition to = “finish&quot; />
    • </ spring >
    • < end name = “finish&quot; />
    • </ process >
  • 21. Content
    • Why do we need Spring Integration?
    • What’s In It For Us?
    • Architecture of jBPM 4 and Spring Integration
    • Configuration
    • Testing jBPM 4 with Spring Integration
    • Q&A
  • 22. Configuration
    • Minimal Spring Configuration
    • < beans ...
    • < bean id = &quot;configuration&quot; class = &quot;org.jbpm.spring.cfg.SpringConfigurationFactoryBean&quot; >
    • < property name = &quot;jbpmConfigurationLocation&quot; value = “my/jbpm.cfg.xml&quot; />
    • </ bean >
    • < bean id = &quot;sessionFactory&quot; class = &quot;org.springframework.orm.hibernate3.LocalSessionFactoryBean&quot; >
    • < property name = &quot;configLocation&quot; value = &quot;classpath:my/hibernate.jbpm.cfg.xml&quot; />
    • </ bean >
    • < bean id = &quot;transactionManager“
    • class = &quot;org.springframework.orm.hibernate3.HibernateTransactionManager&quot; >
    • < property name = &quot;sessionFactory&quot; ref = &quot;sessionFactory&quot; />
    • </ bean >
    • < bean id = &quot;dataSource&quot; class = &quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot; >
      • < property name = &quot;driverClassName&quot; value = &quot;org.hsqldb.jdbcDriver&quot; />
      • < property name = &quot;url&quot; value = &quot;jdbc:hsqldb:mem:.&quot; />
      • < property name = &quot;username&quot; value = &quot;sa&quot; />
      • < property name = &quot;password&quot; value = &quot;&quot; />
    • </ bean >
    • </ beans >
  • 23. Configuration (2)
    • Typical jBPM Configuration
    • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
    • <jbpm-configuration xmlns=&quot;http://jbpm.org/xsd/cfg&quot;>
      • <process-engine-context>
      • </process-engine-context>
      • <transaction-context>
      • </transaction-context>
    • </jbpm-configuration>
  • 24. Configuration (3)
    • Process-engine-context configuration
    • < process-engine-context >
      • < repository-service />
      • < repository-cache />
      • < execution-service />
      • < history-service />
      • < management-service />
      • < task-service />
      • < identity-service />
      • < command-service >
        • < retry-interceptor />
        • < environment-interceptor />
        • < standard-transaction-interceptor />
      • </ command-service >
      • < hibernate-configuration >
      • < cfg resource = &quot;org/jbpm/pvm/spring/hibernate.jbpm.cfg.xml&quot; />
      • </ hibernate-configuration > …
    • </ process-engine-context >
  • 25. Configuration (4)
    • Transaction-context configuration
    • <transaction-context>
      • <transaction />
      • <repository-session />
      • <pvm-db-session />
      • <job-db-session />
      • <task-db-session />
      • <message-session />
      • <timer-session />
      • <history-session />
    • <hibernate-session current = &quot;true />
      • <identity-session />
    • </transaction-context>
  • 26. Configuration (4) < bean id = &quot;processEngine&quot; factory-bean = &quot;jbpmConfiguration&quot; factory-method = &quot;buildProcessEngine&quot; /> < bean id = &quot;executionService&quot; factory-bean = &quot;processEngine&quot; factory-method = &quot;getExecutionService&quot; /> …
    • Exposing Services
  • 27. Content
    • Why do we need Spring Integration?
    • What’s In It For Us?
    • Architecture of jBPM 4 and Spring Integration
    • Configuration
    • Testing jBPM 4 with Spring Integration
    • Q&A
  • 28.
    • AbstractTransactional SpringJbpmTestCase
    • Only for Spring-Transaction strategy
    • Transactional
    • Rollback after test
    • JbpmTestCase
    • Only for jBPM-Transaction strategy
    • Not transactional
    • Performs client side cleanup  destructive on existing data
    jBPM Testing
  • 29. AbstractTransactional SpringJbpmTestCase public class FindExecutionTest extends AbstractTransactionalSpringJbpmTestCase { protected String[] getConfigLocations() { return new String[]{ &quot;org/jbpm/spring/test/applicationContext.xml&quot; }; } public void testFindExecutionById () { deployJpdlXmlString( &quot;<process name='p'>&quot; + &quot; <start>&quot; + &quot; <transition to='a' />&quot; + &quot; </start>&quot; + &quot; <state name='a' />&quot; + &quot;</process>&quot; ); Execution execution = executionService .startProcessInstanceByKey( &quot;p&quot; ); execution = executionService .findExecution(execution.getId()); assertNotNull(execution); assertEquals( &quot;a&quot; , execution.getActivityName()); }
  • 30. JbpmTestCase public class FindExecutionTest extends JbpmTestCase { public void testFindExecutionById() { deployJpdlXmlString( &quot;<process name='p'>&quot; + &quot; <start>&quot; + &quot; <transition to='a' />&quot; + &quot; </start>&quot; + &quot; <state name='a' />&quot; + &quot;</process>&quot; ); Execution execution = executionService .startProcessInstanceByKey( &quot;p&quot; ); // take the id and see if the execution service can still find it back execution = executionService .findExecution(execution.getId()); assertNotNull(execution); assertEquals( &quot;a&quot; , execution.getActivityName()); }
  • 31. Best practice
    • Split up the hibernate cfg files
    • Use Spring transaction handling when possible
    • Write small tests and reuse them
    • Add test-applicationContext.xml to overwrite non-transactional activities (like file-IO)
  • 32. Future
    • Feedback from community
    • Test if everything works as intended (Timers/async/…)
    • Test Spring 2.5 and up
    • More SWF-like syntax
      • DSL e.g. assertCurrentActivityEquals
      • Mock sub processes
    • Helping out?
  • 33. Q&A [email_address]