Spring Integration

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Using the Spring Framework encourages developers to code using interfaces and use

dependency injection (DI) to provide a Plain ld !ava "ject (P!) with the
dependencies it needs to perform its tasks# Spring Integration takes this concept one
step further$ where P!s are wired together using a messaging paradigm and individual
components may not "e aware of other components in the application# Such an
application is "uilt "y assem"ling fine%grained reusa"le components to form a higher
level of functionality# &Ith careful design$ these flows can "e modulari'ed and also
reused at an even higher level#
In addition to wiring together fine%grained components$ Spring Integration provides a
wide selection of channel adapters and gateways to communicate with e(ternal systems#
)hannel *dapters are used for one%way integration (send or receive)+ gateways are used
for re,uest-reply scenarios (in"ound or out"ound)#
.he recommended way to get started using spring-integration in your project is with
a dependency management system / the snippet "elow can "e copied and pasted into
your "uild# 0eed help1 See our getting started guides on "uilding with 2aven and
3radle#
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>2.2.6.RELE!E</version>
</dependency>
</dependencies>
In the following 4,uick start4 application you can see that the same gateway interface is
used to invoke two completely different service implementations# .o "uild and run this
program you will need the spring-integration-ws and spring-integration-xml modules
as descri"ed a"ove#
pu"#ic c#ass $ain %
pu"#ic static void main&!tring... args' t(rows E)ception %
pp#ication*onte)t ct) +
new *#ass,at(-m#pp#ication*onte)t&.conte)t.)m#.'/
// !imp#e !ervice
0emp*onverter converter +
ct).get1ean&.simp#e2ateway.3 0emp*onverter.c#ass'/
!ystem.out.print#n&converter.fa(ren(eit0o*e#cius&64.5f''/
// 6e" !ervice
converter + ct).get1ean&.ws2ateway.3 0emp*onverter.c#ass'/
!ystem.out.print#n&converter.fa(ren(eit0o*e#cius&64.5f''/
7
7
pu"#ic interface 0emp*onverter %
f#oat fa(ren(eit0o*e#cius&f#oat fa(ren'/
7
<8-- !imp#e !ervice -->
<int9gateway id+.simp#e2ateway.
service-interface+.foo.0emp*onverter.
defau#t-re:uest-c(anne#+.simp#eE)pression. />
<int9service-activator id+.e)pression*onverter.
input-c(anne#+.simp#eE)pression.
e)pression+.&pay#oad - ;2' / < = >./>
<8-- 6e" !ervice -->
<int9gateway id+.ws2ateway. service-interface+.foo.0emp*onverter.
defau#t-re:uest-c(anne#+.via6e"!ervice. />
<int9c(ain id+.ws*(ain. input-c(anne#+.via6e"!ervice.>
<int9transformer
e)pression+.?@#t/Aa(ren(eit0o*e#sius
)m#ns+??(ttp9//tempuri.org/??@gt/@#t/Aa(ren(eit@gt/---@#t//Aa(ren(eit@gt
/@#t//Aa(ren(eit0o*e#sius@gt/?.rep#ace&?---?3 pay#oad.to!tring&''. />
<int-ws9(eader-enric(er>
<int-ws9soap-action
va#ue+.(ttp9//tempuri.org/Aa(ren(eit0o*e#sius./>
</int-ws9(eader-enric(er>
<int-ws9out"ound-gateway
uri+.(ttp9//www.w;sc(oo#s.com/we"services/tempconvert.asm)./>
<int-)m#9)pat(-transformer
)pat(-e)pression+./=B#oca#-
name&'+?Aa(ren(eit0o*e#siusResponse?C/=B#oca#-
name&'+?Aa(ren(eit0o*e#siusResu#t?C./>
</int9c(ain>

You might also like