Date post: | 17-May-2015 |
Category: |
Technology |
Upload: | chris-richardson |
View: | 1,357 times |
Download: | 3 times |
Spring into the CloudChris Richardson
Author of POJOs in ActionFounder of the original CloudFoundry.com
1
Presentation goal
2
Cloud Foundry simplifies the development and
deployment of modern applications
Spring is the ideal cloud computing platform
3
About Chris
About Chris
4
(About Chris)
5
About Chris()
6
About Chris
7
About Chris
http://www.theregister.co.uk/2009/08/19/springsource_cloud_foundry/
8
About Chris
9
Developer Advocate for CloudFoundry.com
Signup at http://cloudfoundry.com
Promo code: EgyptJUG
Agenda
Why PaaS? Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases
Cloud Foundry and asynchronous architectures
Tomcat
Traditional web application architecture
11
Desktop Browser
Apache
WAR
MySQL Database
developtestdeployscale Or is it?
ShippingService
AccountingService
InventoryService
StoreFront
Simple to
?Let’s imagine you want to run a performance test...
How long to get the servers?Who is going to set up the servers?Who is going to set up Apache, Tomcat, and MySQL?
And things are changing:
This simple, monolithic architecture is inadequate
13
14
Smart phones overtake PCs in Q4 2010
New kinds of clients
Users expect a rich, dynamic and interactive experience on mobile devices and desktop
15
Java Web Application
Desktop Browser
HTTP Request
HTML/Javascript
Old style UI architecture isn’t good enough
Need to handle massive loads and the data explosion
16
Need scalable architectures
Application tier:
• Replicated/clustered servers
• Modular so that components can be scaled differently
• Asynchronous architecture - communication via a message broker
Database tier:
• Replication
• Sharding
• Polyglot persistence: Relational, NoSQL, NewSQL databases
Scaling development
17
Forces multiple developers/teams to synchronize development efforts
Obstacle to frequent, independent deployments
Increases risk of failure - need to redeploy everything to change one thing
!=Scalable development
WAR
ShippingService
AccountingService
InventoryService
StoreFront
Desktop Browser
NodeJS front-end application
Native Mobile Application
HTML5 mobile application
RabbitMQ
NodeJS
MySQL
Mongo
Redis
ShippingService
AccountingService
billing.war
shipping.war
InventoryService
inventory.war
StoreUI
StoreUI
StoreUI
StoreUI
18
Modern application architecture
Developing and testing these applications is even more challenging
19
Let’s imagine you are fixing a bug and want to run some JUnit integration tests...
Who is going to install and configure your sandbox: MySQL, RabbitMQ, MongoDB, ....??
Let’s imagine you have fixed a bug and want to run some functional tests...
How long to purchase the servers?Who is going to set up the servers?Who is going to install and configure MySQL, RabbitMQ, MongoDB, ....??
22
Platform-as-a-Service is the solution
Easy deployment
Application management
Easy scaling up and down
Services:
Database
Blob storage
Messaging
...
+
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases
Cloud Foundry and asynchronous architectures
24
About Cloud Foundry
Cloud Provider Interface
Private Clouds
PublicClouds
MicroClouds
Applica7on Service Interface
Data Services
Other Services
Msg Services
.COM
…
.js
Cloud Foundry.COM
Runtimes & Frameworks
Services
vCenter / vSphere
Cloud Foundry
Infrastructure
What is a Micro Cloud?
26
Entire Cloud Running inside of a single VM
Or
Signup @ http://cloudfoundry.com/micro
27
Cloud Foundry.ORG
The Cloud Foundry Source Code
Cloud Foundry
Download
Code
Setup Environment
Deploy Behind Firewall
Setup Scripts
Vibrant open-source ecosystem
AppFog.com• Community lead for PHP
• PaaS for PHP
Joyent• Community lead for Node.js
ActiveState• Community lead for Python
• Stackato private PaaS
Cloud Foundry - Architecture
DEAs
Web
App
Services
DB
HealthManager
Routers
CloudControllers
Load Balancers
Message Bus(NATS)
DEAs
Web
App
DEAs
Web
App
100’
s of
DEA
s
CloudControllersCloud
Controllers
Services
DB
Services
DB
Load BalancersLoad Balancers
Routers
HealthManagerHealth
Manager
Routers
Message Bus(NATS)
Message Bus(NATS)
Web Service API
Let's deploy an application
Create an application
$ mvn archetype:generate…18: internal -> maven-archetype-webapp
(A simple Java web application)…Choose a number:
(1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34/35/36/37/38/39/40/41) 15: : 18
…$ mvn package…
Options for using Cloud Foundry
32
Using the Cloud Foundry CLI
vmc push cf1 --path target \ --url cer-cf1.cloudfoundry.com
CLI Application name Dir containing WAR
Application URL
Deploy the application
Memory Reservation [Default:512M] (64M, 128M, 256M, 512M, 1G or 2G)
Creating Application: OKWould you like to bind any services to 'cf1'? [yN]:
Uploading Application: Checking for available resources: OK Packing application: OK Uploading (2K): OK Push Status: OKStarting Application: OK
$ vmc push cf1 --path target \ --url cer-cf1.cloudfoundry.comDetected a Java Web Application, is this correct?
[Yn]:
Access the application
$ curl cer-cf1.cloudfoundry.com<html><body><h2>Hello World!</h2></body></html>
Change the application
$ vi src/main/webapp/index.jsp $ mvn package
Update the running application
$ vmc update cf1 --path target Uploading Application: Checking for available resources:
OK Packing application: OK Uploading (2K): OK Push Status: OKSuccessfully updated Application:
'cf1'Stopping Application: OKStarting Application: OK
Access it again
$ curl cer-cf1.cloudfoundry.com<html><body><h2>This is Cloud Foundry</h2></body></html>
Scale the application
$ vmc instances cf1 +2Scaling Application instances up to 3: OK
$ vmc stats cf1
+----------+-------------+----------------+--------------+--------------+| Instance | CPU (Cores) | Memory (limit) | Disk (limit) | Uptime |
+----------+-------------+----------------+--------------+--------------+| 0 | 1.2% (4) | 90.6M (512M) | 8.5M (2G) | 0d:0h:3m:3s || 1 | 9.5% (4) | 60.9M (512M) | 8.4M (2G) | 0d:0h:0m:17s |
| 2 | 9.4% (4) | 55.5M (512M) | 8.4M (2G) | 0d:0h:0m:17s |+----------+-------------+----------------+--------------+--------------+
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services Spring and Cloud Foundry
Using NoSQL databases
Cloud Foundry and asynchronous architectures
Available services
41
Creating a service instance
$ vmc create-service mysql --name mysql1Creating Service: OK
$ vmc services
============== System Services ==============+------------+---------+---------------------------------------+
| Service | Version | Description |+------------+---------+---------------------------------------+| mongodb | 1.8 | MongoDB NoSQL store |
| mysql | 5.1 | MySQL database service || postgresql | 9.0 | PostgreSQL database service (vFabric) |
| rabbitmq | 2.4 | RabbitMQ messaging service || redis | 2.2 | Redis key-value store service |+------------+---------+---------------------------------------+
=========== Provisioned Services ============
+-------------+---------+| Name | Service |
+-------------+---------+| mysql1 | mysql |
+-------------+---------+
Typical Spring application is cloud ready
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" ! ! ! value="com.mysql.jdbc.Driver" /> <property name="url" ! value="jdbc:mysql://localhost:3306/cf" /> <property name="username" value="cfuser" /> <property name="password" value="cfpassword" /> … </bean> class SomeClass {
@Autowired private DataSource dataSource;}
Deploying it
$ vmc push cer-spring --path web/target/Application Deployed URL [cer-spring.cloudfoundry.com]: Detected a Java SpringSource Spring Application, is this correct? [Yn]:
Memory Reservation (64M, 128M, 256M, 512M, 1G) [512M]:
Creating Application: OKWould you like to bind any services to 'cer-spring'? [yN]: y
Would you like to use an existing provisioned service? [yN]: yThe following provisioned services are available
1: mysql1
2: mysql-135e0Please select one you wish to use: 1
Binding Service [mysql1]: OKUploading Application:
Checking for available resources: OK
Processing resources: OK Packing application: OK
Uploading (12K): OK
Would you like to bind any services to 'cer-spring'? [yN]: yWould you like to use an existing provisioned service? [yN]: yThe following provisioned services are available1: mysql12: mysql-135e0Please select one you wish to use: 1Binding Service [mysql1]: OK
DataSource bean is reconfigured automatically
<beans>
<bean id="dataSource" class="…"> … DataSource for MySQL instance … </bean>
</beans>
class SomeClass { @Autowired private DataSource dataSource;}
Using database tools
Using Caldecott…
$ vmc tunnel1: mysql-135e02: mysql1
Which service to tunnel to?: 2Password: ********
Stopping Application: OKRedeploying tunnel application 'caldecott'.Uploading Application:
Checking for available resources: OK Packing application: OK
Uploading (1K): OK Push Status: OKBinding Service [mysql1]: OK
Staging Application: OK Starting Application: OK
Getting tunnel connection info: OK
Service connection info:
username : uMe6Apgw00AhS password : pKcD76PcZR7GZ
name : d7cb8afb52f084f3d9bdc269e7d99ab50
Starting tunnel to mysql1 on port 10000.
1: none2: mysql
Which client would you like to start?: 2
…Using Caldecott
Launching 'mysql --protocol=TCP --host=localhost --port=10000 --user=uMe6Apgw00AhS --password=pKcD76PcZR7GZ d7cb8afb52f084f3d9bdc269e7d99ab50'
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 10944342
Server version: 5.1.54-rel12.5 Percona Server with XtraDB (GPL), Release 12.5, Revision 188
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Testing scenario
Create MySQL service instance Use Caldecott to tunnel database
Populate DB using mysql+sql scripts Deploy application bound to database Test the application … Delete application and database
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry Using NoSQL databases
Cloud Foundry and asynchronous architectures
51
Spring programming model
POJO
Dependency Injection
Aspect-Oriented Programming
Portable ServiceAbstractions(Transactions, data access, …)
Benefits:•Improved developer productivity•Higher quality code•Portability across application servers
Spring is ideal for the cloud environment
Yet another environment for your application to run in
• Different Java runtime
• Different databases – sometimes not relational!
Dynamic environment:
• Servers come and go
• IP addresses change
Must integrate with in-house applications:
• RPC
• Asynchronous messaging
To leverage elasticity your application must be architected to scale up and down
• Asynchronous, loose coupling
= Problems already solved by the Spring framework
Spring 3.1 features for cloud applications
53
Cloud Foundry Runtime
Spring configuration options
Auto-reconfiguration
<cloud:*/> namespace
CloudEnvironment API
VCAP_APPLICATION, VCAP_SERVICES env vars
VCAP_APPLICATION
{ "instance_id": "e53853fe21d5d740aadf7ddcc0670b4e", "instance_index": 0, "name": "cer-spring", "uris": ["cer-spring.cloudfoundry.com"], "users": ["[email protected]"], "version": "56892923b974db90a8f6c7120b665fb17cff7edb-1", "start": "2011-12-02 23:06:01 +0000", "runtime": "java", "state_timestamp": 1322867161, "port": 40198, "limits": { "fds": 256, "mem": 536870912, "disk": 2147483648 }, "host": "172.30.50.9"
VCAP_SERVICES
{ "mysql-5.1": [{ "name": "mysql1", "label": "mysql-5.1", "plan": "free", "tags": ["mysql", "mysql-5.1", "relational"], "credentials": { "name": "d7cb8afb52f084f3d9bdc269e7d99ab50", "hostname": "172.30.48.20", "host": "172.30.48.20", "port": 3306, "user": "usmMRfwzyYG53", "username": "usmMRfwzyYG53", "password": "pxWSBVeu80GDp" } }]
CloudEnvironment: parses JSON so you don't have to
CloudEnvironment env = new CloudEnvironment();Properties props = env.getCloudProperties();String prop = props.getProperty( "cloud.services.mysql1.connection.hostname" );
ApplicationInstanceInfo instanceInfo = env.getInstanceInfo();
int port = instanceInfo.getPort();List<String> urls = instanceInfo.getUris();…
Provides access to ServiceInfo…
RdbmsServiceInfo mis = env.getServiceInfo(
! ! "mysql1", ! ! RdbmsServiceInfo.class);String mySqlUrl = mis.getUrl();
59
… which can create DataSources etc
@Configurationpublic class CloudDataSourceConfiguration {
@Bean public DataSource dataSource() { CloudEnvironment environment = new CloudEnvironment();
RdbmsServiceInfo mysqlSvc = ! ! environment.getServiceInfo("mysql1",
RdbmsServiceInfo.class);
! RdbmsServiceCreator dataSourceCreator = new RdbmsServiceCreator();
DataSource dataSource = dataSourceCreator.createService(mysqlSvc);
return dataSource; }
}
<cloud:*/> namespace
Spring XML namespace Defines beans from CloudEnvironment• Connection factories, e.g. DataSource
• Properties
61
<cloud:data-source/> Configures a JDBC DataSource
<cloud:data-source id="dataSource" service-name="mysql1"> <cloud:pool pool-size="1-5"/> <cloud:connection properties="charset=utf-8"/></cloud:data-source>...
@Autowired private DataSource dataSource ;
62
<cloud:properties>
Exposes basic information about services that can be consumed with Spring’s property placeholder support
Properties automatically available when deploying Spring 3.1 applications
<cloud:properties id="cloudProperties" /><context:property-placeholder properties-ref="cloudProperties"/>
class SomeClass {
@Value("${cloud.services.mysql1.connection.hostname}")private String mysqlHost;
Configuring Cloud Foundry apps is easy
BUT
How to run on the desktop too?
Isolating Cloud Foundry configuration Use Spring 3.1 profiles Beans belong to one or more profiles
At runtime, one or active profiles ⇒ active beans By default, default profile is active Activate profiles using • system property: -Dspring.active.profiles=profile1,profile2
• programmatically
65
Using <beans profile=""/>
<bean class="org.sf.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource"/></bean>
<beans profile="default"> <bean class="org.a.commons.dbcp.BasicDataSource" id="dataSource"> <property name="url" value="jdbc:mysql://localhost/my_db" /> </bean></beans>
<beans profile="cloud"> <cloud:data-source id="dataSource" /></beans>
Outside of Cloud Foundry
Inside Cloud Foundry
Profiles available in Spring 3.1
66
Using @Profile
@Configuration@Profile("default")public class LocalDataSourceConfiguration {
@Bean public DataSource dataSource() {
}
}
@Configuration@Profile("cloud")public class CloudDataSourceConfiguration {
@Bean public DataSource dataSource() {! ! … }
}
Application configuration via environment variables
String value = System.getenv("PAYMENT_SVC")
@Value("#{systemEnvironment['PAYMENT_SVC']}")private String envVariable;
$ vmc env-add cf1 PAYMENT_SVC=http://...Adding Environment Variable
[PAYMENT_SVC=http://...]: OKStopping Application: OKStaging Application: OK
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases• Why NoSQL?
• Using MongoDB
• Cloud Foundry and MongoDB
Cloud Foundry and asynchronous architectures
Cloud Foundry provides NoSQL-aaS
69
But what’s a NoSQL database?
Why would you want to use it?
How do you use it?
Solution: Use NoSQL
Benefits• Higher performance• Higher scalability• Richer data-model• Schema-less
Drawbacks• Limited transactions• Relaxed consistency• Unconstrained data
70
Future = multi-paradigm data storage for enterprise applications
IEEE Software Sept/October 2010 - Debasish Ghosh / Twitter @debasishg
e.g. Netflix• RDBMS• SimpleDB• Cassandra• Hadoop/Hbase
71
Spring Data is here to help
http://www.springsource.org/spring-data
NoSQL databases
For
72
What you get
Template classes that hide the boilerplate code, similar to JdbcTemplate
Auto-generated (generic) repositories
Java ⇔ NoSQL mapping
Cross Store Persistence
Support in Roo and Grails
73
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases• Why NoSQL?
• Using MongoDB
• Cloud Foundry and MongoDB
Cloud Foundry and asynchronous architectures
MongoDB
Document-oriented database
• JSON-style documents: Lists, Maps, primitives
• Schema-less
Transaction = update of a single document
Rich query language for dynamic queries
Very fast
Writes are asynchronous!
Highly scalable and available
75
Server
Database: Food To Go
Collection: Restaurants
Data model = Binary JSON documents
{ "name" : "Sahn Maru", "type" : ”Korean", "serviceArea" : [ "94619", "94618" ], "openingHours" : [ { "dayOfWeek" : "Wednesday", "open" : 1730, "close" : 2230 } ], "_id" : ObjectId("4bddc2f49d1505567c6220a0")}
Sequence of bytes on disk fast i/o
76
MongoDB use cases
Use cases
• High volume writes
• Complex data
• Semi-structured data
Who is using it?
• Shutterfly, Foursquare
• Bit.ly Intuit
• SourceForge, NY Times
• GILT Groupe, Evite,
• SugarCRM
77
MongoTemplate
databaseNameuserIdPassworddefaultCollectionName
writeConcernwriteResultChecking
save()insert()remove()updateFirst()findOne()find()…
MongoTemplate
Mongo(Java Driver class)
<<interface>>MongoConvertor
write(Object, DBObject)read(Class, DBObject)
uses
POJO DBObjectmapping
Simplifies data accessTranslates exceptions
MongoMappingConverter
78
Example entity
public class Restaurant { private String id; private String name; private List<MenuItem> menuItems;
public Restaurant() { }
public Restaurant(String name) { this.name = name; … }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
…getters and setters…
public class MenuItem { private String name; private double price;
public MenuItem() { }
public MenuItem(String name, double price) { this.name = name; this.price = price; }
…getters and setters…79
Example data access code
@Repositorypublic class RestaurantRepository {
@Autowired private MongoTemplate mongoTemplate; public static final String RESTAURANTS_COLLECTION = "restaurants";
public void add(Restaurant restaurant) { mongoTemplate.save(RESTAURANTS_COLLECTION, restaurant); }
public List<Restaurant> findRestaurantsByName(String restaurantName) { return mongoTemplate.find(RESTAURANTS_COLLECTION, new Query(where("name").is(restaurantName)), Restaurant.class); }
80
Mongo document
81
{ "_id" : ObjectId("4d977f55d3fe3119c904e026"), "menuItems" : [ { "name" : "Tandoori Portobello Mushrooms", "price" : 5.5 }, { "name" : "Duck Curry Kerala", "price" : 15 } ], "name" : "Ajanta" }
MongoDB bean definitions
82
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases• Why NoSQL?
• Using MongoDB
• Cloud Foundry and MongoDB
Cloud Foundry and asynchronous architectures
Using Mongo and Redis with Cloud Foundry
84
Create a service - Mongo or Redis
Bind it to your application
Use <cloud:*/> namespace to access the bound service
• when cloud profile is active
Deploying a Mongo application
85
Using the Mongo Application
86
NoSQL and Caldecott
87
Caldecott let’s you tunnel to a NoSQL service
Use Redis CLI
• redis-cli
• Explore database, adhoc operations
• ...
Use Mongo CLI etc
• Explore database, adhoc operations
• Mongo dump/restore
• ...
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases
Cloud Foundry and asynchronous architectures• Why use messages?
• RabbitMQ and Spring AMQP
• Using Spring Integration
• Using RabbitMQ on Cloud Foundry
Cloud Foundry provides RabbitMQ - aaS
89
But what’s RabbitMQ?
Why would you want to use it?
How do you use it?
But why messaging? Why RabbitMQ?
90
Application A Application B
RabbitMQ
Traditional application integration
ShippingService
StoreFront
wgrus-store.war
AccountingService
wgrus-billing.war
wgrus-shipping.war
WidgetInventoryService
wgrus-inventory.war
GadgetInventoryService
wgrus-inventory.war
MySQL
91
Message Broker
Decouples front-end from back-endFront-end continues to work when back-end is downBroker smoothes out traffic spikes
Messaging within applications
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases
Cloud Foundry and asynchronous architectures• Why use messages?
• RabbitMQ and Spring AMQP
• Using Spring Integration
• Using RabbitMQ on Cloud Foundry
RabbitMQ – Messaging that Just Works
RobustHigh-performance
Easy to useAMQP LEADER
Why AMQP?
17
A Protocol, not an API•A defined set of messaging capabilities called the AMQ model•A network wire-level protocol, AMQP
On commodity hardware•10-‐25 thousand messages per second is rou7ne *•The NIC is usually the boIleneck
* Non-‐persistent messages
Spring AMQP
Encapsulates low-level details
Simplifies sending and receiving of messages
Producer
Spring AMQP
AMQP
AmqpTemplate
Consumer
ListenerContainer
@Component public class MessageSender {
@Autowired private volatile AmqpTemplate amqpTemplate;
public void send(String message) { this.amqpTemplate.convertAndSend( "myExchange", "some.routing.key", message); }
public void read() throws Exception { ... String value =
amqpTemplate.receiveAndConvert("myQueueName"); ... }
96
Sending AMQP messages
Spring AMQP is flexible and dynamic
BUT
It’s very low level
97
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases
Cloud Foundry and asynchronous architectures• Why use messages?
• RabbitMQ and Spring AMQP
• Using Spring Integration
• Using RabbitMQ on Cloud Foundry
Spring Integration
Builds on Spring framework
High-level of abstraction for building message based applications
Implements EAI patterns
Provides plumbing for exchanging messages between application components
Promotes loosely coupled components
Integrates with external messaging infrastructure: JMS, AMQP, HTTP, Email, File transfer
99
Spring Integration concepts
Message channel
• Virtual pipe connecting producer and consumer
Message endpoints
• The filter of a pipes-and-filter architecture
• Read from and/or write to channel
Endpoint types:
• Transformer
• Filter
• Router
• Splitter
• Aggregator
• ServiceActivator
• Inbound channel adapter - read from external source, writes to channel
• Outbound channel adapter - read from channel write to external destination
100
Using Spring Integration with the web store application
101
ShippingService
StoreFront
wgrus-store.war
Credit Service
wgrus-billing.war
wgrus-shipping.war
WidgetInventoryService
wgrus-inventory.war
GadgetInventoryService
102
Spring Integration
Spring IntegrationSpring Integration RabbitMQ
orderChannel object to JSON amqpOut
StoreUI
Message Endpoint AMQP
Store front flow
103
AMQP inventory Json to Object
credit checkenricher
inventory encricher
inventoryAMQP Out AMQP
CreditService
credit check
credit checkservice
activator
widgetinventoryservice
inventoryrouter
gadgetinventoryservice
Content Based Router
Object to JSON
Inventory flow
104
AMQP shipping order
channel
Json to Object
Service Activator
shipping service
Shipping flow
105
Agenda
Why PaaS?
Cloud Foundry basics
Using Cloud Foundry services
Spring and Cloud Foundry
Using NoSQL databases
Cloud Foundry and asynchronous architectures• Why use messages?
• RabbitMQ and Spring AMQP
• Using Spring Integration
• Using RabbitMQ on Cloud Foundry
Rabbit on Cloud Foundry
107
Configuring a ConnectionFactory
108
<rabbit:template id="rabbitTemplate" connection-factory="rabbitConnectionFactory"/>
<beans profile="default"> ... <rabbit:connection-factory id="rabbitConnectionFactory"/></beans>
<beans profile="cloud"> ... <cloud:rabbit-connection-factory id="rabbitConnectionFactory"/></beans>
Using Caldecott with RabbitMQ
Use for JUnit/Integration tests
Run RabbitMQ tools
109
xxxxx
xxxxx
xxxxx
Summary
PaaS? Good.
Cloud Foundry? Good.
Spring? Good.
Cloud Foundry and Spring? Really good!
Home work:• Learn Spring: http://www.springframework.org• Learn Spring Data http://www.springframework.org/spring-data• sign up for (free) Cloud Foundry at http://www.cloudfoundry.com
• Download the Cloud Foundry Micro Cloud
110