More Related Content Similar to Spring Integration Done Bootifully (20) Spring Integration Done Bootifully1. Spring Integration
Done Bootifully
By Glenn Renfro
@cppwfs
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/
2. Spring Boot
Takes an opinionated view of building production-ready Spring
applications. Spring Boot favors convention over configuration and is
designed to get you up and running as quickly as possible.
• Create stand-alone Spring applications
• Embed Tomcat or Jetty directly (no need to deploy WAR files)
• Opinionated 'starter' POMs
• Automatically configure Spring whenever possible
• Absolutely no code generation and no requirement for XML configuration
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 2
3. Spring Integration
Extends the Spring programming model to support the well-known Enterprise
Integration Patterns.
• Spring Integration enables lightweight messaging and supports integration with
external systems.
• Adapters provide a higher-level of abstraction over Spring's support for remoting,
messaging, and scheduling.
• ReST/HTTP
• SFTP/FTP
• RabbitMQ
• JMS
• TCP/UDP
• Spring Integration's primary goal is to provide a simple model for building enterprise
integration solutions while maintaining the separation of concerns that is essential
for producing maintainable, testable code.
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 3
4. Agenda
• Create a SI application
– that gathers bid data from various bitcoin banks and markets.
– Translate data
– Send data MQTT Client
• Create MQTT Client
– Create a basic application to receive MQTT messages
– Report to console what was received
– Count total messages received.
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 4
5. Data Flow
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 5
6. The Tools
• Your Favorite Editor
• Gradlew
• Git (Optional)
• RabbitMQ Need port 1883
• rabbitmq-plugins enable rabbitmq_mqtt
The Libraries
• Spring Boot
• Spring Integration
• Jackson
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 6
7. Lets setup our integration to write to a file.
• Setup the CoinBase http outbound gateway.
• Setup our Main application
4.0
• Setup the Transform
• Setup the BitStamp http outbound gateway
• Setup the MQTT outbound-channel-adapter
4.1
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 7
8. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 8
9. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 9
10. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 10
11. 4.1 MQTT Features
• Async Sends
• HA Omit the url and use the serverURIs from
theDefaultMqttPahoClientFactory
• Supports QoS for each subscription
• Programmatically subscribe and unsubscribe from topics at
runtime.
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 11
12. Security
• Does MQTT support security?
– MQTT supports Authentication
• Pass a user name and password with an MQTT packet as of
version 3.1
– Independently setup SSL
• But that can be heavy
– Application encrypts/decrypts the data
• Authorization?
• World Peace?
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 12
13. Now lets setup the MQTT Listener
• Setup build.gradle
• Setup Integation.xml
• Setup the Main
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 13
14. The Gradle File
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-snapshot" } mavenLocal() }
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.5.RELEASE”) }
}
…
apply plugin: 'spring-boot'
…
dependencies {
compile("org.springframework.boot:spring-boot-starter-integration")
compile("com.fasterxml.jackson.core:jackson-databind")
compile "org.springframework.integration:spring-integration-mqtt:4.0.3.RELEASE"
testCompile("junit:junit")
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 14
}
15. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 15
16. Just a little bit more
• Profiles
• Actuator
• JMX
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 16
17. Learn More. Stay Connected
grenfro@gopivotal.com git@github.com:cppwfs/webcastbitcoin.git
git@github.com:cppwfs/webcastmqtt.git
@springcentral | spring.io/video
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Sof tware, Inc. and licensed under a
Creat ive Commons At tribut ion-NonCommercial license: ht tp: / /creat ivecommons.org/ licenses/by-nc/3.0/ 17
Editor's Notes 4 areas
Who is this guy?
Using these in existing apps
Spring Integration, Spring Boot
MQTT
Actuator