Pro Spring Integration is an authoritative book from the experts that guides you through the vast world of enterprise application integration (EAI) and application of the Spring Integration framework towards solving integration problems. The book is: An introduction to the concepts of enterprise application integration A reference on building event-driven applications using Spring Integration A guide to solving common integration problems using Spring Integration What makes this book unique is its coverage of contemporary technologies and real-world information, with a focus on common problems that users are likely to confront. This book zeroes in on extending the Spring Integration framework to meet your custom integration demands. As Spring Integration is an extension of the Spring programming model, it builds on the Spring Framework's existing support for enterprise integration. This book will take you through all aspects of this relationship and show you how to get the most out of your Spring applications, where integration is a consideration. It discusses simple messaging within Spring-based applications and integration with external systems via simple adapters. Those adapters provide a higher-level of abstraction over Spring's support for remoting, messaging, and scheduling, all of which receives coverage in this book. What you’ll learn Introduces the wide world of Spring Integration with an overview of application integration, the patterns involved and then quickly moving into applications How to identify integration problems that are best solved using Spring Integration and enterprise application integration (EAI) Discover and apply EAI patterns and related architectural concepts like staged event driven architectures (SEDA) Explore the concepts behind message-oriented middleware (MOM) How to interface with external systems using Spring Integration Extend the Spring Integration stack with custom adapters, endpoints, and more What are the next steps to production with expert insight into error handling, monitoring, management, and scaling the enterprise Java application Who this book is for This book is for any developer looking for a more natural way to build event-driven applications using familiar Spring idioms and techniques. The book is also geared towards architects seeking to better their applications and increase productivity in their developers. Table of Contents Enterprise Application Integration Fundamentals Exploring the Alternatives Introduction to Core Spring Framework Introduction to Enterprise Spring Introduction to Spring Integration Channels Transformation and Enrichment Message Flow: Routing and Filtering Endpoints and Adapters Monitoring and Management Talking to The Metal Enterprise Messaging with JMS and AMQ Social Messaging with Email, XMPP, and Twitter Web Services Extending Spring Integration Scaling Your Spring Integration Application Spring Integration and Spring Batch Spring Integration and Your Web Application Cover......Page 1 Contents at a Glance......Page 3 Contents......Page 645 About the Authors......Page 656 About the Technical Reviewers......Page 657 Acknowledgments......Page 658 Who This Book Is For......Page 4 How This Book Is Structured......Page 5 Integration of Data and Services Between Disparate Systems......Page 7 Integration Between Companies......Page 8 Technology......Page 9 People......Page 10 File Transfer......Page 11 Remote Procedure Calls......Page 12 Messaging......Page 13 SEDA (Staged Event-Driven Architecture)......Page 14 EAI Architecture......Page 15 webMethods (Active Software)......Page 16 Oracle SOA Suite......Page 17 EAI Patterns......Page 18 Summary......Page 20 Exploring the Alternatives......Page 21 Implementing the Integration Example......Page 22 Implementing the Integration Example......Page 27 Implementing the Integration Example......Page 36 Implementing the Integration Example......Page 56 Maintainability......Page 65 Summary......Page 66 The Inversion of Control Container......Page 67 Spring Container Metadata Configuration......Page 68 Instantiating the IoC Container......Page 69 Bean Instantiation from the IoC Container......Page 70 Static and Instance Factory Injection......Page 71 Bean Scopes......Page 73 Customizing Bean Initialization and Disposal......Page 76 Simplifying Configuration with Bean Autowiring......Page 77 Autowiring Beans byType......Page 78 Autowiring Beans by Annotation......Page 79 Differentiating Auto-Wired Beans......Page 81 Automatically Discovering Beans on the Classpath......Page 83 Further Reducing XML with Java Configuration......Page 85 Making Beans Aware of the Container......Page 87 Externalizing Bean Property Values......Page 88 Internationalization (i18n) Using MessageSource......Page 89 Aspect-Oriented Programming with AspectJ......Page 91 Declaring Aspects with AspectJ Annotations......Page 93 Defining Advice Order......Page 95 Introducing Behaviors to Your Beans......Page 97 Writing Custom Spring Namespaces......Page 99 Writing the Namespace Handler......Page 101 Features of the Language Syntax......Page 103 Uses of the Language in Your Configurations......Page 105 Summary......Page 107 Data Access Framework......Page 108 Selecting a Relational Model......Page 109 Configuring an Embedded Data Source......Page 110 Configuring a Remote Data Source......Page 111 Basic JdbcTemplate Usages......Page 112 JdbcTemplate Callback Interfaces......Page 115 Using JdbcTemplate to Query......Page 117 Integrating Hibernate 3 and Spring......Page 119 Configuring a Hibernate SessionFactory......Page 121 The Hibernate Template......Page 122 Persistence with Hibernate in a JPA Context......Page 124 Configuration and Usage of JpaTemplate......Page 126 Using JPA EntityManagers Directly......Page 130 Transaction Management Framework......Page 133 Spring Transaction Management......Page 134 Controlling Transaction Propagation with the TransactionStatus Interface......Page 135 Setting Up Transaction Control with TransactionTemplate......Page 136 Declaring Transactions with Transaction Advices......Page 139 Declarative Transaction Managing with the @Transactional Annotation......Page 143 Spring Remoting......Page 147 Exposing and Invoking Services with RMI......Page 148 Summary......Page 153 History......Page 154 Messages......Page 155 Message Endpoints......Page 156 First Steps for Spring Integration......Page 157 How to Set Up Your IDE......Page 158 Starting Your First Spring Integration Project......Page 159 Using SpringSource Tool Suite’s Visual Support......Page 164 Summary......Page 178 EAI Message Channel Patterns......Page 179 Data-Typed Channel......Page 180 Invalid Message Channel......Page 181 Messaging Bridge......Page 182 Choosing a Channel Instance......Page 183 Point-to-Point Channel......Page 185 Channel Interceptors......Page 209 MessagingTemplate......Page 210 PriorityChannel......Page 214 DirectChannel......Page 215 ChannelInterceptor......Page 216 Backing Up a Channel......Page 217 Summary......Page 219 Transformations and Enrichment......Page 220 The Canonical Data Model Concept......Page 221 Transforming a Message......Page 223 Built-In Transformers......Page 226 Leveraging Transformations in Integration......Page 236 Header Enrichers......Page 240 Method-Mapping Transformation......Page 243 Summary......Page 245 Message Flow Patterns......Page 247 Message Flows Using Spring Integration......Page 248 Filters......Page 256 Splitter......Page 262 Aggregator......Page 266 Message Handler Chain......Page 277 Message Bridge......Page 278 Workflow......Page 279 Software Processes......Page 280 Introducing Activiti, an Apache 2 Licensed BPMN 2 Engine......Page 283 Configuring Activiti with Spring......Page 284 The Spring Integration Inbound Activiti Gateway......Page 288 Summary......Page 292 Message Assignment vs. Message Grab......Page 293 Synchronous and Asynchronous Services......Page 294 Polling Consumers......Page 295 Event-Driven Consumers......Page 302 ConsumerEndpointFactoryBean......Page 304 Service Activator......Page 307 JMS Adapters......Page 310 Configuring an Adapter Through the XML Namespace......Page 311 Configuring Adapters with STS......Page 313 Messaging Gateways......Page 318 Spring Integration Support for Gateways......Page 319 Asynchronous Gateways......Page 322 Gateways Receiving No Response......Page 323 Inbound/Outbound Gateways via JMS......Page 324 Secure Channels......Page 327 Summary......Page 330 Error Handling......Page 331 The Error Channel in Spring Integration......Page 332 JMX......Page 335 Basic Monitoring for Your Application......Page 336 Exposing Your Services Through JMX......Page 345 Measuring Performance......Page 348 Hyperic......Page 354 Wire Tap......Page 357 Message History......Page 358 Control Bus......Page 360 Summary......Page 362 File Adapter......Page 363 TCP and UDP Integration......Page 369 Stream Processing......Page 375 Stdin and Stdout......Page 376 Following a Log File......Page 377 FTP......Page 378 SFTP......Page 383 Spring Integration’s Remote File System Abstractions......Page 387 JDBC......Page 389 JDBC Inbound Channel Adapter......Page 390 JDBC Outbound Channel Adapter......Page 393 JDBC Outbound Gateway......Page 395 Summary......Page 398 JMS Integration......Page 399 JMS Brokers......Page 400 JMS Channel Adapters......Page 417 JMS Gateway......Page 429 JMS-Backed Message Channel......Page 430 AMQP Integration......Page 436 SpringSource RabbitMQ......Page 438 Apache Qpid......Page 446 Amazon SQS......Page 451 Summary......Page 452 E-mail......Page 453 IMAP and IMAP-IDLE......Page 454 POP3......Page 457 SMTP......Page 459 XMPP......Page 461 Twitter......Page 468 News Feed......Page 476 Summary......Page 478 Maven Dependencies......Page 479 XML Schema......Page 480 Configuring a Web Services Inbound Gateway......Page 481 Payload Extraction with DOM......Page 483 Invoking Web Services Using an Outbound Gateway......Page 485 Web Services and XML Marshalling......Page 487 WSDL Options......Page 494 Outbound Web Services Gateway with XML Marshalling......Page 498 Summary......Page 500 Extending Spring Integration......Page 501 Writing an Event-Driven Adapter......Page 502 Writing a Polling Adapter......Page 513 Outbound Adapters......Page 517 Packaging Your Adapters for Reuse......Page 521 Building a Namespace for the File System Monitoring Adapter......Page 523 Building a Namespace for the Polling Adapter......Page 525 Building a Namespace for the Outbound Channel Adapter......Page 528 Summary......Page 530 Introducing Scalability......Page 531 Java SE......Page 533 Spring Framework......Page 536 Message Broker......Page 543 Web Services......Page 546 Database......Page 548 Claim Check Pattern......Page 549 MessageGroupStore......Page 552 Summary......Page 561 What Is Spring Batch?......Page 562 Setting Up Spring Batch......Page 565 Reading and Writing......Page 568 Transaction and Rollback......Page 574 Concurrency......Page 575 Launching a Job......Page 576 Launching Jobs with Spring Integration......Page 578 Partitioning......Page 581 Spring Batch Admin......Page 586 Summary......Page 590 HTTP Adapters and Gateways......Page 591 HTTP Adapter and Gateway Namespace Support......Page 593 HTTP Adapter and Gateway Example......Page 594 Multipart Support......Page 598 Spring Integration, Comet, and the Asynchronous Web......Page 601 Spring Integration, Flex, and BlazeDS......Page 607 Summary......Page 614 A......Page 615 B......Page 616 C......Page 617 D......Page 619 E......Page 620 G......Page 622 H......Page 623 I......Page 624 J......Page 625 M......Page 627 O......Page 630 P......Page 632 R......Page 634 S......Page 635 T......Page 639 W......Page 640 X, Y, Z......Page 641