eai with spring integration -...

42
EAI and Spring Integration Josh Long Architect, Software Engineer JoshLong.com J[email protected]

Upload: phamque

Post on 06-Feb-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

EAI and Spring Integration

Josh LongArchitect, Software EngineerJoshLong.com

[email protected]

Page 2: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Who am I? Josh Long A developer with an architect's hat on Blog: www.joshlong.com Artima.com Blog: http://tinyurl.com/4czgdw Any questions?

Page 3: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,
Page 4: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Agenda Talk a bit about EAI

Give a Brief History of EAI

Enumerate the capabilities of an ESB Talk to you about what the landscape of ESBs

Introduce Spring Integration (you can cheer)

Introduce a case study: a user management service Show some code and a demo Questions (please feel free to ask)

Page 5: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

What is EAI Enterprise Application Integration

Been around for as long as disparate computing paradigms have

EAI is integration of services and / or data. Enterprise Application Integration platforms have

changed names Now known as: an Enterprise Service Bus (ESB)

Please update your buzzword dictionary.

Types of EAI: File Transfer Shared Database Remote Procedure Call Messaging

Page 6: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Common ESB Capabilities Location Transparency Transport Conversion Message Transformation / Routing / Enhancement Security

Spring Security integration‟s on the roadmap

Monitoring and management you might use JMX for Spring Integration

Process management (BPMs, orchestration) Complex Event Processing

Page 7: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

DO NOT USE: The foundation of all SOA architectures They encourage the creation of centralized

silos of information and services This is anti-SOA

Best used with an eye towards exposing hidden applications and services

Not the fastest solution since, by definition, they're a level of indirection

USE: You'd use an ESB to integrate applications and

data that don't naturally fit well together. Reduce architectural spaghetti

Applicability of an ESB:

Page 8: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

How do JEE solutions stack up on…• Messaging

• RPC

• Integration with Homogeneous Systems

• Integration with Heterogeneous Systems• Mainframe systems?

• Security

• Flexible routing

* Babel fish from Hitchhiker's Guide to the Galaxy

Page 9: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration Spring Integration is a new addition to the Spring Portfolio

Provides support for SOA, EDA and EAI Too many buzzwords?

It just went live with a 1.0 late in 2008.

Provides philosophical consistency with core Spring

principles. Spring Integration is an API geared towards building ESB -centric

solutions, not another name for the Spring remoting APIs.

Page 10: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

The ESB Landscape Traditional EAI solutions from

the likes of TIBCO, Axway,

WebMethods

Open source / Java-centric

solutions like ServiceMix,

PEtALS, OpenESB, JBossESB,

Mule (and of course Spring Integration) The alternatives: solutions

strung together with bailing wire

and tape, a veritable Rube

Goldberg machine * Rube Goldberg solution -- you’ve never built

something like this, have you? Really??

Page 11: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Case Study: Introduction The application is the central user authorization and

management hub for all customers in the suite

Plans include provision of single sign on, etc

Needs to be flexible in the future.

Page 12: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Case Study: History Version 1.0

Written on „raw‟ JEE 1.4

Remoting provided by EJB 2.x

ORM-ish functionality achieved using CMP Entity Beans

Development took 1,000 rat years

Version 2.0 Fundamental pieces were reworked

No rats were harmed. Developers, however…

Version 3.0 (this is the one we‟re going to address…)

Provide integration with newly assimilated PHP site /

application.

Provide faster integration with Java application using JMS

Page 13: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Case Study: 3.0 Analysis Provide integration with PHP Site

Application already supports CSV exports

Third party: don‟t have the source

Provide faster integration with Java application The Java application gets too much traffic;

enrollments can't keep up.

Use temporal decoupling: buffer the requests

using JMS

Page 14: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Existing Architecture

Case Study

Page 15: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Envisioned Architecture

Case Study

Page 16: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Let's use an ESB!

Case Study

