2012年7月31日 星期二

[筆記] Overview of Spring Integration

Source:網路


Spring 出的玩意真是太多了,繼Spring Data後,最近又開始使用Spring Integration,那到底Spring Integration是用來幹什麼呢? 要跟什麼"Integration"?

Spring 一開始設計的出發點,是要讓系統內部各個元件 (component) 和 building blocks 可以自由的組合,並且透過 Inversion of Control 達到鬆耦合(loosely coupled)的設計理念。但是一旦涉及到系統與系統間的整合,就不是 spring 當初設計理念的專長了。

為了增加Spring 在大型系統整合的能力,Spring 必須提出新的擴充功能(Extension),並且達到以下目標:
  • Provide a simple model for implementing complex enterprise integration solutions.
  • Facilitate asynchronous, message-driven behavior within a Spring-based application.
  • Promote intuitive, incremental adoption for existing Spring users.
為了達到這些目標,Spring 參考了  Gregor Hohpe and Bobby Woolf 的大作: “Enterprise Integration Patterns.” ,並且奉行幾個準則 (principles):
  • Components should be loosely coupled for modularity and testability.
  • The framework should enforce separation of concerns between business logic and integration logic.
  • Extension points should be abstract in nature but within well-defined boundaries to promote reuse and portability.
因此就我看來,Spring Integration 是想要提供一個類似 ESB (Enterprise Service Bus)的框架,核心的概念是想提供一個 Async 的 Message-driven architectures ,這點就跟AMQP的概念不謀而合,因此你可以直接使用Spring Integration 提供的介面與實作,或這是搭配其他的實作,就像我們所選擇的就是實作 AMQP (Advanced Message Queuing Protocol )的RabbitMQ來搭配。 (以上是我目前為止的理解) 整個核心概念就是下面這張圖:

Source: Spring integration

Spring Integration  AMQP  RabbitMQ

下圖以一個叫做eBond 的系統範例,來說明Spring Integration與AMQP 和 RabbitMQ 之間的關係。



嗯嗯不過我還沒搞清楚,何時要用Spring integration 的設定,何時要直接用AMQP的設定,這方面仍須研究清楚....


Reference:
[1] Spring Integration Overview

沒有留言 :