Top Banner
Uvod u Spring Integration
14
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Uvod u spring integration

Uvod u Spring Integration

Page 2: Uvod u spring integration

Agenda

• Enterprise Application Integration & Enterprise Integration Patterns

• Uvod u Spring Integration• Messaging• Osnovni patterni• Primjeri• Zaključak

Page 3: Uvod u spring integration

Enterprise Application Integration

Aplikacije

TehnologijeProtokoli

Page 4: Uvod u spring integration

Spring Integration

• Spring + EIP• Lightweight• Jednostavan (Spring-like)• Nije ESB• Mediation & Routing framework

Spring Integration

Page 5: Uvod u spring integration

Message(ing)

Header

Payload

Message

Channel Endpoint

Page 6: Uvod u spring integration

Enterprise Integration Patterns

transformer

In ChAdap

Out ChAdap

Page 7: Uvod u spring integration

Channel Endpoints

TCP/UDP

RMI

JMS WSStream

Page 8: Uvod u spring integration

Primjer – twitter to gtalk

#mentions

Page 9: Uvod u spring integration

Primjer - twitter to gtalk

<bean id="twitterTemplate" class="org.springframework.social.twitter.api.impl.TwitterTemplate">

<constructor-arg value="${twitter.oauth.consumerKey}"/><constructor-arg value="${twitter.oauth.consumerSecret}"/><constructor-arg value="${twitter.oauth.accessToken}"/><constructor-arg value="${twitter.oauth.accessTokenSecret}"/>

</bean>

<twitter:inbound-channel-adapter twitter-template="twitterTemplate" channel="inboundTwitterChannel">

<int:poller fixed-rate="2000" max-messages-per-poll=“10"/></twitter:inbound-channel-adapter>

<twitter:search-inbound-channel-adapter query="#springintegration" twitter-template="twitterTemplate" channel=" inboundTwitterChannel">

<int:poller fixed-rate=“5000" max-messages-per-poll=" 10 "/></twitter:search-inbound-channel-adapter>

Page 10: Uvod u spring integration

Primjer - twitter to gtalk<int:transformer input-channel="inboundTwitterChannel"

output-channel="outputChannel" expression="'[' + payload.getFromUser() + ']: '+ payload.getText() + ' '"/>

<int:bridge input-channel="outputChannel" output-channel="toUserChannel"> <int:poller max-messages-per-poll="1" fixed-rate="3000"/></int:bridge>

<int-xmpp:xmpp-connection id="googleTalkConnection" user="${xmpp.login}" password="${xmpp.password}" host="${xmpp.host}"

service-name="${xmpp.service}" port="${xmpp.port}"/>

<int-xmpp:header-enricher input-channel="toUserChannel" output-channel="imChannel">

<int-xmpp:chat-to value="${send.to.user}"/></int-xmpp:header-enricher>

<int:channel id="toUserChannel"/><int-xmpp:outbound-channel-adapter channel="imChannel" xmpp-connection="googleTalkConnection"/>

Page 11: Uvod u spring integration

Primjer – database polling

<int-jdbc:inbound-channel-adapter query="select * from item where status=1" channel="inDbChannel" data-

source="pollingDataSource" update="update item set status=10 where id in (:id)"

task-executor="pool" > <int:poller fixed-rate="1000" > <int:transactional/> </int:poller></int-jdbc:inbound-channel-adapter>

Page 12: Uvod u spring integration

Primjer – cafe

Page 13: Uvod u spring integration

Spring Integration – zaključak

• Kada, Zašto, Što Još?

• Hvala

• Pitanja?

Page 14: Uvod u spring integration

Kontakt

• Samir ČaušSoftware Developer

gsm +385 91 5720896mail [email protected] samircaustwitter twitter.com/samircaus

http://www.fiveminutes.eu