spring integration: from xml to java dsl

29
Spring Integration: from XML configuration to Java DSL

Upload: andrey-krivtsun

Post on 23-Jan-2018

675 views

Category:

Software


6 download

TRANSCRIPT

Page 1: Spring Integration: from XML to Java DSL

Spring Integration:from XML configuration

to Java DSL

Page 2: Spring Integration: from XML to Java DSL

Agenda

● Enterprise Application Integration● Message-oriented middleware● Spring Integration framework (SI)● SI Java DSL

– Advantages

– Disadvantages

● Conclusions

Page 3: Spring Integration: from XML to Java DSL

whoami

Andriy Kryvtsun

● Senior Software Engineer● 15+ years Java experience

[email protected]@akryvtsun

Page 4: Spring Integration: from XML to Java DSL

EnterpriseApplication Integration

(EAI)

● What?● Where?● When?

Page 5: Spring Integration: from XML to Java DSL

EAI styles

File Transfer Shared Database

Remote ProcedureInvocation

Message-orientedmiddleware (MOM)

Page 6: Spring Integration: from XML to Java DSL

MOM components

● Messages● Channels● Endpoints● Transformations● Routing● Configuration

Page 7: Spring Integration: from XML to Java DSL

EAI Patterns

Page 8: Spring Integration: from XML to Java DSL

Coffee Shop Example

cafe orders order splitter drinks

drinksrouter

cold drinks

hot drinks

cold drinks serving

hot drinks serving

prepared drinksorder

aggregatordeliveries

Page 9: Spring Integration: from XML to Java DSL

MOM implementations

Spring Integration

Mule ESB

Page 10: Spring Integration: from XML to Java DSL

Spring Integration

● Founded at 2009

● Lightweight routing and mediation framework ● Low level DSLs● Tight integration with others Spring projects (Spring

DI, Spring XD, Spring Cloud etc.)

Page 11: Spring Integration: from XML to Java DSL

DSL types in Spring Integration

Page 12: Spring Integration: from XML to Java DSL

● Founded at 2009

● Implements big set of EIPs and endpoints

● Has around 70 contributors

● 8000+ commits in GitHub repo

● The last commit date Apr, 2016

Page 13: Spring Integration: from XML to Java DSL

● Founded at 2014

● Implements big set of endpoints and EIPs

● Java 8 lambda support

● 154 commits in GitHub repo

● The last commit date Apr, 2016

Page 14: Spring Integration: from XML to Java DSL

● Founded at 2012

● Implements only few endpoints (jms, http, amqp)

● Has 69 commits in GitHub repo

● The last commit date Feb, 2016

Page 15: Spring Integration: from XML to Java DSL

● Founded at 2012

● Implements few base endpoints (jms, http, file, jdbc etc.)

● Has 220 commits in GitHub repo

● The last commit date Jun, 2013

Page 16: Spring Integration: from XML to Java DSL

XML and Java DSLDemo

Page 17: Spring Integration: from XML to Java DSL

Numbers Polling Consumer

Even Numbers

Filter

Header fieldsEnricher

Wire TapOutput

Number toString

transformer

File Output

Even Numbers Processor

Page 18: Spring Integration: from XML to Java DSL

Java DSLAdvantages

● expressiveness● strict types ● compatibility with Java 8 lambdas, Spring Java DSL

and Spring Boot

Page 19: Spring Integration: from XML to Java DSL

Java DSLDisadvantages

Page 20: Spring Integration: from XML to Java DSL

Header fieldsEnricher

Wire TapOutput

Number toString

transformer

File Output

FTP OutputNumber toString

transformer

Numbers Polling Consumer

Even NumbersRouter ‘TRUE’

‘FALSE’

Prime Numbers

Filter

Even and Prime Numbers Processor

Page 21: Spring Integration: from XML to Java DSL

1. Verbosity

Page 22: Spring Integration: from XML to Java DSL

1. Verbosity

Solution- flow splitting- bean logic encapsulation

Page 23: Spring Integration: from XML to Java DSL

2. Limitation

Page 24: Spring Integration: from XML to Java DSL

Header fieldsEnricher

Wire TapOutput

Number toString

transformer

File Output

FTP Output

Number toString

transformerNumbers Polling Consumer

NumberType

Router

JDBC Output

Even NumberChannel

Prime NumberChannel

PalindromeNumberChannel

NullChannel

File NameEnricher

Page 25: Spring Integration: from XML to Java DSL

2. Limitation

Solution- use hybrid configuration - do it yourself

Page 26: Spring Integration: from XML to Java DSL

Repositories structure

Page 27: Spring Integration: from XML to Java DSL

Conclusions

Page 28: Spring Integration: from XML to Java DSL

References

● 'Enterprise Integration Patterns' book by Gregor Hohpe

– http://www.enterpriseintegrationpatterns.com● 'Spring Integraion in Action' book by Mark Fisher, Jonas Partner

● http://projects.spring.io/spring-integration

– https://github.com/spring-projects/spring-integration● Stack Overflow 'spring-integration' tag

http://stackoverflow.com/questions/tagged/spring-integration

Page 29: Spring Integration: from XML to Java DSL

Questions