鄧禹+劉曉燕
摘要:
微服務(wù)架構(gòu)以其先進(jìn)的架構(gòu)風(fēng)格將應(yīng)用分割成細(xì)小的服務(wù),而MDA(Model Driver Architecture)集成化的模型開發(fā)方法也為解決軟件開發(fā)效率和可移植性問題提供了實現(xiàn)機(jī)制。結(jié)合模型驅(qū)動實現(xiàn)了微服務(wù)架構(gòu)建模開發(fā),將微服務(wù)建模分為概念模型和交互模型兩個過程?;诮换チ鹘UZ言定義概念元模型,設(shè)計了模型轉(zhuǎn)換方法,將概念元模型映射到交互模型,并根據(jù)其提供的組件設(shè)計出一種微服務(wù)模型重用機(jī)制,提高了開發(fā)效率。最終的交互模型以圖形化方式顯示,提供了直觀的模型視圖。
關(guān)鍵詞:
微服務(wù)架構(gòu);MDA;交互流建模語言;模型轉(zhuǎn)換;概念元模型
DOIDOI:10.11907/rjdk.172148
中圖分類號:TP319
文獻(xiàn)標(biāo)識碼:A文章編號文章編號:1672-7800(2018)001-0165-04
Abstract:The Microservice architecture advocates dividing the application into small services with its advanced architectural style,The MDA integrated model development method also provides a mechanism to solve the problem of software development efficiency and portability.Microservice architecture development process and model building are the key research content.On the basis of,this article focuses combined with the model driver to achieve Microservice architecture modeling and development, Microservice modeling is divided into conceptual model and interaction model of the two processes.At the same time, the conceptual meta-model is defined based on the interaction flow modeling language,the design model transformation method maps the conceptual meta-model to the interactive model,and according to the components provided by the design of a Microservice model reuse mechanism,improve development efficiency.The final interaction model is shown in graphical representation, providing an intuitive model view.
Key Words:microservice architecture;model driver architecture;interaction flow modeling language; model transformation;conceptual meta-model
0引言
微服務(wù)架構(gòu)模型[1]將應(yīng)用分割成一系列細(xì)小的服務(wù),每個服務(wù)專注于單一的業(yè)務(wù)功能,每個微服務(wù)都是一個架構(gòu)模型。但由于缺少一種簡潔高效的架構(gòu)方法,使得手工編碼仍是主要的開發(fā)手段,開發(fā)出的微服務(wù)應(yīng)用存在移植性低、維護(hù)性差的缺點。MDA[2]的核心內(nèi)容就是建模,從代碼開發(fā)為中心過渡到模型架構(gòu)為中心,并分離系統(tǒng)的業(yè)務(wù)邏輯和平臺,將設(shè)計階段的重點放在業(yè)務(wù)邏輯上,是實現(xiàn)系統(tǒng)自動轉(zhuǎn)換的重要工具。MDA框架中的平臺獨立模型PIM和平臺相關(guān)模型PSM是模型架構(gòu)的關(guān)鍵技術(shù)[3]。模型轉(zhuǎn)換解決模型到模型及模型到代碼的映射方法,并將方法映射在不同的技術(shù)平臺。交互流建模語言作為最新的建模開發(fā)語言,以其強(qiáng)大的交互模型和組件完成復(fù)雜的建模開發(fā)。通過交互設(shè)計中的關(guān)注點分離(與微服務(wù)架構(gòu)中的服務(wù)分割相同)來改進(jìn)開發(fā)過程,同時改善內(nèi)容、界面組合、交互和導(dǎo)航控制以及與業(yè)務(wù)邏輯的連接,增強(qiáng)模型組件的重用設(shè)計和建模的開發(fā)效率。
本文通過模型驅(qū)動架構(gòu)的設(shè)計,以交互流建模語言為基礎(chǔ),結(jié)合微服務(wù)架構(gòu)設(shè)計特點,建立了一套微服務(wù)架構(gòu)開發(fā)方法,設(shè)計出微服務(wù)重用模塊,以實現(xiàn)模型組件的重復(fù)利用。利用交互流建模語言提供的擴(kuò)展性組件設(shè)計微服務(wù)架構(gòu)模型轉(zhuǎn)換規(guī)則,提供了一種微服務(wù)開發(fā)思路。
1相關(guān)研究
1.1微服務(wù)架構(gòu)建模
模型是有關(guān)屬性的模擬或表示,微服務(wù)圍繞業(yè)務(wù)能力構(gòu)建,能夠完全自主化部署[4]。微服務(wù)架構(gòu)模型可以采用模塊化思想分步建模,將建模設(shè)計分為微服務(wù)概念模型(Mircoservice Conceptual Model,MSCM)和微服務(wù)交互模型(Mircoservice Interaction Model,MSLM)兩個過程。MSCM是一個既抽象又與平臺無關(guān)的模型(PIM),而MSIM則是具體的平臺相關(guān)模型(PSM),完成微服務(wù)開發(fā)的用戶交互和應(yīng)用組建。由MSCM到MSIM,符合模型驅(qū)動架構(gòu)過程中PIM到PSM 的模型映射過程,如圖1所示。
在模型驅(qū)動的開發(fā)過程中,MSCM是一個M1層模型,需要定義一個M2層元模型(Meta-model)對概念模型進(jìn)行描述。因此,整個開發(fā)建模過程的重點是概念元模型的建立和模型轉(zhuǎn)換。endprint