Page 17: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration Solution

DEMO

TIME!!

Page 18: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

• Spring Integration uses standard Spring XML • Idiomatic configuration: annotations, schema.• DSLs to go• Spring Integration is embedded: deploy Spring• Integration with your app; you don‟t deploy your

application to Spring Integration

Spring Integration

Page 19: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

A little background information:

Spring Integration

Page 20: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

You'll typically deal with three things in an integration solution:

Channels Endpoints Adapters

Spring Integration

Page 21: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration

{your code here}

This all happens in a Spring Application Context, just like any other Spring configuration:

Page 22: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration

Channels: In xml:

• Pretty useless.

• It's just an abstract concept at this point.

Something to connect to, but no real indication is

provided as to how.

• That's next...

Page 23: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Adapters:In xml:

We need to connect something to this channel. An adapter knows how to deal with some external

system

Spring Integration

Page 24: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Service Adapter:In xml:

This allows you to invoke java code as a result of a message of a certain type arriving.

Spring Integration

Page 25: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration SolutionFile Drop Solution (XML)

Page 26: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration SolutionFile Drop Solution (XML)

}channels

}beans

}components

Page 27: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration Solution

File Drop Solution (XML)

}beans

Declaring a few beans that contain annotations. – This makes Spring recognize them

Plus, you can reference those beans from other beans.

Page 28: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration Solution

File Drop Solution (XML)

}channels

Declare channels for use later.

Page 29: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration Solution

Page 30: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration SolutionTake a look at the beans themselves.File Solution (Java): The Splitter:

Page 31: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration SolutionTake a look at the beans themselves.File Solution (Java): The Transformer:

Page 32: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration SolutionTake a look at the beans themselves.File Solution (Java): The Service Activator:

Page 33: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration Solution

Configuration for the JMS client. You'd write this whether you were using Spring Integration or not.

JMS Solution (XML)

Page 34: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration Solution

1: tells SI to pop messages off the JMS queue 2: tells SI to transform incoming JMS messages into EnrolledUsers. 3: tells SI to call the same service activator that we saw last time, and call enrollments.

JMS Solution (XML)The relevant XML

Page 35: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Spring Integration SolutionLet's again take a look at the beans themselves:JMS Solution (Java): The Transformer

Page 36: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Where to go From Here: Spring Batch• Spring Batch

• Spring Batch provides a standard infrastructure for batch processing (i.e., large data payloads)

• Data can be partitioned and processed in chunks, which then might be fed to an event bus.

• The reason for this is simple: Spring Integration encourages a (Staged) Event Driven Architecture, but a file with 20 million rows isn‟t an event. It‟s too coarse. Use Spring Batch to make manageable.

• The other way around is possible too:

• The ESB may produce output that, taken together, is too large or that would be better suited for batch processing infrastructure.

• You might use a correlation ID to have a processed message re-enter the bus and resume processing or routing.

Page 37: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Where to go From Here: Workflow• jBPM and Spring Modules Support

• Spring Batch can glue disparate subsystems together, enabling the components to send messages.

• Once inside one subsystem, however, complex, stateful processing may be required.

• Nested states, recursion, etc

• An ESB is not ideal for very complex state management; messages are either going in or out.

• Use a workflow engine (JBoss jBPM is a fine example) to handle complex management of the message and application state.

• You might use a correlation ID to have a processed message re-enter the bus and resume processing or routing.

Page 38: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Mark Fisher, Iwein Fuld and the SI developers for framework and support “Enterprise Integration Patterns” “Open Source ESBs in Action”

Acknowledgments

Page 39: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,
Page 40: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

The

End

Page 41: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,

Questions?

Page 42: EAI with Spring Integration - TechTargetjavasymposium.techtarget.com/html/images/JLong_EAI_Spring_000.pdf · The ESB Landscape Traditional EAI solutions from the likes of TIBCO, Axway,