You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/07/05 09:39:12 UTC

[incubator-servicecomb-website] 01/01: Publish the website

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-website.git

commit 8abaa74bf0ac1a642eb19ec828611b2efb03b1c5
Merge: 306edcb a2a08d9
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Thu Jul 5 17:38:42 2018 +0800

    Publish the website

 content/assets/images/lc3-workshop/1.jpg           | Bin 0 -> 134577 bytes
 content/assets/images/lc3-workshop/10.jpg          | Bin 0 -> 98890 bytes
 content/assets/images/lc3-workshop/11.jpg          | Bin 0 -> 3970424 bytes
 content/assets/images/lc3-workshop/12.jpg          | Bin 0 -> 81987 bytes
 content/assets/images/lc3-workshop/13.jpg          | Bin 0 -> 40138 bytes
 content/assets/images/lc3-workshop/14.jpg          | Bin 0 -> 103833 bytes
 content/assets/images/lc3-workshop/15.jpg          | Bin 0 -> 93202 bytes
 content/assets/images/lc3-workshop/16.jpg          | Bin 0 -> 124066 bytes
 content/assets/images/lc3-workshop/2.jpg           | Bin 0 -> 115214 bytes
 content/assets/images/lc3-workshop/3.jpg           | Bin 0 -> 116975 bytes
 content/assets/images/lc3-workshop/4.jpg           | Bin 0 -> 102449 bytes
 content/assets/images/lc3-workshop/5.jpg           | Bin 0 -> 5071954 bytes
 content/assets/images/lc3-workshop/6.jpg           | Bin 0 -> 129586 bytes
 content/assets/images/lc3-workshop/7.jpg           | Bin 0 -> 73699 bytes
 content/assets/images/lc3-workshop/8.jpg           | Bin 0 -> 68157 bytes
 content/assets/images/lc3-workshop/9.jpg           | Bin 0 -> 114938 bytes
 .../index.html                                     |  19 ++++++++++++++++++-
 content/feed.xml                                   |  21 +++++++++++++++++++--
 18 files changed, 37 insertions(+), 3 deletions(-)

diff --cc content/assets/images/lc3-workshop/1.jpg
index 0000000,0000000..2bb9837
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/10.jpg
index 0000000,0000000..d3765e8
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/11.jpg
index 0000000,0000000..daa76a8
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/12.jpg
index 0000000,0000000..22f537a
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/13.jpg
index 0000000,0000000..2fdef40
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/14.jpg
index 0000000,0000000..636087f
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/15.jpg
index 0000000,0000000..ed4698a
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/16.jpg
index 0000000,0000000..78cf057
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/2.jpg
index 0000000,0000000..a3df331
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/3.jpg
index 0000000,0000000..eaf1454
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/4.jpg
index 0000000,0000000..8d5c9a5
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/5.jpg
index 0000000,0000000..df120aa
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/6.jpg
index 0000000,0000000..e3b674a
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/7.jpg
index 0000000,0000000..b0a6575
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/8.jpg
index 0000000,0000000..81ccd49
new file mode 100755
Binary files differ
diff --cc content/assets/images/lc3-workshop/9.jpg
index 0000000,0000000..f8f51d0
new file mode 100755
Binary files differ
diff --cc content/docs/apache-servicecomb-incubating-day-report/index.html
index e1474ad,0000000..0d44b88
mode 100644,000000..100644
--- a/content/docs/apache-servicecomb-incubating-day-report/index.html
+++ b/content/docs/apache-servicecomb-incubating-day-report/index.html
@@@ -1,778 -1,0 +1,795 @@@
 +<!doctype html>
 +<!--
 +  Minimal Mistakes Jekyll Theme 4.4.1 by Michael Rose
 +  Copyright 2017 Michael Rose - mademistakes.com | @mmistakes
 +  Free for personal and commercial use under the MIT license
 +  https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE.txt
 +-->
 +<html lang="en" class="no-js">
 +  <head>
 +    <meta charset="utf-8">
 +
 +<!-- begin SEO -->
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +<title>Apache ServiceComb (incubating) Day Report - Apache ServiceComb (incubating)</title>
 +
 +
 +
 +
 +<meta name="description" content="Apache ServiceComb (incubating) Day Report">
 +
 +
 +
 +
 +<meta name="author" content="Wang Kirin">
 +
 +<meta property="og:locale" content="en">
 +<meta property="og:site_name" content="Apache ServiceComb (incubating)">
 +<meta property="og:title" content="Apache ServiceComb (incubating) Day Report">
 +
 +
 +  <link rel="canonical" href="http://github.com/pages/apache/incubator-servicecomb-website/docs/apache-servicecomb-incubating-day-report/">
 +  <meta property="og:url" content="http://github.com/pages/apache/incubator-servicecomb-website/docs/apache-servicecomb-incubating-day-report/">
 +
 +
 +
 +  <meta property="og:description" content="Apache ServiceComb (incubating) Day Report">
 +
 +
 +
 +  <meta name="twitter:site" content="@ServiceComb">
 +  <meta name="twitter:title" content="Apache ServiceComb (incubating) Day Report">
 +  <meta name="twitter:description" content="Apache ServiceComb (incubating) Day Report">
 +  <meta name="twitter:url" content="">
 +
 +  
 +    <meta name="twitter:card" content="summary">
 +    
 +  
 +
 +  
 +    <meta name="twitter:creator" content="@">
 +  
 +
 +
 +
 +  
 +
 +  
 +
 +
 +
 +
 +
 +  <meta property="og:type" content="article">
 +  <meta property="article:published_time" content="2018-06-28T00:00:00+08:00">
 +
 +
 +
 +
 +
 +
 +
 +
 +  <script type="application/ld+json">
 +    {
 +      "@context" : "http://schema.org",
 +      "@type" : "Person",
 +      "name" : "Apache ServiceComb (incubating)",
 +      "url" : "http://github.com/pages/apache/incubator-servicecomb-website",
 +      "sameAs" : null
 +    }
 +  </script>
 +
 +
 +
 +  <meta name="google-site-verification" content="HvJjNd7vvJ-yjSTHlBiIWEYxp_Hrz-PYEY5Idz9LRcA" />
 +
 +
 +
 +
 +<!-- end SEO -->
 +
 +
 +<link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Apache ServiceComb (incubating) Feed">
 +
 +<!-- http://t.co/dKP3o1e -->
 +<meta name="HandheldFriendly" content="True">
 +<meta name="MobileOptimized" content="320">
 +<meta name="viewport" content="width=device-width, initial-scale=1.0">
 +
 +<script>
 +  document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
 +</script>
 +<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js"></script>
 +<script src="/assets/vendor/prism/prism.js"></script>
 +
 +<script type="text/javascript" async
 +  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
 +</script>
 +
 +<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
 +
 +<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
 +<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
 +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
 +<!-- For all browsers -->
 +<link rel="stylesheet" href="/assets/css/main.css">
 +<link rel="stylesheet" href="/assets/vendor/prism/prism.css">
 +
 +<!--[if lte IE 9]>
 +  <style>
 +    /* old IE unsupported flexbox fixes */
 +    .greedy-nav .site-title {
 +      padding-right: 3em;
 +    }
 +    .greedy-nav button {
 +      position: absolute;
 +      top: 0;
 +      right: 0;
 +      height: 100%;
 +    }
 +  </style>
 +<![endif]-->
 +
 +<meta http-equiv="cleartype" content="on">
 +
 +    <!-- start custom head snippets -->
 +
 +<!-- insert favicons. use http://realfavicongenerator.net/ -->
 +<link href="https://fonts.cat.net/css?family=Roboto:400,500,700|Source+Code+Pro" rel="stylesheet">
 +<script src="/assets/js/custom.js"></script>
 +<!-- end custom head snippets -->
 +
 +  </head>
 +
 +  <body class="layout--single">
 +
 +    <!--[if lt IE 9]>
 +<div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
 +<![endif]-->
 +    <div class="masthead">
 +  <div class="masthead__inner-wrap">
 +    <div class="masthead__menu">
 +      <nav id="site-nav" class="greedy-nav">
 +	      
 +          <a class="site-title active" href="/"><img src="/assets/images/ServiceComb-logo-1.png"></a>
 +	      
 +        <ul class="visible-links">
 +          
 +            
 +            <li class="masthead__menu-item">
 +              
 +              
 +              
 +                <a href="/docs/quick-start/">Quick Start</a>
 +              
 +            </li>
 +          
 +            
 +            <li class="masthead__menu-item">
 +              
 +              
 +              
 +                <a href="/users/">Users</a>
 +              
 +            </li>
 +          
 +            
 +            <li class="masthead__menu-item">
 +              
 +              
 +              
 +                <a href="/developers/">Developers</a>
 +              
 +            </li>
 +          
 +            
 +            <li class="masthead__menu-item">
 +              
 +              
 +              
 +                <a href="/year-archive/">Blogs</a>
 +              
 +            </li>
 +          
 +            
 +            <li class="masthead__menu-item">
 +              
 +              
 +              
 +                <a href="/faqs/">FAQ</a>
 +              
 +            </li>
 +          
 +            
 +            <li class="masthead__menu-item">
 +              
 +              
 +              
 +                <a href="/release/">Downloads</a>
 +              
 +            </li>
 +          
 +        </ul>
 +        <button><div class="navicon"></div></button>
 +        <ul class="hidden-links hidden"></ul>
 +        <div class="nav-lang">
 +          
 +            
 +            <a href=/cn/docs/apache-servicecomb-incubating-day-report/>中文</a>
 +          
 +        </div>
 +      </nav>
 +    </div>
 +  </div>
 +</div>
 +
 +
 +    
 +
 +
 +
 +<div id="main" role="main">
 +  
 +  <div class="sidebar sticky">
 +      
 +      <div class="back-to-home">Home > <a href="/">ServiceComb</a></div>
 +      
 +  
 +
 +<div itemscope itemtype="http://schema.org/Person">
 +
 +  
 +
 +  <div class="author__content">
 +    <h3 class="author__name" itemprop="name">Wang Qilin</h3>
 +    
 +      <p class="author__bio" itemprop="description">
 +	    
 +        I like opensource!!
 +	    
 +      </p>
 +    
 +  </div>
 +
 +  <div class="author__urls-wrapper">
 +    <button class="btn btn--inverse">Follow</button>
 +    <ul class="author__urls social-icons">
 +      
 +
 +      
 +        <li>
 +          <a href="https://github.com/wangkirin" itemprop="url">
 +            <i class="fa fa-fw fa-chain" aria-hidden="true"></i> Website
 +          </a>
 +        </li>
 +      
 +
 +      
 +        <li>
 +          <a href="mailto:wangqilintech@gmail.com">
 +            <meta itemprop="email" content="wangqilintech@gmail.com" />
 +            <i class="fa fa-fw fa-envelope-square" aria-hidden="true"></i> Email
 +          </a>
 +        </li>
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      
 +
 +      <!--
 +  <li>
 +    <a href="http://link-to-whatever-social-network.com/user/" itemprop="sameAs">
 +      <i class="fa fa-fw" aria-hidden="true"></i> Custom Social Profile Link
 +    </a>
 +  </li>
 +-->
 +    </ul>
 +  </div>
 +</div>
 +
 +  
 +  </div>
 +
 +
 +
 +  <article class="page" itemscope itemtype="http://schema.org/CreativeWork">
 +    <meta itemprop="headline" content="Apache ServiceComb (incubating) Day Report">
 +    <meta itemprop="description" content="Apache ServiceComb (incubating) Day Report">
 +    <meta itemprop="datePublished" content="June 28, 2018">
 +    <meta itemprop="dateModified" content="June 14, 2018">
 +
 +    <div class="page__inner-wrap">
 +      
 +        
 +          <header>
 +            <h1 class="page__title" itemprop="headline">Apache ServiceComb (incubating) Day Report
 +</h1>
 +            
 +              <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> 
 +
 +
 +
 +
 +  less than 1 minute read
 +
 +</p>
 +            
 +          </header>
 +        
 +      
 +
 +      <section class="page__content" itemprop="text">
 +        <p><strong>Apache ServiceComb (incubating) Day Report</strong></p>
 +
 +<p>​  <br />
 +​<strong>Event Date/Time</strong>: Wednesday, June 27, 2018, 11:00 – 17:30</p>
 +
 +<p><strong>Event Location</strong>: Room 211, China National Convention Center, Beijing, China</p>
 +
 +<p>The microservice open source project - Apache ServiceComb (incubating) host a Open Day Meetup at the China National Convention Center (Beijing, China) from 11.00am to 17.30pm on Wednesday, June 27th. According the workshop, 6 speaker presents 7 topics about Interpretation of the Apache community, Business Microservices Commercial Case Sharing, Overview of ServiceComb Community and Technology Sharing, Domain-Driven Design (DDD) in Microservices etc. 
- About 80 participants attended the workshop on-site and more participants watched the workshop online.</p>
++About 80 participants attended the workshop on-site and about 300 participants watched the workshop online. Besides, during the LC3 conference, the servicecomb community release a letter of “ServiceComb Anniversary” which gained thousands of clicks.</p>
++
++<p><img src="/assets/images/lc3-workshop/1.jpg" alt="1" />
++<img src="/assets/images/lc3-workshop/2.jpg" alt="2" />
++<img src="/assets/images/lc3-workshop/3.jpg" alt="3" />
++<img src="/assets/images/lc3-workshop/4.jpg" alt="4" />
++<img src="/assets/images/lc3-workshop/5.jpg" alt="5" />
++<img src="/assets/images/lc3-workshop/6.jpg" alt="6" />
++<img src="/assets/images/lc3-workshop/7.jpg" alt="7" />
++<img src="/assets/images/lc3-workshop/8.jpg" alt="8" />
++<img src="/assets/images/lc3-workshop/9.jpg" alt="9" />
++<img src="/assets/images/lc3-workshop/10.jpg" alt="10" />
++<img src="/assets/images/lc3-workshop/11.jpg" alt="11" />
++<img src="/assets/images/lc3-workshop/12.jpg" alt="12" />
++<img src="/assets/images/lc3-workshop/13.jpg" alt="13" />
++<img src="/assets/images/lc3-workshop/14.jpg" alt="14" />
++<img src="/assets/images/lc3-workshop/15.jpg" alt="15" />
++<img src="/assets/images/lc3-workshop/16.jpg" alt="16" /></p>
 +
 +
 +        
 +      </section>
 +
 +      <footer class="page__meta">
 +        
 +        
 +  
 +
 +
 +  
 +  
 +  
 +
 +  <p class="page__taxonomy">
 +    <strong><i class="fa fa-fw fa-tags" aria-hidden="true"></i> Tags: </strong>
 +    <span itemprop="keywords">
 +    
 +      
 +      
 +      <a href="/tags/#meetup" class="page__taxonomy-item" rel="tag">Meetup</a><span class="sep">, </span>
 +    
 +      
 +      
 +      <a href="/tags/#microservice" class="page__taxonomy-item" rel="tag">microservice</a><span class="sep">, </span>
 +    
 +      
 +      
 +      <a href="/tags/#report" class="page__taxonomy-item" rel="tag">report</a>
 +    
 +    </span>
 +  </p>
 +
 +
 +
 +
 +
 +        
 +          
 +            
 +              <p class="page__date"><strong><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> Updated:</strong> <time datetime="2018-06-14">June 14, 2018</time></p>
 +            
 +          
 +        
 +      </footer>
 +
 +      <section class="page__share">
 +  
 +    <h4 class="page__share-title">Share on</h4>
 +  
 +
 +  <a href="https://twitter.com/intent/tweet?via=ServiceComb&text=Apache ServiceComb (incubating) Day Report /docs/apache-servicecomb-incubating-day-report/" class="btn btn--twitter" title="Share on Twitter"><i class="fa fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>
 +
 +  <a href="https://www.facebook.com/sharer/sharer.php?u=/docs/apache-servicecomb-incubating-day-report/" class="btn btn--facebook" title="Share on Facebook"><i class="fa fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a>
 +
 +  <a href="https://plus.google.com/share?url=/docs/apache-servicecomb-incubating-day-report/" class="btn btn--google-plus" title="Share on Google Plus"><i class="fa fa-fw fa-google-plus" aria-hidden="true"></i><span> Google+</span></a>
 +
 +  <a href="https://www.linkedin.com/shareArticle?mini=true&url=/docs/apache-servicecomb-incubating-day-report/" class="btn btn--linkedin" title="Share on LinkedIn"><i class="fa fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span></a>
 +</section>
 +
 +
 +      
 +  <nav class="pagination">
 +    
 +      <a href="/cn/docs/apache-servicecomb-day-slides/" class="pagination--pager" title="LC3大会微服务Workshop-Apaceh ServiceComb(incubating) Day 演讲PPT
 +">Previous</a>
 +    
 +    
 +      <a href="#" class="pagination--pager disabled">Next</a>
 +    
 +  </nav>
 +
 +
 +    </div>
 +
 +    
 +      <div class="page__comments">
 +  
 +  
 +    <section id="static-comments">
 +      
 +        <!-- Start static comments -->
 +        <div class="js-comments">
 +          
 +        </div>
 +        <!-- End static comments -->
 +
 +        <!-- Start new comment form -->
 +        <h4 class="page__comments-title">Leave a Comment</h4>
 +        <p class="small">Your email address will not be published. Required fields are marked <span class="required">*</span></p>
 +        <form id="new_comment" class="page__comments-form js-form form" method="post" action="https://api.staticman.net/v1/entry/apache/incubator-servicecomb-website/master">
 +          <div class="form__spinner">
 +            <i class="fa fa-spinner fa-spin fa-3x fa-fw"></i>
 +            <span class="sr-only">Loading...</span>
 +          </div>
 +
 +          <fieldset>
 +            <label for="comment-form-message">Comment <small class="required">*</small></label>
 +            <textarea type="text" rows="3" id="comment-form-message" name="fields[message]" tabindex="1"></textarea>
 +            <div class="small help-block"><a href="https://daringfireball.net/projects/markdown/">Markdown is supported.</a></div>
 +          </fieldset>
 +          <fieldset>
 +            <label for="comment-form-name">Name <small class="required">*</small></label>
 +            <input type="text" id="comment-form-name" name="fields[name]" tabindex="2" />
 +          </fieldset>
 +          <fieldset>
 +            <label for="comment-form-email">Email address <small class="required">*</small></label>
 +            <input type="email" id="comment-form-email" name="fields[email]" tabindex="3" />
 +          </fieldset>
 +          <fieldset>
 +            <label for="comment-form-url">Website (optional)</label>
 +            <input type="url" id="comment-form-url" name="fields[url]" tabindex="4"/>
 +          </fieldset>
 +          <fieldset class="hidden" style="display: none;">
 +            <input type="hidden" name="options[slug]" value="apache-servicecomb-incubating-day-report">
 +            <label for="comment-form-location">Not used. Leave blank if you are a human.</label>
 +            <input type="text" id="comment-form-location" name="fields[hidden]" autocomplete="off"/>
 +          </fieldset>
 +          <!-- Start comment form alert messaging -->
 +          <p class="hidden js-notice">
 +            <strong class="js-notice-text"></strong>
 +          </p>
 +          <!-- End comment form alert messaging -->
 +          <fieldset>
 +            <button type="submit" id="comment-form-submit" tabindex="5" class="btn btn--large">Submit Comment</button>
 +          </fieldset>
 +        </form>
 +        <!-- End new comment form -->
 +      
 +    </section>
 +  
 +</div>
 +
 +    
 +  </article>
 +
 +  
 +  
 +    <div class="page__related">
 +      <h4 class="page__related-title">You May Also Enjoy</h4>
 +      <div class="grid__wrapper">
 +        
 +          
 +
 +
 +
 +<div class="grid__item">
 +  <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">
 +    
 +    <h2 class="archive__item-title" itemprop="headline">
 +      
 +        <a href="/cn/docs/apache-servicecomb-day-slides/" rel="permalink">LC3大会微服务Workshop-Apaceh ServiceComb(incubating) Day 演讲PPT
 +</a>
 +      
 +    </h2>
 +    <p class="archive__item-excerpt" itemprop="description">LC3大会微服务Workshop-Apaceh ServiceComb(incubating) Day 演讲PPT
 +</p>
 +    
 +      <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> 
 +
 +
 +
 +
 +  less than 1 minute read
 +
 +</p>
 +    
 +  </article>
 +</div>
 +
 +        
 +          
 +
 +
 +
 +<div class="grid__item">
 +  <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">
 +    
 +    <h2 class="archive__item-title" itemprop="headline">
 +      
 +        <a href="/cn/docs/apache-servicecomb-incubating-day/" rel="permalink">微服务 Meetup:Apache ServiceComb (incubating) Day 详细议程
 +</a>
 +      
 +    </h2>
 +    <p class="archive__item-excerpt" itemprop="description">Detailed Agenda of Apache ServiceComb (incubating) Day
 +</p>
 +    
 +      <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> 
 +
 +
 +
 +
 +  less than 1 minute read
 +
 +</p>
 +    
 +  </article>
 +</div>
 +
 +        
 +          
 +
 +
 +
 +<div class="grid__item">
 +  <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">
 +    
 +    <h2 class="archive__item-title" itemprop="headline">
 +      
 +        <a href="/docs/apache-servicecomb-incubating-day/" rel="permalink">Microservice Meetup: Detailed Agenda of Apache ServiceComb (incubating) Day
 +</a>
 +      
 +    </h2>
 +    <p class="archive__item-excerpt" itemprop="description">Real time updated information of Apache ServiceComb (incubating) Day
 +</p>
 +    
 +      <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> 
 +
 +
 +
 +
 +  4 minute read
 +
 +</p>
 +    
 +  </article>
 +</div>
 +
 +        
 +          
 +
 +
 +
 +<div class="grid__item">
 +  <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">
 +    
 +    <h2 class="archive__item-title" itemprop="headline">
 +      
 +        <a href="/cn/docs/how-to-grow-up-to-be-an-apache-committer/" rel="permalink">如何从一名开源小白成长为Apache Committer
 +</a>
 +      
 +    </h2>
 +    <p class="archive__item-excerpt" itemprop="description">如何从一名开源小白成长为Apache Committer
 +</p>
 +    
 +      <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> 
 +
 +
 +
 +
 +  less than 1 minute read
 +
 +</p>
 +    
 +  </article>
 +</div>
 +
 +        
 +      </div>
 +    </div>
 +  
 +</div>
 +
 +
 +    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
 +    <div align="center" style="margin: 0 0;">
 +    <ins class="adsbygoogle"
 +         style="display:block; border-bottom: initial;"
 +         data-ad-client="ca-pub-7328585512091257"
 +         data-ad-slot="3049671934"
 +         data-ad-format="auto"></ins>
 +    </div>
 +
 +    <div class="page__footer">
 +      <footer>
 +        <!-- start custom footer snippets -->
 +
 +<!-- end custom footer snippets -->
 +        <div class="container">
 +  <div class="row justify-content-md-center">
 +    
 +    <div class="col">
 +      <ul>
 +        <p class="header">Resources</p>
 +        <li><a href="/docs/quick-start/">Quick Start</a></li>
 +        <li><a href="/users/user-guide/">User Guide</a></li>
 +        <li><a href="/slides/">Slides</a></li>
 +        <li><a href="/users/faq/">Common Questions</a></li>
 +      </ul>
 +    </div>
 +    <div class="col">
 +      <ul>
 +        <p class="header">Contribute</p>
 +        <li><a href="https://github.com/apache/incubator-servicecomb-website/issues/new?title=Issue with _posts/2018-06-28-apache-servicecomb-incubating-day-report.md">Report a Doc Issue</a></li>
 +        <li><a href="https://github.com/apache/incubator-servicecomb-website/edit/master/_posts/2018-06-28-apache-servicecomb-incubating-day-report.md">Edit This Page on Github</a></li>
 +        <li><a href="/developers/submit-codes/">Code Submit Guide</a></li>
 +        <li><a href="/security">Security</a></li>
 +      </ul>
 +    </div>
 +    <div class="col">
 +      <ul class="social-icons">
 +        <p class="header">Community</p>
 +        <li>
 +            <a href="mailto:dev-subscribe@servicecomb.incubator.apache.org" rel="nofollow"><span class="mail">Mailing List</span></a>
 +        </li>
 +        <li>
 +            <a href="https://github.com/apache?q=ServiceComb" target="_blank"><span class="github">Github</span></a>
 +        </li>
 +        <li>
 +            <a href="https://twitter.com/ServiceComb" target="_blank"><span class="twitter">Twitter</span></a>
 +        </li>
 +        <li>
 +            <a href="/feed.xml" target="_blank"><span class="rss">Feed</span></a>
 +        </li>
 +      </ul>
 +    </div>
 +  </div>
 +</div>
 +<div class="page__footer-bottom">
 +  <div>&copy; 2018 Apache ServiceComb (incubating). Powered by <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> &amp; <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
 +</div>
 +
 +      </footer>
 +    </div>
 +
 +    <script src="/assets/js/main.min.js"></script>
 +
 +
 +
 +
 +  <script>
 +  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 +  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 +  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 +  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
 +
 +  ga('create', 'UA-101622733-1', 'auto');
 +  ga('send', 'pageview');
 +</script>
 +
 +
 +
 +
 +
 +
 +
 +  
 +  <script>
 +    (function ($) {
 +    var $comments = $('.js-comments');
 +
 +    $('#new_comment').submit(function () {
 +      var form = this;
 +
 +      $(form).addClass('disabled');
 +      $('#comment-form-submit').html('<i class="fa fa-spinner fa-spin fa-fw"></i> Loading...');
 +
 +      $.ajax({
 +        type: $(this).attr('method'),
 +        url: $(this).attr('action'),
 +        data: $(this).serialize(),
 +        contentType: 'application/x-www-form-urlencoded',
 +        success: function (data) {
 +          $('#comment-form-submit').html('Submitted');
 +          $('.page__comments-form .js-notice').removeClass('notice--danger');
 +          $('.page__comments-form .js-notice').addClass('notice--success');
 +          showAlert('Thanks for your comment! It will show on the site once it has been approved.');
 +        },
 +        error: function (err) {
 +          console.log(err);
 +          $('#comment-form-submit').html('Submit Comment');
 +          $('.page__comments-form .js-notice').removeClass('notice--success');
 +          $('.page__comments-form .js-notice').addClass('notice--danger');
 +          showAlert('Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again.');
 +          $(form).removeClass('disabled');
 +        }
 +      });
 +
 +      return false;
 +    });
 +
 +    function showAlert(message) {
 +      $('.page__comments-form .js-notice').removeClass('hidden');
 +      $('.page__comments-form .js-notice-text').html(message);
 +    }
 +  })(jQuery);
 +  </script>
 +
 +
 +
 +
 +
 +
 +
 +  </body>
 +</html>
diff --cc content/feed.xml
index 06f4d55,0000000..a2e2229
mode 100644,000000..100644
--- a/content/feed.xml
+++ b/content/feed.xml
@@@ -1,1649 -1,0 +1,1666 @@@
- <?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.4.3">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2018-07-04T17:41:45+08:00</updated><id>/</id><title type="html">Apache ServiceComb (incubating)</title><subtitle>The homepage of ServiceComb</subtitle><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt [...]
++<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.4.3">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2018-07-05T17:36:57+08:00</updated><id>/</id><title type="html">Apache ServiceComb (incubating)</title><subtitle>The homepage of ServiceComb</subtitle><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt [...]
 +
 +&lt;p&gt;​  &lt;br /&gt;
 +​&lt;strong&gt;Event Date/Time&lt;/strong&gt;: Wednesday, June 27, 2018, 11:00 – 17:30&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Event Location&lt;/strong&gt;: Room 211, China National Convention Center, Beijing, China&lt;/p&gt;
 +
 +&lt;p&gt;The microservice open source project - Apache ServiceComb (incubating) host a Open Day Meetup at the China National Convention Center (Beijing, China) from 11.00am to 17.30pm on Wednesday, June 27th. According the workshop, 6 speaker presents 7 topics about Interpretation of the Apache community, Business Microservices Commercial Case Sharing, Overview of ServiceComb Community and Technology Sharing, Domain-Driven Design (DDD) in Microservices etc. 
- About 80 participants attended the workshop on-site and more participants watched the workshop online.&lt;/p&gt;</content><author><name>Wang Qilin</name><email>wangqilintech@gmail.com</email><uri>https://github.com/wangkirin</uri></author><category term="microservice" /><category term="Meetup" /><category term="report" /><summary type="html">Apache ServiceComb (incubating) Day Report</summary></entry><entry xml:lang="cn"><title type="html">LC3大会微服务Workshop-Apaceh ServiceComb(incubating) [...]
++About 80 participants attended the workshop on-site and about 300 participants watched the workshop online. Besides, during the LC3 conference, the servicecomb community release a letter of “ServiceComb Anniversary” which gained thousands of clicks.&lt;/p&gt;
++
++&lt;p&gt;&lt;img src=&quot;/assets/images/lc3-workshop/1.jpg&quot; alt=&quot;1&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/2.jpg&quot; alt=&quot;2&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/3.jpg&quot; alt=&quot;3&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/4.jpg&quot; alt=&quot;4&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/5.jpg&quot; alt=&quot;5&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/6.jpg&quot; alt=&quot;6&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/7.jpg&quot; alt=&quot;7&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/8.jpg&quot; alt=&quot;8&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/9.jpg&quot; alt=&quot;9&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/10.jpg&quot; alt=&quot;10&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/11.jpg&quot; alt=&quot;11&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/12.jpg&quot; alt=&quot;12&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/13.jpg&quot; alt=&quot;13&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/14.jpg&quot; alt=&quot;14&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/15.jpg&quot; alt=&quot;15&quot; /&gt;
++&lt;img src=&quot;/assets/images/lc3-workshop/16.jpg&quot; alt=&quot;16&quot; /&gt;&lt;/p&gt;</content><author><name>Wang Qilin</name><email>wangqilintech@gmail.com</email><uri>https://github.com/wangkirin</uri></author><category term="microservice" /><category term="Meetup" /><category term="report" /><summary type="html">Apache ServiceComb (incubating) Day Report</summary></entry><entry xml:lang="cn"><title type="html">LC3大会微服务Workshop-Apaceh ServiceComb(incubating) Day 演讲PPT</title>< [...]
 +&lt;a href=&quot;/assets/slides/20180627/1_How_Apache_works_jb.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;Jean-Baptiste Onofré Apache Member,Talend的Fellow, 04年开始从事Apache软件基金会相关工作,Karaf、Camel、Carbondata等超过20个Apache项目的PMC member。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;深度解读全球最大的开源软件基金会Apache,诠释什么是Apache Way,及Apache的吸引开源项目之处,结合实际项目讲述从开源到孵化再到毕业的全过程,介绍当前ServiceComb的Apache孵化状态。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;《ServiceComb社区概况与Roadmap》&lt;/strong&gt;
 +&lt;a href=&quot;/assets/slides/20180627/2_ServiceComb-introduction-jiangning.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;姜宁 Apache Member,华为开源能力中心技术专家&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;介绍 Apache ServiceComb (incubating) 社区的理念,当前概况,技术走向与社区活动。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;《软通动力基于ServiceComb的智能城市微服务改造历程》&lt;/strong&gt;
 +&lt;a href=&quot;/assets/slides/20180627/3_How_Smart_City_Microserviced_Based_on_ServiceComb_from_iSoftStone.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;鲍永伟 软通动力智慧城市业务副总裁,聚焦于云计算与大数据相关的创新技术在智慧城市的应用。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;软通动力智慧城市业务涉及系统繁多并交互复杂,在进行微服务化时面临微服务粒度设计不合理、代码重复率高、大型应用微服务部署困难等阵痛,本分享介绍软通动力如何使用ServiceComb,特别是ServiceComb的Swagger API,解决阵痛的微服务化历程,使能烟囱系统互通、系统松耦合,以应对智慧城市的微服务多样性挑战。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;《ServiceComb Java SDK和注册中心详解》&lt;/strong&gt;
 +&lt;a href=&quot;/assets/slides/20180627/4_Java_sdk_details_wujimin.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;吴继敏 Apache ServiceComb (incubating) PPMC,ServiceComb商业版本 华为云微服务引擎 原作者&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;介绍 ServiceComb Java Chassis、Service Center的设计细节和特性。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;《ServiceComb在华为消费者云的亿级用户微服务实践》&lt;/strong&gt;
 + &lt;a href=&quot;/assets/slides/20180627/5_Millions_Users_Solution_Based_on_ServiceComb_Microservices_from_Huawei_Consumer_Cloud_lilinfeng.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;李林锋 华为消费者云应用市场微服务架构师,多年平台中间件、云平台、微服务框架设计和开发经验。工作之余爱好技术写作,《Netty权威指南》和《分布式服务框架原理与实践》作者&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;华为消费者云服务为全球100多个国家数亿华为终端用户提供精品云服务,为了支撑业务的快速发展,需要通过微服务架构驱动价值需求更敏捷和高效的交付。利用ServiceComb对SpringMVC、透明RPC开发模式的支持,业务已有的代码可以低成本的迁移到新的微服务架构,同时利用ServiceComb对Reactive异步编程模型的支持,业务实现了全栈异步化改造,相比于传统的同步阻塞式服务调用,性能提升数倍,但是资源损耗却大幅降低…更多实践案例,尽在ServiceComb在华为消费者云的亿级用户实践分享中。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;《微服务的领域驱动设计》&lt;/strong&gt;
 +&lt;a href=&quot;/assets/slides/20180627/6_DDD_in_Microservics_wanglei.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt; 王磊 微服务国内先驱,《微服务架构与实践》作者,华为微服务专家,前ThoughtWorks首席咨询师。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;微服务作为新时代架构方式被业界广泛采纳,也顺理成章成为DDD领域驱动设计的理念的落地工具。本议题分享DDD领域驱动设计理念是如何与微服务友好结合和实践的。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;《ServiceComb 事务一致性解决方案详解》&lt;/strong&gt;
 +&lt;a href=&quot;/assets/slides/20180627/7_Detailed_Introduction_of_Transaction_Consistency_Solution_from_ServiceComb-Saga.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;姜宁 Apache Member,华为开源能力中心技术专家&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;分享ServiceComb的分布式事务Saga解决方案与实践&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;《ServiceComb的ServiceMesh思考》&lt;/strong&gt;
 +&lt;a href=&quot;/assets/slides/20180627/8_Thinking_about_ServiceMesh_in_ServiceComb.pdf&quot;&gt;点击下载&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;田晓亮 华为云 Service Mesh 架构师&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;分享ServiceComb对于服务网格Service Mesh的最新思考,以及ServiceMesh在华为云的实践。&lt;/p&gt;</content><author><name>Kirin Wang</name></author><category term="微服务" /><category term="LC3,PPT,Workshop" /><summary type="html">LC3大会微服务Workshop-Apaceh ServiceComb(incubating) Day 演讲PPT</summary></entry><entry xml:lang="cn"><title type="html">微服务 Meetup:Apache ServiceComb (incubating) Day 详细议程</title><link href="/cn/docs/apache-servicecomb-incubating-day/" rel="alternate" type= [...]
 +
 +&lt;p&gt;本次开放日将主要聚焦在以下几个方面,和企业、用户及开发者一同探讨微服务技术及方向。&lt;/p&gt;
 +
 +&lt;ul&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;Apache 社区解读&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;企业微服务商用案例实践分享&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;ServiceComb的社区概况和技术分享&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;微服务领域驱动设计方法&lt;/p&gt;
 +  &lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;&lt;strong&gt;会议日期/时间&lt;/strong&gt;:2018 年 6 月 27 日,星期三,9:30 – 17:30&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;会议地址&lt;/strong&gt;:中国国家会议中心,北京, &lt;strong&gt;Room 211&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;会议费用&lt;/strong&gt;: 免费&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;参加方式: 可直接免费到场参加Meetup,使用电梯抵达二楼211房间&lt;/strong&gt;。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +
 +&lt;p&gt;&lt;strong&gt;关于Apache ServiceComb (incubating) 项目&lt;/strong&gt;:&lt;/p&gt;
 +
 +&lt;p&gt;ServiceComb Apache软件基金会孵化项目的主体代码由华为云捐赠,致力于帮助企业轻松构建云原生应用及传统企业业务快速微服务化,通过系列解决方案帮助用户快速开发微服务的同时实现对这些微服务应用的高效运维管理。它具有完整的微服务生态栈,无厂商锁定,当前遵循Apache Way进行孵化,已拥有如消费者云、云EI、云安全、云核等华为业务之外的一批非华为商用用户,且社区和开发者也日趋多样化。&lt;/p&gt;
 +
 +&lt;p&gt;这是一个免费的开放日Meetup活动,由Apache ServiceComb (incubating)社区组织,华为云赞助主办,我们邀请到了来自商用企业、Apache、ServiceComb社区及华为的多位专家和工程师,与大家进行分享和探讨,详细议题如下:&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《深度解读Apache软件基金会》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt;11:00-12:00&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;Jean-Baptiste Onofré   Apache Member,Talend的Fellow, 04年开始从事Apache软件基金会相关工作,Karaf、Camel、Carbondata等超过20个Apache项目的PMC member。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;深度解读全球最大的开源软件基金会Apache,诠释什么是Apache Way,及Apache的吸引开源项目之处,结合实际项目讲述从开源到孵化再到毕业的全过程,介绍当前ServiceComb的Apache孵化状态。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《ServiceComb社区概况与Roadmap 》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt;13:30-13:45&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;讲师:&lt;/strong&gt;姜宁 Apache Member,华为开源能力中心技术专家&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;介绍 Apache ServiceComb (incubating) 社区的理念,当前概况,技术走向与社区活动。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《软通动力基于ServiceComb的智能城市微服务改造历程》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt; 13:30-13:45&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;鲍永伟 软通动力智慧城市业务副总裁,聚焦于云计算与大数据相关的创新技术在智慧城市的应用。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;软通动力智慧城市业务涉及系统繁多并交互复杂,在进行微服务化时面临微服务粒度设计不合理、代码重复率高、大型应用微服务部署困难等阵痛,本分享介绍软通动力如何使用ServiceComb,特别是ServiceComb的Swagger API,解决阵痛的微服务化历程,使能烟囱系统互通、系统松耦合,以应对智慧城市的微服务多样性挑战。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《ServiceComb Java SDK和注册中心详解 》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt; 14:15-14:45&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;吴继敏  Apache ServiceComb (incubating) PPMC,ServiceComb商业版本 华为云微服务引擎 原作者&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;介绍 ServiceComb Java Chassis、Service Center的设计细节和特性。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《ServiceComb在华为消费者云的亿级用户微服务实践》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt;14:45-15:15&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;李林锋     华为消费者云应用市场微服务架构师,多年平台中间件、云平台、微服务框架设计和开发经验。工作之余爱好技术写作,《Netty权威指南》和《分布式服务框架原理与实践》作者&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt; 华为消费者云服务为全球100多个国家数亿华为终端用户提供精品云服务,为了支撑业务的快速发展,需要通过微服务架构驱动价值需求更敏捷和高效的交付。利用ServiceComb对SpringMVC、透明RPC开发模式的支持,业务已有的代码可以低成本的迁移到新的微服务架构,同时利用ServiceComb对Reactive异步编程模型的支持,业务实现了全栈异步化改造,相比于传统的同步阻塞式服务调用,性能提升数倍,但是资源损耗却大幅降低…更多实践案例,尽在ServiceComb在华为消费者云的亿级用户实践分享中。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《微服务的领域驱动设计》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt; 15:25-15:55&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt; 王磊    微服务国内先驱,《微服务架构与实践》作者,华为微服务专家,前ThoughtWorks首席咨询师。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;微服务作为新时代架构方式被业界广泛采纳,也顺理成章成为DDD领域驱动设计的理念的落地工具。本议题分享DDD领域驱动设计理念是如何与微服务友好结合和实践的。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《ServiceComb 事务一致性解决方案详解 》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt; 15:55-16:25&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;姜宁 Apache Member,华为开源能力中心技术专家&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;分享ServiceComb的分布式事务Saga解决方案与实践&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;《ServiceComb的ServiceMesh思考 》&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;时间:&lt;/strong&gt;16:25-17:25&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;主讲人:&lt;/strong&gt;田晓亮 华为云 Service Mesh 架构师&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;摘要:&lt;/strong&gt;分享ServiceComb对于服务网格Service Mesh的最新思考,以及ServiceMesh在华为云的实践。&lt;/p&gt;
 +
 +&lt;hr /&gt;
 +&lt;p&gt;&lt;strong&gt;如您需要在参加workshop之余参观LC3展台,请您加入ServiecComb Gitter聊天室咨询:&lt;/strong&gt;   &lt;br /&gt;
 +&lt;strong&gt;&lt;a href=&quot;https://gitter.im/ServiceCombUsers/Lobby&quot;&gt;ServiceComb Gitter 聊天室&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;</content><author><name>Zen Lin</name><email>zenlintechnofreak@gmail.com</email><uri>http://zenlintechnofreak.github.io</uri></author><category term="微服务" /><category term="Meetup" /><summary type="html">Detailed Agenda of Apache ServiceComb (incubating) Day</summary></entry><entry xml:lang="en"><title type="html">Microservice Meetup: Detailed Agenda  [...]
 +
 +&lt;p&gt;​  &lt;br /&gt;
 +​  &lt;br /&gt;
 +The microservice open source project - Apache ServiceComb (incubating) will host a Open Day Meetup at the China National Convention Center (Beijing, China) from 11.00am to 17.30pm on Wednesday, June 27th.&lt;/p&gt;
 +
 +&lt;p&gt;The Open Day will focus on the following aspects and discuss the technology and direction of microservices with enterprises, users and developers.&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;- Interpretation of the Apache community&lt;/p&gt;
 +
 +&lt;p&gt;- Business Microservices Commercial Case Sharing&lt;/p&gt;
 +
 +&lt;p&gt;- Overview of ServiceComb Community and Technology Sharing&lt;/p&gt;
 +
 +&lt;p&gt;- Domain-Driven Design (DDD) in Microservices&lt;/p&gt;
 +
 +&lt;p&gt;​  &lt;br /&gt;
 +​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Event Date/Time&lt;/strong&gt;: Wednesday, June 27, 2018, 11:00 – 17:30&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Event Location&lt;/strong&gt;: Room 211, China National Convention Center, Beijing, China&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Event Cost&lt;/strong&gt;: Complimentary, go up to the Room 211 using the elevators to level 2.&lt;/p&gt;
 +
 +&lt;p&gt;​  &lt;br /&gt;
 +​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;&lt;em&gt;About Apache ServiceComb (incubating) project:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;​         &lt;em&gt;The main code of the Apache ServiceComb (incubating) Project was donated by Huawei Cloud. The project is dedicated to help enterprises easily build cloud native applications and help build microservices from traditional enterprise business. By providing a series of solutions, Apache ServiceComb (incubating) helps users to develop microservices quickly and operate maintenance efficiently of these microservices applications, with a full microservices technolog [...]
 +
 +&lt;p&gt;This is a free Open Meetup organized by the Apache ServiceComb (incubating) community and sponsored by Huawei Cloud. We have invited several experts and engineers from commercial enterprises, Apache Foundation, ServiceComb community and HUAWEI to share their experiences. Detailed agenda as follows:&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;How Apache Works&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time:&lt;/strong&gt; 1100-1200&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker&lt;/strong&gt;: Jean-Baptiste Onofré; Apache Member, fellow of Talend, who started work on the Apache Software Foundation in 2004, and PMC member of 20+ Apache projects such as Karaf, Camel, and Carbondata.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract:&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;In-depth interpretation of the world’s largest open source software foundation – Apache Software Foundation. Introduce what is the “Apache Way” and its attraction, the whole process from open source to incubation and then graduated combined with actual project. Besides, it will introduce the current incubating status of ServiceComb.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;ServiceComb Roadmap&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time:&lt;/strong&gt; 1330-1345&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker:&lt;/strong&gt; Jiang Ning, Apache Member, Huawei Opensource Expert.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract&lt;/strong&gt;:&lt;/p&gt;
 +
 +&lt;p&gt;Introduce Vision, current status, technology Roadmap and community activities of Apache ServiceComb (incubating) community.&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;How Smart City Microserviced Based on ServiceComb from iSoftStone&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time:&lt;/strong&gt; 1345-1415&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker&lt;/strong&gt;: Bao Yongwei; VP of iSoftStone Smart City Business, focusing on implementation and innovations in smart city related to cloud computing and big data.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract&lt;/strong&gt;:&lt;/p&gt;
 +
 +&lt;p&gt;iSoftStone Smart City Business involves a large number of systems with complex interactions. During the process of microservices implementation, it faced inappropriate microservices granularity, high code duplication rate, and difficulty in deployment of large application microservices. This speech will introduce how iSoftStone use ServiceComb, especially ServiceComb’s Swagger API, to resolve the pain points of microservices process, enable interoperability and decoupled chimne [...]
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Detailed Introduction of Java SDK and Service  Center&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time:&lt;/strong&gt; 1415-1445&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker:&lt;/strong&gt; Wu Jiminm,  Apache ServiceComb (incubating) PPMC, Original Author of Huawei Cloud Service Engine&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract:&lt;/strong&gt; &lt;/p&gt;
 +
 +&lt;p&gt;Introduce technical details of Java SDK and Service  Center from ServiceComb.&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Millions Users Solution Based on ServiceComb Microservices from Huawei Consumer Cloud&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time:&lt;/strong&gt; 1445-1515&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker&lt;/strong&gt;: Li Linfeng, microservices architect for Huawei’s Consumer Cloud application market, who has years of experience in designing and developing platform middleware, cloud platforms, and microservices. Author of “Netty authoritative guide” and “The principle and practice of distributed service framework”.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract&lt;/strong&gt;:&lt;/p&gt;
 +
 +&lt;p&gt;Huawei Consumer Cloud services provide high-quality cloud services for hundreds of millions of Huawei end users in more than 100 countries. In order to support the rapid development of the business, it is necessary to drive delivery of value requirements efficiently and agilely through the microservices architecture. By using SpringMVC and transparent RPC development model from ServiceComb, the existing business code can be migrated to the new microservices architecture at a lo [...]
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Domain Driven Design (DDD) in Microservices&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time:&lt;/strong&gt; 1525-1555&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker&lt;/strong&gt;: Wang Lei, pioneer of microservices in China, author of “Microservices Architecture and Practice”, Huawei Microservices Expert, and former ThoughtWorks Chief Consultant.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract&lt;/strong&gt;:&lt;/p&gt;
 +
 +&lt;p&gt;As a new architecture style, microservice has been widely adopted by the industry. It has become a fulfillment tool for the concept of DDD-driven design. This topic shares how to practice microservice with Domain Driven Design philosophy friendly.&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Detailed Introduction of Transaction Consistency Solution from ServiceComb-Saga&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time&lt;/strong&gt;: 1555-1625&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker:&lt;/strong&gt;  Jiang Ning Apache Member, Huawei Opensource Expert.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract&lt;/strong&gt;:&lt;/p&gt;
 +
 +&lt;p&gt;Share ServiceComb’s distributed transaction Saga solution and best practices.&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Thinking about ServiceMesh in ServiceComb&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Time:&lt;/strong&gt; 1625-1730&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Speaker&lt;/strong&gt;: Tian Xiaoliang, Architect in Service Mesh from Huawei Cloud.&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Abstract&lt;/strong&gt;:&lt;/p&gt;
 +
 +&lt;p&gt;Share ServiceComb’s latest thinking on Service Mesh, and ServiceMesh’s practice in Huawei Cloud.&lt;/p&gt;
 +
 +&lt;p&gt;​&lt;/p&gt;
 +
 +&lt;p&gt;​   &lt;br /&gt;
 +&lt;strong&gt;If you want to freely visit the LC3 booth except attending the meet up , please go to our Gitter to inquire:&lt;/strong&gt; &lt;br /&gt;
 +&lt;a href=&quot;https://gitter.im/ServiceCombUsers/Lobby&quot;&gt;ServiceComb Gitter Room&lt;/a&gt;&lt;/p&gt;</content><author><name>Zen Lin</name><email>zenlintechnofreak@gmail.com</email><uri>http://zenlintechnofreak.github.io</uri></author><category term="microservice" /><category term="Meetup" /><summary type="html">Real time updated information of Apache ServiceComb (incubating) Day</summary></entry><entry xml:lang="cn"><title type="html">如何从一名开源小白成长为Apache Committer</title><link  [...]
 +&lt;p&gt;今天收到了来自Apache Vote我成为Committer的邮件,代表自己的贡献得到了充分的肯定;除了感谢团队的给力支持,我更希望将自己的成长经历——如何践行Apache Way的心得介绍给大家,让大家爱上Apache开源社区,也能和我一样成长为自己喜爱项目的Committer。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;根据个人贡献获得价值government-by-merit&quot;&gt;根据个人贡献获得价值(Government By Merit)&lt;/h3&gt;
 +&lt;p&gt;回忆我刚参与ServiceComb项目,面对上万行的存量代码,总觉得无从下手,甚至认为开源社区高手如云,如果没有深厚且对口的技术功底,还是不要来掺和了。&lt;/p&gt;
 +
 +&lt;p&gt;在这个困难而关键的时候,社区导师给了我明确的指导——&lt;strong&gt;不要怕,从小事做起,不要“善小而不为”&lt;/strong&gt;。于是我静下心来,在Jira上寻找最简单的任务,主动请缨的&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/pull/91&quot;&gt;第一个任务&lt;/a&gt;是支持配置兼容,具体需求是&lt;code class=&quot;highlighter-rouge&quot;&gt;cse.xxx&lt;/code&gt;配置项和&lt;code class=&quot;highlighter-rouge&quot;&gt;servicecomb.xxx&lt;/code&gt;配置项要具备等同效果,经过一番努力,成功Merge PR ;之后我又接下另一个简单任务,增加一个Annotation用于支持Json String作为请求参数……&lt;/p&gt;
 +
 +&lt;p&gt;Apache Way非常看重个人贡献,没有贡献,一切无从谈起,&lt;strong&gt;与开源软件同行,不仅看你获得了多少,更要坚持长期贡献&lt;/strong&gt;,这是它与商业软件最大的不同。贡献并不区分大小,无论是增加重大特性,还是小小的改进、Bug Fix和修订文档错误,这些同样是项目茁壮成长的关键。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;实际上大多数开源爱好者都是从修订文档错误开始的&lt;/strong&gt;,例如改正错别字、格式不正确以及订正描述等等,我对ServiceComb的理解也绝大多数来自&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-website/pulls?q=is%3Apr+is%3Aclosed+author%3Azhengyangyong&quot;&gt;这方面的工作&lt;/a&gt;;这样不但能够在阅读文档的过程中更快的了解技术细节,也比较容易入手做出贡献。&lt;/p&gt;
 +
 +&lt;p&gt;总之坚持下来,个人积累的贡献慢慢变厚,获得Apache的认可自然水到渠成。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;社区驱动community&quot;&gt;社区驱动(Community)&lt;/h3&gt;
 +&lt;p&gt;参与社区是技术成长最快的方式之一,Follow Apache社区的方式有订阅&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/developers/subscribe-mail-list/&quot;&gt;邮件列表&lt;/a&gt;和加入&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/developers/use-gitter/&quot;&gt;Gitter&lt;/a&gt;聊天室;从看大家讨论(讨论邮件一般会使用[Discussion]开头),到回答大家的问题(回复邮件和发送Gitter聊天),相信用不了多久你就能收获颇丰,并冒出自己的想法,迈出第一步提交第一个PR也就不难了。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/&quot;&gt;ServiceComb&lt;/a&gt;作为一个微服务一站式解决方案,融合侵入式、非侵入式场景并支持多语言,解放开发者,帮助用户和开发者将企业应用轻松微服务化和上云;大家在这里讨论的话题、发起的投票、以及提交的代码,无不与微服务密切相关。在这个社区中我不但学习到了知识,完成了开源(也包含微服务)小白的蜕变,还进一步接受了开源的洗礼——&lt;strong&gt;前辈指导我进步,我将所学传递给新人&lt;/strong&gt;;这个过程中我结识了很多新朋友,大家互通有无,不但极大的开阔了视野,也提高了自己的社交能力。&lt;/p&gt;
 +
 +&lt;p&gt;Apache开发者来自全球,社区大多都是用英文来交流。通过阅读&lt;a href=&quot;http://servicecomb.incubator.apache.org/users/&quot;&gt;英文资料&lt;/a&gt;,使用英文在&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/developers/use-gitter/&quot;&gt;Gitter&lt;/a&gt;上与开发人员直接交流,通过英文邮件来探讨问题,在不知不觉中自己的英文水平也大大提高了。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;协作开发collaborative-development&quot;&gt;协作开发(Collaborative Development)&lt;/h3&gt;
 +&lt;p&gt;这也是我极力推荐参与开源社区开发的重要原因之一,&lt;strong&gt;当你提交PR后,无论代码有多么烂,你总能收获宝贵的Comments&lt;/strong&gt;,不花钱获得编程大师的指点——教你怎么写出优秀的代码,这是多么合算的买卖!&lt;/p&gt;
 +
 +&lt;p&gt;我在参与ServiceComb社区前,只知道Java基本语法,IDE不熟练(之前一直是用VS写C#,不使用Eclipse和IntelliJ IDEA),不会Git,不懂Maven,还能有更糟糕的起点吗:)&lt;/p&gt;
 +
 +&lt;p&gt;不用担心,社区会指导你。我前文提到的第一个简单的任务,花费了将近一周时间,被打回来了四五次后才被Merge;一个PR收获60+ Comments也是家常便饭。这个过程中我的Java水平成长得飞快,不久后就能独立承担新特性的设计和开发——&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/metrics-in-1.0.0-m1/&quot;&gt;Metrics&lt;/a&gt;,当然,完成这个新特性的过程中Committer和其他开发者给予了很多支持,所以,请大胆的提交你的第一个PR,成为一名Contributor吧。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;民主开放和透明consensus-open-and-transparency&quot;&gt;民主,开放和透明(Consensus, Open and Transparency)&lt;/h3&gt;
 +&lt;p&gt;在Apache社区里投票至关重要,你可以感受到你的建议将被充分重视,我很喜欢这种参与感;大家的讨论和建议也完全公开透明,并且能够长时间通过邮件列表查询到,沟通效率非常高。所以大家多多参与,一定能收获惊喜,从万能的社区里寻找自己想要的答案,请记住,&lt;strong&gt;当你对某个问题产生困惑,即使是强大的StackOverflow也不会有原作者的答复更为准确&lt;/strong&gt;。&lt;/p&gt;
 +
 +&lt;p&gt;写在最后,我想说从一名开源小白成长为Apache Committer并不是无比艰难又遥不可及的事情,&lt;strong&gt;只需要日积月累的在社区中投入一点业余时间,就能梦想成真&lt;/strong&gt;。当然最好找到自己感兴趣的社区,这会让这段旅途更加愉快,也能交到更多志同道合的的朋友。&lt;/p&gt;
 +
 +&lt;blockquote&gt;
 +  &lt;p&gt;广告:我所在的Apache ServiceComb正&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/developers/contributing&quot;&gt;持续招募贡献者&lt;/a&gt;,非常欢迎大家加入,让我们一起构建更好的微服务框架。&lt;/p&gt;
 +&lt;/blockquote&gt;</content><author><name>Yangyong Zheng</name><email>yangyong.zheng@huawei.com</email><uri>https://zhengyangyong.github.io</uri></author><category term="Committer" /><category term="Apache Way" /><summary type="html">如何从一名开源小白成长为Apache Committer</summary></entry><entry xml:lang="cn"><title type="html">轻松微服务系列:快速实现客户关系管理系统的用户服务</title><link href="/cn/docs/easy-build-microservice-system-part-II/" rel="alternate" type="text/html" title="轻松微服务系列:快速实现客户关系管理系统的用户服务" /><publi [...]
 +&lt;p&gt;在前一篇博文&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/docs/easy-build-microservice-system-part-I/&quot;&gt;《轻松微服务系列:从一键构建微服务和DDD设计开始》&lt;/a&gt;,我们已经详细介绍了如何快速构建微服务和DDD相关概念,并引入了一个经典场景——地产CRM。通过&lt;a href=&quot;https://en.wikipedia.org/wiki/Event_storming&quot;&gt;Event Storming&lt;/a&gt;实践获得了系统设计:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/MicroserviceDesign4.png&quot; alt=&quot;MicroserviceDesign4&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;现在,我们将从“用户微服务”入手,探索微服务实现过程中即将面对的细节,并轻松处理这些难点。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;用户微服务并不简单&quot;&gt;用户微服务并不简单&lt;/h3&gt;
 +&lt;p&gt;用户微服务是所有系统中不可或缺的部分,它承载了认证和授权等核心功能——无论是登录一个网站、还是打开一个APP,当涉及到需要身份识别后才能够执行的操作,都需要用户微服务把关。例如观看视频网站上的视频,匿名用户会插播广告,如果希望屏蔽广告,则需要登录并购买VIP会员,登录即是身份认证的过程,而VIP屏蔽广告即是授权的过程。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;认证&quot;&gt;认证&lt;/h4&gt;
 +&lt;p&gt;认证不仅仅是一次性验证用户名和密码的过程,还需要能反复使用认证的结果,确保后继所有操作都是合法的,这就涉及到“有状态”,但HTTP是一个无状态协议,如何能够将登录成功后的认证信息与后继的请求关联起来呢?&lt;/p&gt;
 +
 +&lt;p&gt;我们非常熟悉的做法是使用Session或Cookie:&lt;/p&gt;
 +&lt;ul&gt;
 +  &lt;li&gt;Session存储在服务端,因此具备良好的防篡改能力,但弊端是使服务有状态,微服务系统中,同一个微服务会依据系统压力的大小弹性伸缩出多个运行实例负载均衡,跨实例访问会状态丢失。&lt;/li&gt;
 +  &lt;li&gt;Cookie存储在客户端,它正好与Session相反,优势是服务不必保持状态,但弊端是客户比较容易的篡改Cookie信息,例如修改过期时间以逃避验证,而且浏览器对Cookie也有较多限制。&lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;那么,如何兼顾这两方面的需求呢?Token就是一个比较好的解决方案。&lt;/p&gt;
 +
 +&lt;p&gt;Token中文翻译为令牌,它将登录认证后的信息签名后返回,服务端不保存,客户端请求的时候将认证的完整信息附带上提供给服务端验签,签名可以保证信息不被篡改。了解了了解Token的原理,自然要关注Token的格式,JWT就是这样一个基于JSON的开放标准&lt;a href=&quot;https://tools.ietf.org/html/rfc7519&quot;&gt;RFC-7519&lt;/a&gt;。&lt;/p&gt;
 +
 +&lt;h5 id=&quot;jwt-java-web-token规范&quot;&gt;JWT (Java Web Token)规范&lt;/h5&gt;
 +&lt;p&gt;简而言之JWT规范由三部分构成:&lt;/p&gt;
 +&lt;ol&gt;
 +  &lt;li&gt;Header: 声明Token的类型也就是JWT,以及加密算法,例如:&lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;typ&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;JWT&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;alg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;HS256&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;ol&gt;
 +  &lt;li&gt;Playload:存放有效信息,既包含标准签发者、用户、签发时间、过期时间,唯一标识等信息;也可以存放用户自定义的声明信息,例如权限控制相关的内容,例如:&lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;sub&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1234567890&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;YangYong Zheng&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;iat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1516239022&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 +&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;ol&gt;
 +  &lt;li&gt;Signature:签名信息,包含Header和Playload的原始信息(Base64编码过)以及签名过后的信息。&lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;blockquote&gt;
 +  &lt;p&gt;提示:JWT IO提供了&lt;a href=&quot;https://jwt.io/&quot;&gt;在线编码和解码工具&lt;/a&gt;。&lt;/p&gt;
 +&lt;/blockquote&gt;
 +
 +&lt;h4 id=&quot;授权&quot;&gt;授权&lt;/h4&gt;
 +&lt;p&gt;授权的本意是指将完成某项工作所必须的权力授给下属人员,在软件系统中往往引申为使人或角色具备访问特定资源或更改行为的许可。例如之前提到的VIP屏蔽广告,即是视频网站允许播放终端在特定的帐号登录后跳过广告播放环节(行为)的许可。&lt;/p&gt;
 +
 +&lt;p&gt;授权系统比较常见的做法有ACL和RBAC:&lt;/p&gt;
 +&lt;ul&gt;
 +  &lt;li&gt;ACL:ACL全称Access Control List,它是以受控资源为核心,每一个受控资源,都有一个权限控制列表记录哪些用户或角色对这项资源执行具体操作(也被称为授权点)的权限设置,例如查询(可见)、修改、删除等等。Windows中的文件系统安全即是一个经典的ACL实现案例:&lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/ACL.png&quot; alt=&quot;ACL&quot; /&gt;&lt;/p&gt;
 +
 +&lt;ul&gt;
 +  &lt;li&gt;RBAC:RBAC全称Role Based Access Control,与ACL相比,它以角色为核心,权限落地在角色上,不为特定用户授权。它的优势是大幅简化了用户与权限的管理,在受控对象不多或控制粒度要求不高(例如接口访问控制)的场景下非常适用。&lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/RBAC.png&quot; alt=&quot;RBAC&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;由于微服务系统的权限控制主要是接口访问控制上,并且多采用用户组方式组织用户,因此RBAC是比较流行的做法。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;实现用户微服务&quot;&gt;实现用户微服务&lt;/h3&gt;
 +&lt;h4 id=&quot;第一步创建微服务项目&quot;&gt;第一步:创建微服务项目&lt;/h4&gt;
 +&lt;p&gt;还记得前一篇博文&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/docs/easy-build-microservice-system-part-I/&quot;&gt;《轻松微服务系列:从一键构建微服务和DDD设计开始》&lt;/a&gt;中一键构建微服务的命令行么?使用ServiceComb SpringMVC Archetypes创建用户微服务,在交互模式下,&lt;code class=&quot;highlighter-rouge&quot;&gt;groupId&lt;/code&gt;输入org.apache.servicecomb.scaffold,&lt;code class=&quot;highlighter-rouge&quot;&gt;artifactId&lt;/code&gt;输入user-service,&lt;code class=&quot;highlighter-rouge&quot;&gt;version&lt;/code&gt;使用默认的1 [...]
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/UserServiceInit.png&quot; alt=&quot;UserServiceInit&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;我们删掉HelloImpl和HelloConsumer,并添加自己的实现。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;第二步使用mysql持久化用户信息&quot;&gt;第二步:使用MySQL持久化用户信息&lt;/h4&gt;
 +&lt;p&gt;用户微服务需要持久化用户信息,我们使用MySQL数据库,ORM使用Spring Data JPA:&lt;/p&gt;
 +&lt;h5 id=&quot;引入依赖&quot;&gt;引入依赖&lt;/h5&gt;
 +&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 +  &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;mysql&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 +  &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;mysql-connector-java&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
 +&lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
 +&lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 +  &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 +  &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-data-jpa&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
 +&lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +&lt;h5 id=&quot;定义存储user信息的userentity实体&quot;&gt;定义存储User信息的UserEntity实体&lt;/h5&gt;
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Entity&lt;/span&gt;
 +&lt;span class=&quot;nd&quot;&gt;@Table&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;T_User&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UserEntity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@Id&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getPassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setPassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UserEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UserEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{& [...]
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;在CodeFist模式下,Spring Data JPA会在数据库中自动创建T_User表与此实体映射。&lt;/p&gt;
 +
 +&lt;h5 id=&quot;实现userentity实体的repository&quot;&gt;实现UserEntity实体的Repository&lt;/h5&gt;
 +&lt;p&gt;我们继承JPA的PagingAndSortingRepository来实现ORM操作&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Repository&lt;/span&gt;
 +&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UserRepository&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PagingAndSortingRepository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UserEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Long&lt;/ [...]
 +  &lt;span class=&quot;n&quot;&gt;UserEntity&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;findByName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;h5 id=&quot;配置数据库连接&quot;&gt;配置数据库连接&lt;/h5&gt;
 +&lt;p&gt;在项目的&lt;code class=&quot;highlighter-rouge&quot;&gt;resources&lt;/code&gt;目录下新增&lt;code class=&quot;highlighter-rouge&quot;&gt;application.properties&lt;/code&gt;文件,写入数据库连接信息:&lt;/p&gt;
 +
 +&lt;div class=&quot;language-properties highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;py&quot;&gt;spring.datasource.url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;jdbc:mysql://localhost:3306/user_db?useSSL=false&lt;/span&gt;
 +&lt;span class=&quot;py&quot;&gt;spring.datasource.username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;root&lt;/span&gt;
 +&lt;span class=&quot;py&quot;&gt;spring.datasource.password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;pwd&lt;/span&gt;
 +&lt;span class=&quot;err&quot;&gt;spring.jpa.hibernate.ddl-&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;update&lt;/span&gt;
 +&lt;span class=&quot;py&quot;&gt;spring.jpa.properties.hibernate.dialect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;org.hibernate.dialect.MySQL5Dialect&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;blockquote&gt;
 +  &lt;p&gt;提示:关于Spring Data JPA的更多资料请参见&lt;a href=&quot;https://projects.spring.io/spring-data-jpa/&quot;&gt;这篇文档&lt;/a&gt;,为了能够简化依赖的引入我们实际上使用的是Spring Boot JPA Starter,详细的例子请参见&lt;a href=&quot;https://spring.io/guides/gs/accessing-data-jpa/&quot;&gt;这篇文档&lt;/a&gt;。&lt;/p&gt;
 +&lt;/blockquote&gt;
 +
 +&lt;h4 id=&quot;第三步实现jwt认证&quot;&gt;第三步:实现JWT认证&lt;/h4&gt;
 +&lt;h5 id=&quot;定义jwt接口&quot;&gt;定义JWT接口&lt;/h5&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TokenStore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;generate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +
 +  &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;validate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;generate用于生成Token,validate用于验证Token是否正确。&lt;/p&gt;
 +
 +&lt;h5 id=&quot;实现tokenstore&quot;&gt;实现TokenStore&lt;/h5&gt;
 +&lt;p&gt;我们使用&lt;a href=&quot;https://github.com/jwtk/jjwt&quot;&gt;jjwt&lt;/a&gt;提供的JWT实现,创建JwtTokenStore类,继承TokenStore接口,并重写方法:&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Component&lt;/span&gt;
 +&lt;span class=&quot;nd&quot;&gt;@Component&lt;/span&gt;
 +&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;JwtTokenStore&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TokenStore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Logger&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;LOGGER&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;LoggerFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getLogger&lt;/span&gt;&lt;span class=&quot [...]
 +
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secretKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secondsToExpire&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;JwtTokenStore&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;secretKey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;someSecretKeyForAuthentication&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;secondsToExpire&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;JwtTokenStore&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secretKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secondsToExpire&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot; [...]
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;secretKey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secretKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;secondsToExpire&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secondsToExpire&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;generate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Jwts&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;builder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setSubject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;userName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +        &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setExpiration&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ZonedDateTime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;now& [...]
 +        &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;signWith&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HS512&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secretKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;compact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;validate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;StringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isNotEmpty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Jwts&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
 +       &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setSigningKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;secretKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;parseClaimsJws&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot; [...]
 +    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;JwtException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IllegalArgumentException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +      &lt;span class=&quot;n&quot;&gt;LOGGER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;validateToken token : &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; failed&quot;&lt;/span&gt;&lt [...]
 +    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;h4 id=&quot;第四步实现用户服务&quot;&gt;第四步:实现用户服务&lt;/h4&gt;
 +&lt;h5 id=&quot;定义userservice接口&quot;&gt;定义UserService接口&lt;/h5&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UserService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;n&quot;&gt;ResponseEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Boolean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;logon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UserDTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +  &lt;span class=&quot;n&quot;&gt;ResponseEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Boolean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;login&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UserDTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;logon用于新用户注册,login用于用户登录验证,UserDTO用于参数传递:&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UserDTO&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getPassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UserDTO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UserDTO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt; [...]
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;h5 id=&quot;实现并发布userservice&quot;&gt;实现并发布UserService&lt;/h5&gt;
 +&lt;p&gt;创建UserServiceImpl,继承&lt;code class=&quot;highlighter-rouge&quot;&gt;UserService&lt;/code&gt;接口:&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@RestSchema&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schemaId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;user&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;nd&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UserServiceImpl&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UserService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UserRepository&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TokenStore&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenStore&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Autowired&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UserServiceImpl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UserRepository&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TokenStore&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenStore&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span  [...]
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;repository&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;tokenStore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenStore&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@PostMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;logon&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ResponseEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Boolean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;logon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@RequestBody&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UserDTO&lt;/span&gt; &lt;span  [...]
 +    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;validateUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +      &lt;span class=&quot;n&quot;&gt;UserEntity&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dbUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;findByName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt [...]
 +      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dbUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +        &lt;span class=&quot;n&quot;&gt;UserEntity&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;entity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UserEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&g [...]
 +        &lt;span class=&quot;n&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;entity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ResponseEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpStatus&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;OK&lt;/span&gt;&lt;span class= [...]
 +      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +      &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InvocationException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BAD_REQUEST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;user name had exist&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InvocationException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BAD_REQUEST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;incorrect user&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@PostMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;login&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ResponseEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Boolean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;login&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@RequestBody&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UserDTO&lt;/span&gt; &lt;span  [...]
 +    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;validateUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +      &lt;span class=&quot;n&quot;&gt;UserEntity&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dbUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repository&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;findByName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt [...]
 +      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dbUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dbUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getPassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/sp [...]
 +          &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tokenStore&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;generate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ge [...]
 +          &lt;span class=&quot;n&quot;&gt;HttpHeaders&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;generateAuthenticationHeaders&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +          &lt;span class=&quot;c1&quot;&gt;//add authentication header&lt;/span&gt;
 +          &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ResponseEntity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpStatus&lt;/span&gt;&lt;span [...]
 +        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +        &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InvocationException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BAD_REQUEST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;wrong password&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +      &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InvocationException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BAD_REQUEST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;user name not exist&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InvocationException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BAD_REQUEST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;incorrect user&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;validateUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UserDTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;StringUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isNotEmpty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&qu [...]
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpHeaders&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;generateAuthenticationHeaders&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;n&quot;&gt;HttpHeaders&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpHeaders&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
 +    &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AUTHORIZATION&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;登录成功后,会从TokenStore生成Token,并将其写入Key为&lt;code class=&quot;highlighter-rouge&quot;&gt;AUTHORIZATION&lt;/code&gt;的Header。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;第五步实现授权可选&quot;&gt;第五步:实现授权(可选)&lt;/h4&gt;
 +&lt;p&gt;由于我们允许任何用户注册和登录,所以目前还没有授权的需求,基于RBAC构建授权体系将会在以后的博文中介绍。&lt;/p&gt;
 +
 +&lt;p&gt;经过上面五步,具有基本注册和登录功能的用户微服务就构建好了。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;验证实现的用户服务&quot;&gt;验证实现的用户服务&lt;/h3&gt;
 +&lt;p&gt;启动用户微服务,我们先注册一个账号:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/TestLogon.png&quot; alt=&quot;TestLogon&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;显示注册成功,现在我们使用这个账号登录:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/TestLogin.png&quot; alt=&quot;TestLogin&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;返回登录成功,Response中已经包含了&lt;code class=&quot;highlighter-rouge&quot;&gt;AUTHORIZATION&lt;/code&gt;Header,后继的所有请求都需要使用这个Token值进行合法认证。&lt;/p&gt;
 +
 +&lt;p&gt;至此,实现客户关系管理系统的用户服务工作就结束了,下一篇文章我们会将目光转移到Edge服务,通过Edge服务作为微服务调用的统一入口,在它之上构建统一认证,并讲解如何应对海量级调用的挑战,敬请期待!&lt;/p&gt;</content><author><name>Yangyong Zheng</name><email>yangyong.zheng@huawei.com</email><uri>https://zhengyangyong.github.io</uri></author><category term="Archetypes" /><category term="Scaffold" /><category term="Authentication" /><category term="JWT" /><summary type="html">轻松微服务系列:快速实现客户关系管理系统的用户服务</summary></entry><entry xml:lang="cn"><title type="html">轻松微服务系列:从一键构建微服务和D [...]
 +&lt;p&gt;提到微服务,相信“程序猿”们已经不再陌生,估计大家都多少尝试过微服务框架,也遇到了不少“坑”直呼坑爹吧?其实微服务完全可以使用脚手架功能一键构建出来,开箱即用,而DDD(Domain-Driven Design),也是有章可循。这个“轻松微服务”系列,将为大家开启“轻松”愉快之旅。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;牛刀小试&quot;&gt;牛刀小试&lt;/h3&gt;
 +&lt;p&gt;打开命令行,输入下面的命令:&lt;/p&gt;
 +&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;org.apache.servicecomb.archetypes -DarchetypeArtifactId&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;business-service-jaxrs-archetype -DarchetypeVersion&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1.0.0-m2-SNAPSHOT -DarchetypeRepository&lt;span clas [...]
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;blockquote&gt;
 +  &lt;p&gt;提示:由于Java Chassis Archetypes还处于SNAPSHOT阶段,Repository托管在Apache Snapshots库中,仅用于测试,所以下载速度会稍慢。&lt;/p&gt;
 +&lt;/blockquote&gt;
 +
 +&lt;p&gt;之后按提示指定微服务的&lt;code class=&quot;highlighter-rouge&quot;&gt;groupId&lt;/code&gt;,&lt;code class=&quot;highlighter-rouge&quot;&gt;artifactId&lt;/code&gt;,&lt;code class=&quot;highlighter-rouge&quot;&gt;version&lt;/code&gt;,&lt;code class=&quot;highlighter-rouge&quot;&gt;package&lt;/code&gt;等信息,回车,一个新的微服务就创建好了:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/ArchetypesCreate.png&quot; alt=&quot;Archetypes创建&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;运行它也很简单,使用IDE打开项目,DEBUG -&amp;gt; Application.java,或在命令行:&lt;/p&gt;
 +
 +&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#编译打包&lt;/span&gt;
 +mvn package
 +&lt;span class=&quot;c&quot;&gt;#切换到输出目录&lt;/span&gt;
 +&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;target
 +&lt;span class=&quot;c&quot;&gt;#启动可执行jar包&lt;/span&gt;
 +java -jar xxxx.jar
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;稍等微服务启动就绪,打开浏览器输入&lt;code class=&quot;highlighter-rouge&quot;&gt;http://localhost:8080/hello&lt;/code&gt;验证一下:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/OutputHello.png&quot; alt=&quot;输出hello&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;是不是非常轻松呢?这份轻松来源我们使用Archetypes优化了构建过程,它是脚手架的基础。&lt;/p&gt;
 +
 +&lt;blockquote&gt;
 +  &lt;p&gt;提示:如果想了解更多Archetypes的原理,请参考&lt;a href=&quot;https://maven.apache.org/archetype-archives/archetype-2.3/maven-archetype-plugin/&quot;&gt;这篇文档&lt;/a&gt;,希望理解命令行中使用到的参数,请参考&lt;a href=&quot;https://maven.apache.org/archetype-archives/archetype-2.3/maven-archetype-plugin/generate-mojo.html&quot;&gt;这篇文档&lt;/a&gt;。&lt;/p&gt;
 +&lt;/blockquote&gt;
 +
 +&lt;h3 id=&quot;脚手架&quot;&gt;脚手架&lt;/h3&gt;
 +&lt;p&gt;在建筑领域,脚手架是施工现场为方便工人操作并解决垂直和水平运输而搭设的各种支架以及平台。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/Scaffold.jpg&quot; alt=&quot;scaffold&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;在软件开发领域,它引申为预提供一些基础框架代码加速开发过程,避免从零开始构建项目。用户只需要依据需求场景选择合适的脚手架,然后填充定制的业务逻辑即可,不必再去处理一些基础功能,例如数据库连接、日志实现、RPC传输等。&lt;/p&gt;
 +
 +&lt;p&gt;微服务框架一般都会提供脚手架功能,例如Spring,提供了Spring initializr:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/SpringInitializr.png&quot; alt=&quot;SpringInitializr&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;它集成了Spring Boot和Spring Cloud丰富的组件,创建出来的项目POM中将自动包含用户选中的依赖。&lt;/p&gt;
 +
 +&lt;p&gt;ServiceComb Java Chassis提供的脚手架具备更明显的优势:&lt;/p&gt;
 +&lt;ol&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;对每一种编程模型都提供了对应的&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/archetypes&quot;&gt;Archetypes项目&lt;/a&gt;,包括SpringMVC、JAXRS、POJO和Spring Boot Starter;&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;生成的项目除了在POM中自动添加必要的依赖,还会提供Producer和Consumer示例代码(Hello World);&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;不久后会进一步提供&lt;strong&gt;Edge Server&lt;/strong&gt;、&lt;strong&gt;Authcation Server&lt;/strong&gt;等更贴近业务的脚手架项目,让用户能快速构建体系完整的微服务系统。&lt;/p&gt;
 +  &lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;p&gt;前面牛刀小试中展示的一键构建微服务,正是基于它们:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/ArchetypeProjects.png&quot; alt=&quot;ArchetypeProjects&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;那么什么叫一个完整的微服务系统呢?我们可以拿一个具体的场景做例子,会更有感觉:&lt;/p&gt;
 +
 +&lt;h3 id=&quot;场景地产crm&quot;&gt;场景:地产CRM&lt;/h3&gt;
 +&lt;p&gt;您经营着一家房地产开发商,销售房产,迫切需要一套销售系统,考虑到微服务的优势,您决定使用微服务的方式构建系统;主要的业务流程也非常简单:用户前来购买购买产品(房产),首先需要登记用户信息,并缴纳一定数量的定金,待交易当日,挑选心仪的产品(房产),支付尾款,完成交易。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;使用ddd指导地产crm系统的设计&quot;&gt;使用DDD指导地产CRM系统的设计&lt;/h4&gt;
 +&lt;p&gt;微服务系统的设计自然离不开DDD(Domain-Driven Design),它由Eric Evans提出,是一种全新的系统设计和建模方法,这里的模型指的就是领域模型(Domain Model)。领域模型通过聚合(Aggregate)组织在一起,聚合间有明显的业务边界,这些边界将领域划分为一个个限界上下文(Bounded Context)。Martin Fowler对它们都有详细的&lt;a href=&quot;https://martinfowler.com/tags/domain%20driven%20design.html&quot;&gt;解读&lt;/a&gt;。&lt;/p&gt;
 +
 +&lt;p&gt;理论概念都搞清楚了,那么怎么来找模型和聚合呢?一个非常流行的方法就是&lt;a href=&quot;https://en.wikipedia.org/wiki/Event_storming&quot;&gt;Event Storming&lt;/a&gt;,它是由Alberto Brandolini发明,经历了DDD社区和很多团队的实践,也是一种非常有参与感的团队活动:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/EventStorming.png&quot; alt=&quot;EventStorming&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;上图就是我们对地产CRM这个场景使用Event Storming探索的结果,现在我们能够将限界上下文清晰的梳理出来:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/BoundedContext.png&quot; alt=&quot;BoundedContext&quot; /&gt;&lt;/p&gt;
 +
 +&lt;blockquote&gt;
 +  &lt;p&gt;提示:Event Storming是一项非常有创造性的活动,也是一个持续讨论和反复改进的过程,不同的团队关注的核心域(Core Domain)不同,得到的最终结果也会有差异。我们的目的是为了演示完整的微服务系统构建的过程,并不涉及商业核心竞争力方面的探讨,因此没有Core Domain和Sub Domain之类的偏重。&lt;/p&gt;
 +&lt;/blockquote&gt;
 +
 +&lt;h4 id=&quot;将分析成果转化为方案域设计&quot;&gt;将分析成果转化为方案域设计&lt;/h4&gt;
 +&lt;p&gt;当我们完成所有的限界上下文的识别后,可以直接将它们落地为微服务:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/MicroserviceDesign1.png&quot; alt=&quot;MicroserviceDesign1&quot; /&gt;&lt;/p&gt;
 +
 +&lt;ol&gt;
 +  &lt;li&gt;用户服务:提供用户信息管理服务,这里保存这用户的账号和密码,负责登录和认证;&lt;/li&gt;
 +  &lt;li&gt;产品(房产)服务:提供产品管理服务,保存着房产的信息诸如价格、是否已售出等信息;&lt;/li&gt;
 +  &lt;li&gt;支付服务:提供交易时支付服务,模拟对接银行支付定金,以及购房时支付尾款;&lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;p&gt;由于完成一笔交易是一个复杂的流程,与这三个微服务都有关联,因此我们引入了一个复合服务——交易服务:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/MicroserviceDesign2.png&quot; alt=&quot;MicroserviceDesign2&quot; /&gt;&lt;/p&gt;
 +
 +&lt;ol&gt;
 +  &lt;li&gt;交易服务:提供产品交易服务,它通过编排调用将整个交易流程串起来,交易服务中有两个流程:
 +    &lt;ul&gt;
 +      &lt;li&gt;定金支付&lt;/li&gt;
 +    &lt;/ul&gt;
 +
 +    &lt;p&gt;Step1:通过用户服务验证用户身份;&lt;/p&gt;
 +
 +    &lt;p&gt;Step2:通过支付服务请求银行扣款,增加定金账号内的定金;&lt;/p&gt;
 +  &lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;ul&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;购房交易&lt;/p&gt;
 +
 +    &lt;p&gt;Step1:通过用户服务验证用户身份;&lt;/p&gt;
 +
 +    &lt;p&gt;Step2:通过资源服务确定用户希望购买的资源(房产)尚未售出;&lt;/p&gt;
 +
 +    &lt;p&gt;Step3:通过资源服务标记目标资源(房产)已售出;&lt;/p&gt;
 +
 +    &lt;p&gt;Step4:通过支付服务请求扣减定金账号内的定金,以及银行扣剩下的尾款;&lt;/p&gt;
 +
 +    &lt;p&gt;最后两个步骤需要保证事务一致性,其中Step4包含两个扣款操作。&lt;/p&gt;
 +  &lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;之后,我们引入Edge服务提供统一入口:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/MicroserviceDesign3.png&quot; alt=&quot;MicroserviceDesign3&quot; /&gt;&lt;/p&gt;
 +
 +&lt;ol&gt;
 +  &lt;li&gt;Edge服务:很多时候也被称为API网关(API Gateway),负责集中认证、动态路由等等;&lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;blockquote&gt;
 +  &lt;p&gt;提示:Edge服务需要依赖服务注册-发现机制,因此同时导入了ServiceCenter。&lt;/p&gt;
 +&lt;/blockquote&gt;
 +
 +&lt;p&gt;最后还需要提供UI:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/scaffold/MicroserviceDesign4.png&quot; alt=&quot;MicroserviceDesign4&quot; /&gt;&lt;/p&gt;
 +
 +&lt;ol&gt;
 +  &lt;li&gt;前端UI(同样以微服务方式提供):用户交互界面;&lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;p&gt;至此,DDD设计地产CRM的工作就结束了,从下一篇文章开始,我们将和您一起轻松愉快的开启代码构建之旅,敬请期待!&lt;/p&gt;</content><author><name>Yangyong Zheng</name><email>yangyong.zheng@huawei.com</email><uri>https://zhengyangyong.github.io</uri></author><category term="Archetypes" /><category term="Scaffold" /><summary type="html">轻松微服务系列:从一键构建微服务和DDD设计开始</summary></entry><entry xml:lang="cn"><title type="html">ServiceComb Saga使用Cucumber做验收测试源码分析</title><link href="/cn/docs/saga_with_cucumber/" rel="alternate" type="text/html" t [...]
 +
 +&lt;h4 id=&quot;cucumber-简介&quot;&gt;Cucumber 简介&lt;/h4&gt;
 +
 +&lt;p&gt;Cucumber 是一个能够理解用普通语言描述的测试用例的自动化测试工具,可以让人们用近似自然的语言去描述特性Feature和场景Scenario,根据Feature驱动开发,用作软件技术人员和非技术之间验收测试的桥梁。它是一个命令行工具,运行后会执行features中的内容,feature中的step会调用step definitions 可以用标签来组织场景支持40多种语言包括 Java, Ruby 等。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/cucumber.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;Cucumber开发过程:&lt;/p&gt;
 +
 +&lt;ul&gt;
 +  &lt;li&gt;创建feature文件,feature文件中描述了测试用例集(Features),测试用例(Scenarios),创建测试所需环境(Given),触发被测试事件(When)和结果验证(Then)&lt;/li&gt;
 +  &lt;li&gt;创建step_definitions,此代码根据上面创建的feature文件,映射feature中的Gherkin Step为按步骤执行的代码,类似胶水的作用。&lt;/li&gt;
 +  &lt;li&gt;执行cucumber执行指令,格式化输出&lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;更多关于Cucumber的介绍请参考&lt;a href=&quot;https://cucumber.io/&quot;&gt;官网文档[2]&lt;/a&gt;。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;saga-使用-cucumber&quot;&gt;Saga 使用 Cucumber&lt;/h4&gt;
 +
 +&lt;p&gt;Saga项目对其下行程预定demo做了验收测试,我们对照Cucumber的开发过程分别分析成功执行完所有事务和出现异常时的自动化测试开发,在行程预定的demo中,全局事务&lt;code class=&quot;highlighter-rouge&quot;&gt;booking&lt;/code&gt;有两个子事务分别是预定酒店服务&lt;code class=&quot;highlighter-rouge&quot;&gt;Hotel&lt;/code&gt;和包车服务&lt;code class=&quot;highlighter-rouge&quot;&gt;Car&lt;/code&gt;,只有酒店服务和包车服务全部成功行程预定服务才算成功,否则全部失败并回滚补偿。demo中假定了房源紧张,每个用户最多只能预定2间,关于此行程规划demo细节请参考&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-saga/tree/master/saga-demo/bookin [...]
 +
 +&lt;ul&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;成功完成所有事务&lt;/p&gt;
 +
 +    &lt;ol&gt;
 +      &lt;li&gt;
 +        &lt;p&gt;创建feature文件&lt;code class=&quot;highlighter-rouge&quot;&gt;pack_success_scenario.feature&lt;/code&gt;,定义Feature,并在feature中定义step&lt;/p&gt;
 +
 +        &lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Feature: Alpha records transaction events
 +
 +  Scenario: Everything is normal
 +    Given Car Service is up and running
 +    And Hotel Service is up and running
 +    And Booking Service is up and running
 +    And Alpha is up and running
 +
 +    When User Sean requests to book 2 cars and 1 rooms
 +
 +    Then Alpha records the following events
 +      | serviceName  | &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;             |
 +      | pack-booking | SagaStartedEvent |
 +      | pack-car     | TxStartedEvent   |
 +      | pack-car     | TxEndedEvent     |
 +      | pack-hotel   | TxStartedEvent   |
 +      | pack-hotel   | TxEndedEvent     |
 +      | pack-booking | SagaEndedEvent   |
 +
 +    And Car Service contains the following booking orders
 +      | name | amount | confirmed | cancelled |
 +      | Sean | 2      | &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;      | &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;     |
 +
 +    And Hotel Service contains the following booking orders
 +      | name | amount | confirmed | cancelled |
 +      | Sean | 1      | &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;      | &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;     |
 +&lt;/code&gt;&lt;/pre&gt;
 +        &lt;/div&gt;
 +
 +        &lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Given&lt;/code&gt; 定义了测试用例&lt;code class=&quot;highlighter-rouge&quot;&gt;Everything is normal&lt;/code&gt;所需的4个条件分别是4个服务运行正常,&lt;code class=&quot;highlighter-rouge&quot;&gt;When&lt;/code&gt;定义了触发用户&lt;code class=&quot;highlighter-rouge&quot;&gt;Sean&lt;/code&gt;发起预定2辆车和1间房子的被测事件。&lt;code class=&quot;highlighter-rouge&quot;&gt;Then&lt;/code&gt;中则指定了验证结果是&lt;code class=&quot;highlighter-rouge&quot;&gt;Alpha&lt;/code&gt;记录的各 [...]
 +      &lt;/li&gt;
 +      &lt;li&gt;
 +        &lt;p&gt;创建step_definitions &lt;code class=&quot;highlighter-rouge&quot;&gt;PackStepdefs.java&lt;/code&gt;&lt;/p&gt;
 +
 +        &lt;p&gt;在step_definition中使用正则的方式对应feature中定义的的测试条件,触发测试并验证结果。如:&lt;/p&gt;
 +
 +        &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;Given&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;^Car Service is up and running$&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{ [...]
 +      &lt;span class=&quot;n&quot;&gt;probe&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getProperty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CAR_SERVICE_ADDRESS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
 +    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +        &lt;/div&gt;
 +
 +        &lt;p&gt;上面代码对应feature中第一个测试前提条件&lt;code class=&quot;highlighter-rouge&quot;&gt;Given car service is up and running&lt;/code&gt;,&lt;code class=&quot;highlighter-rouge&quot;&gt;probe&lt;/code&gt;函数式方位&lt;code class=&quot;highlighter-rouge&quot;&gt;Car&lt;/code&gt;服务的一个Rest接口验证返回状态码来判断&lt;code class=&quot;highlighter-rouge&quot;&gt;Car&lt;/code&gt;是否正常启动运行。接下来四个&lt;code class=&quot;highlighter-rouge&quot;&gt;Given&lt;/code&gt;与此类似。&lt;/p&gt;
 +
 +        &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;When&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;^User ([A-Za-z]+) requests to book ([0-9]+) cars and ([0-9]+) rooms$&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;s [...]
 +      &lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Received request from user {} to book {} cars and {} rooms&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c [...]
 +
 +      &lt;span class=&quot;n&quot;&gt;given&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
 +          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;pathParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;pathParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;rooms&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rooms&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;pathParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;cars&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cars&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;when&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
 +          &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getProperty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;booking.service.address&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span cla [...]
 +    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +        &lt;/div&gt;
 +
 +        &lt;p&gt;此段代码解析feature中定义的&lt;code class=&quot;highlighter-rouge&quot;&gt;When User Sean requests to book 2 cars and 1 rooms&lt;/code&gt;事件,解析出用户、预定车辆和房间数量参数并向&lt;code class=&quot;highlighter-rouge&quot;&gt;Booking&lt;/code&gt;服务发出&lt;code class=&quot;highlighter-rouge&quot;&gt;POST&lt;/code&gt;方法的请求,然后在下面代码的&lt;code class=&quot;highlighter-rouge&quot;&gt;Then&lt;/code&gt;中验证结果:&lt;/p&gt;
 +
 +        &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Then&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;^Alpha records the following events$&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DataTable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dat [...]
 +      &lt;span class=&quot;n&quot;&gt;Consumer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;[]&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;columnStrippingConsumer&lt;/span& [...]
 +        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&l [...]
 +          &lt;span class=&quot;n&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;keySet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;retainAll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dataTable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;topCells&lt;/span&gt;&lt;span class=&quot;o&quot;&gt; [...]
 +      &lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
 +      &lt;span class=&quot;n&quot;&gt;dataMatches&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getProperty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ALPHA_REST_ADDRESS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quo [...]
 +    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
 +
 + &lt;span class=&quot;n&quot;&gt;And&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;^Car Service contains the following booking orders$&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DataTable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataTable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;g [...]
 +      &lt;span class=&quot;n&quot;&gt;dataMatches&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getProperty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CAR_SERVICE_ADDRESS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&qu [...]
 +    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
 +
 +    &lt;span class=&quot;n&quot;&gt;And&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;^Hotel Service contains the following booking orders$&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DataTable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataTable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-& [...]
 +      &lt;span class=&quot;n&quot;&gt;dataMatches&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getProperty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HOTEL_SERVICE_ADDRESS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s& [...]
 +    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +        &lt;/div&gt;
 +
 +        &lt;p&gt;上面代码对应feature中&lt;code class=&quot;highlighter-rouge&quot;&gt;Then&lt;/code&gt;结果从三方面验证预定事件是否符合预期:&lt;code class=&quot;highlighter-rouge&quot;&gt;Alpha&lt;/code&gt;服务中记录的事件顺序、&lt;code class=&quot;highlighter-rouge&quot;&gt;Car&lt;/code&gt;服务的预定结果和 &lt;code class=&quot;highlighter-rouge&quot;&gt;Hotel&lt;/code&gt;服务中的预定结果。&lt;code class=&quot;highlighter-rouge&quot;&gt;DataTable&lt;/code&gt;解析了feature中定义的事件结果和顺序,&lt;code class=&quot;highlighter-rouge&quot;&gt;dataMatches [...]
 +      &lt;/li&gt;
 +      &lt;li&gt;
 +        &lt;p&gt;执行Command &lt;code class=&quot;highlighter-rouge&quot;&gt;RunCucumberIT.java&lt;/code&gt;&lt;/p&gt;
 +
 +        &lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;@Runwith(Cucumber.class)&lt;/code&gt;指定使用Cucumber测试框架入口,并在&lt;code class=&quot;highlighter-rouge&quot;&gt;@CucumberOptions&lt;/code&gt;中指定feature目录和输出格式。&lt;/p&gt;
 +      &lt;/li&gt;
 +    &lt;/ol&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;有子事务出现异常测试&lt;/p&gt;
 +
 +    &lt;p&gt;由于房源紧张,限制每个用户最多预订2间房,当用户预订超过2间时会抛出异常:&lt;/p&gt;
 +
 +    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@Compensable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;compensationMethod&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;cancel&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +  &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HotelBooking&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;booking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;booking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getAmount&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +      &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;IllegalArgumentException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;can not order the rooms large than two&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +    &lt;span class=&quot;n&quot;&gt;booking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;confirm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
 +    &lt;span class=&quot;n&quot;&gt;bookings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;put&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;booking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;booking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +    &lt;/div&gt;
 +
 +    &lt;p&gt;在此异常测试中我们预订事件中预订3间房,由于订房间失败,整个行程事务没有成功,对已经成功执行的订车子事务进行补偿保证原子性。&lt;/p&gt;
 +
 +    &lt;ol&gt;
 +      &lt;li&gt;
 +        &lt;p&gt;创建feature文件&lt;code class=&quot;highlighter-rouge&quot;&gt;pack_compensation_scenario.feature&lt;/code&gt;&lt;/p&gt;
 +
 +        &lt;p&gt;与成功的行程规划测试中不同的只有触发的预定事件和最终的结果,前提条件都是4个服务启动并运行,所以feature只要修改&lt;code class=&quot;highlighter-rouge&quot;&gt;When&lt;/code&gt;和&lt;code class=&quot;highlighter-rouge&quot;&gt;Then&lt;/code&gt;内容即可(Features和Scenarios名也要对应修改)&lt;/p&gt;
 +
 +        &lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;s&quot;&gt;When User Sean requests to book 5 cars and 3 rooms&lt;/span&gt;
 +
 +    &lt;span class=&quot;s&quot;&gt;Then Alpha records the following events&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| serviceName  | type               |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-booking | SagaStartedEvent   |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-car     | TxStartedEvent     |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-car     | TxEndedEvent       |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-hotel   | TxStartedEvent     |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-hotel   | TxAbortedEvent     |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-car     | TxCompensatedEvent |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-car     | SagaEndedEvent     |&lt;/span&gt;
 +
 +    &lt;span class=&quot;s&quot;&gt;Then Car Service contains the following booking orders&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| name | amount | confirmed | cancelled |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| Sean | 5      | false     | true      |&lt;/span&gt;
 +
 +    &lt;span class=&quot;s&quot;&gt;Then Hotel Service contains the following booking orders&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| name | amount | confirmed | cancelled |&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +        &lt;/div&gt;
 +      &lt;/li&gt;
 +      &lt;li&gt;
 +        &lt;p&gt;step_definition和Command与之前一样,不需要任何修改,触发预定超过3个房间的操作后,&lt;code class=&quot;highlighter-rouge&quot;&gt;Alpha&lt;/code&gt;会记录Hotel服务的&lt;code class=&quot;highlighter-rouge&quot;&gt;TxAbortedEvent&lt;/code&gt;和Car服务的&lt;code class=&quot;highlighter-rouge&quot;&gt;TxCompensatedEvent&lt;/code&gt;时间,此外Car服务的预定记录中会有取消为&lt;code class=&quot;highlighter-rouge&quot;&gt;true&lt;/code&gt;的记录。&lt;/p&gt;
 +      &lt;/li&gt;
 +    &lt;/ol&gt;
 +
 +    &lt;p&gt;通过以上两个例子分析,Cucumber开发只需要在feature中定义好测试所需条件,触发事件和结果验证信息,然后在step_definition中进行解析验证即可。&lt;/p&gt;
 +  &lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;h4 id=&quot;byteman-规则注入&quot;&gt;Byteman 规则注入&lt;/h4&gt;
 +
 +&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Byteman&lt;/code&gt;可以在代码的任意位置注入代码,并可以在注入的代码中访问当前方法中变量,包括方法参数、局部变量、调用其他函数的参数值、返回值等。更多关于Byteman的介绍请参考&lt;a href=&quot;http://byteman.jboss.org/docs.html&quot;&gt;官方文档[4]&lt;/a&gt;。&lt;/p&gt;
 +
 +&lt;p&gt;Byteman开发过程:&lt;/p&gt;
 +
 +&lt;ul&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;创建规则脚本.btm文件&lt;/p&gt;
 +
 +    &lt;p&gt;根据byteman语法创建规则,包括规则名,目标类,目标方法,注入位置,注入内容等,下面是一个在&lt;code class=&quot;highlighter-rouge&quot;&gt;main&lt;/code&gt;函数入口注入打印语句的规则文件例子&lt;/p&gt;
 +
 +    &lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;RULE trace main entry&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;CLASS AppMain&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;METHOD main&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;AT ENTRY&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;IF true&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;DO traceln(&quot;entering main&quot;)&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;ENDRULE&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +    &lt;/div&gt;
 +
 +    &lt;p&gt;在安装了byteman环境的机器上用javaagent参数指定加载规则文件运行AppMain即可在main函数入口处打印出&lt;code class=&quot;highlighter-rouge&quot;&gt;entering main&lt;/code&gt;。例子&lt;a href=&quot;https://github.com/adinn/byteman-tutorial1&quot;&gt;源码请参考[5]&lt;/a&gt;&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;加载规则并运行&lt;/p&gt;
 +
 +    &lt;p&gt;除了上面例子中通过命令行指定javaagent指定byteman 规则文件的加载方式外,还可以通过Java代码的方式加载,如下&lt;/p&gt;
 +
 +    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Submit&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Submit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;o&quot;&g [...]
 +&lt;span class=&quot;n&quot;&gt;bm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addRulesFromFiles&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rules&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +    &lt;/div&gt;
 +
 +    &lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;org.jboss.byteman.agent.submit.Submit&lt;/code&gt;提供的加载规则的方法有通过文件加载&lt;code class=&quot;highlighter-rouge&quot;&gt;addRulesFromFiles&lt;/code&gt;和&lt;code class=&quot;highlighter-rouge&quot;&gt;addRulesFromResources&lt;/code&gt;&lt;/p&gt;
 +
 +    &lt;p&gt;同样,byteman提供了移除规则的方法&lt;code class=&quot;highlighter-rouge&quot;&gt;deleteRulesFromFiles&lt;/code&gt;,&lt;code class=&quot;highlighter-rouge&quot;&gt;deleteRulesFromResources&lt;/code&gt;和&lt;code class=&quot;highlighter-rouge&quot;&gt;deleteAllRules&lt;/code&gt;。&lt;/p&gt;
 +  &lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;h4 id=&quot;saga-使用-cucumber-集成-byteman&quot;&gt;Saga 使用 Cucumber 集成 Byteman&lt;/h4&gt;
 +
 +&lt;p&gt;Saga在Cucumber中集成了byteman注入一个超时异常,测试Saga对超时处理是否符合预期。&lt;/p&gt;
 +
 +&lt;ol&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;创建byteman规则文件:&lt;code class=&quot;highlighter-rouge&quot;&gt;booking_timeout.btm&lt;/code&gt;&lt;/p&gt;
 +
 +    &lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;RULE set the saga timeout to 5s&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;INTERFACE org.apache.servicecomb.saga.omega.context.annotations.SagaStart&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;METHOD timeout&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;AT EXIT&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;IF TRUE&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;DO RETURN 5&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;ENDRULE&lt;/span&gt;
 +
 +&lt;span class=&quot;s&quot;&gt;RULE sleep when postBooking until timeout happens&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;CLASS org.apache.servicecomb.saga.demo.pack.booking.BookingController&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;METHOD postBooking&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;AT ENTRY&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;IF TRUE&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;DO debug(&quot;delay 10s until the booking timeout&quot;),&lt;/span&gt;
 +   &lt;span class=&quot;s&quot;&gt;Thread.sleep(10000)&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;ENDRULE&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +    &lt;/div&gt;
 +
 +    &lt;p&gt;这里定义了两个规则,第一个规则&lt;code class=&quot;highlighter-rouge&quot;&gt;set the saga timeout to 5s&lt;/code&gt;在注解&lt;code class=&quot;highlighter-rouge&quot;&gt;@SagaStart&lt;/code&gt;的&lt;code class=&quot;highlighter-rouge&quot;&gt;timeout&lt;/code&gt;方法中返回5表示设置超时时间值为5秒。第二个规则&lt;code class=&quot;highlighter-rouge&quot;&gt;sleep when postBooking until timeout happens&lt;/code&gt;在类&lt;code class=&quot;highlighter-rouge&quot;&gt;BookingController&lt;/code&gt;的&lt;code class=&quot;hi [...]
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;创建feature文件:&lt;code class=&quot;highlighter-rouge&quot;&gt;pack_timeout_scenario.feature&lt;/code&gt;&lt;/p&gt;
 +
 +    &lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt; 	&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Given Install the byteman script booking_timeout.btm to Booking Service&lt;/span&gt;
 +
 +    &lt;span class=&quot;s&quot;&gt;When User Sean requests to book 1 cars and 1 rooms&lt;/span&gt;
 +
 +    &lt;span class=&quot;s&quot;&gt;Then Alpha records the following events&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| serviceName  | type               |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-booking | SagaStartedEvent   |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-car     | TxStartedEvent     |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-car     | TxEndedEvent       |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-hotel   | TxStartedEvent     |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-hotel   | TxEndedEvent       |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-booking | TxAbortedEvent     |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-hotel   | TxCompensatedEvent |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-car     | TxCompensatedEvent |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| pack-booking | SagaEndedEvent     |&lt;/span&gt;
 +
 +    &lt;span class=&quot;s&quot;&gt;Then Car Service contains the following booking orders&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| name | amount | confirmed | cancelled |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| Sean | 1      | false     | true      |&lt;/span&gt;
 +
 +    &lt;span class=&quot;s&quot;&gt;Then Hotel Service contains the following booking orders&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| name | amount | confirmed | cancelled |&lt;/span&gt;
 +      &lt;span class=&quot;s&quot;&gt;| Sean | 1      | false     | true      |&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +    &lt;/div&gt;
 +
 +    &lt;p&gt;在行程预定的例子中仍然以4个服务启动并运行为前提,然后加载上面创建的byteman规则文件和目标服务:&lt;code class=&quot;highlighter-rouge&quot;&gt;Booking&lt;/code&gt;。然后触发预定一辆车和一间房的操作。&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;step_definition解析&lt;/p&gt;
 +
 +    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;Given&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;^Install the byteman script ([A-Za-z0-9_\\.]+) to ([A-Za-z]+) Service$&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt [...]
 +      &lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Install the byteman script {} to {} service&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;service&lt;/span&g [...]
 +      &lt;span class=&quot;n&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rules&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
 +      &lt;span class=&quot;n&quot;&gt;rules&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;target/test-classes/&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +      &lt;span class=&quot;n&quot;&gt;Submit&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;getBytemanSubmit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +      &lt;span class=&quot;n&quot;&gt;bm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addRulesFromFiles&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rules&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 +    &lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +    &lt;/div&gt;
 +
 +    &lt;p&gt;在Cucumber解析文件中用正则方法获取目标规则和服务名,&lt;code class=&quot;highlighter-rouge&quot;&gt;getBytemanSubmit&lt;/code&gt;根据服务名&lt;code class=&quot;highlighter-rouge&quot;&gt;service&lt;/code&gt;参数来获取目标服务的地址和byteman监听端口,并将本地规则注入到目标服务中,注入原理是&lt;code class=&quot;highlighter-rouge&quot;&gt;Booking&lt;/code&gt;启动时是带着byteman参数启动的:&lt;/p&gt;
 +
 +    &lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;-Dorg.jboss.byteman.debug&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; -Dorg.jboss.byteman.verbose&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;tru
 +-javaagent:/maven/saga/byteman.jar&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;port:9091,address:0.0.0.0,listener:true
 +&lt;/code&gt;&lt;/pre&gt;
 +    &lt;/div&gt;
 +
 +    &lt;p&gt;执行&lt;code class=&quot;highlighter-rouge&quot;&gt;bm.addRulesFromFiles(rules);&lt;/code&gt;时就可以把本地规则通过Socket发送到&lt;code class=&quot;highlighter-rouge&quot;&gt;Booking&lt;/code&gt;服务,并由Byteman完成字节替换。&lt;/p&gt;
 +  &lt;/li&gt;
 +  &lt;li&gt;
 +    &lt;p&gt;结果验证&lt;/p&gt;
 +
 +    &lt;p&gt;注入规则后触发预定车辆和房间服务时预定服务会出现超时,Saga会对已经完成的订车和订房间子事务进行补偿,Alpha中记录了一些列事件以及他们发生的顺序,另外Car服务和Hotel服务的取消标记&lt;code class=&quot;highlighter-rouge&quot;&gt;cancelled&lt;/code&gt;也为&lt;code class=&quot;highlighter-rouge&quot;&gt;true&lt;/code&gt;。&lt;/p&gt;
 +  &lt;/li&gt;
 +&lt;/ol&gt;
 +
 +&lt;p&gt;代码中使用Cucumber和Byteman要先通过pom引入相关依赖&lt;/p&gt;
 +
 +&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	&lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.cucumber&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;cucumber-java8&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;${cucumber.version}&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span class=&quot;nt&quot;&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
 +    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
 +    &lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.cucumber&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;cucumber-junit&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;${cucumber.version}&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span class=&quot;nt&quot;&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
 +    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
 +    &lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.jboss.byteman&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;byteman-submit&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
 +      &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;${byteman.version}&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
 +    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;本地运行调试需要在启动的时候使用javaagent启动byteman,建议通过修改docker-compose.yaml文件,指定可执行jar的启动参数,并修改stepdef解析文件中各个服务地址,个服务启动运行后在IDEA中运行相应的feature文件即可进行调试测试。运行调试版代码可参考&lt;a href=&quot;https://github.com/lijasonvip/incubator-servicecomb-saga/tree/debug-cucumber-byteman&quot;&gt;个人分支代码[6]&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;欢迎开发者朋友们加入ServiceComb社区,一起做些有意思的事情。&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/docs/join_the_community/&quot;&gt;加入社区方法[7]&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;h4 id=&quot;参考资料&quot;&gt;参考资料&lt;/h4&gt;
 +
 +&lt;p&gt;[1] ServiceComb Saga  https://github.com/apache/incubator-servicecomb-saga&lt;/p&gt;
 +
 +&lt;p&gt;[2] Cucumber  https://cucumber.io/&lt;/p&gt;
 +
 +&lt;p&gt;[3] Saga booking demo  https://github.com/apache/incubator-servicecomb-saga/tree/master/saga-demo/booking&lt;/p&gt;
 +
 +&lt;p&gt;[4] Byteman  http://byteman.jboss.org/docs.html&lt;/p&gt;
 +
 +&lt;p&gt;[5] Byteman demo https://github.com/adinn/byteman-tutorial1&lt;/p&gt;
 +
 +&lt;p&gt;[6] debug 分支 https://github.com/lijasonvip/incubator-servicecomb-saga/tree/debug-cucumber-byteman&lt;/p&gt;
 +
 +&lt;p&gt;[7] 加入ServiceComb 社区  http://servicecomb.incubator.apache.org/cn/docs/join_the_community/&lt;/p&gt;</content><author><name>Li Bo</name><email>libo75@huawei.com</email></author><category term="Saga" /><category term="Cucumber" /><summary type="html">ServiceComb Saga使用Cucumber做验收测试源码分析</summary></entry><entry xml:lang="cn"><title type="html">Saga分布式事务解决方案与实践</title><link href="/cn/docs/distributed-transactions-saga-implementation/" rel="alternate" type="text/html" title="Saga分布式事 [...]
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.001.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.002.jpeg&quot; alt=&quot;&quot; /&gt;
 +我先介绍一下我自己,我叫姜宁,来自于华为开源研究中心,现在负责的是ServiceComb这个开源项目。ServiceComb这个项目已经进到Apache孵化,应该是去年11月份时进到Apache孵化的,这个月我们帮刚发了1.0M1版,但对于SAGA来说我们属于探索的阶段,发布了0.1.0。&lt;/p&gt;
 +
 +&lt;p&gt;我参与过Apache一些项目,我也是Apache的 Member,是Apache CXF, Apache Camel 还有的PMC。还有一件事情,前一段时间帮阿里同学孵化 RocketMQ,我是以导师的身份参与的,属于见习的Mentor.这回带着ServiceComb这个项目,我感觉我把很多角色都玩了一遍。后面如果大家对开源项目进入Apache孵化感兴趣的话也可以来找到。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.003.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;今天的议题围绕几个方面来展开,一个是微服务事务一致性的问题,然后讲一讲业界的SAGA解决方案,我们在ServiceComb里也提供了SAGA的实现。另外一件事情,我项目这边也在招新,欢迎广大感兴趣的同学一会儿加我微信。我们现在项目其实架子也都搭得不错了,就是等着大家跳到碗里面,一起来解决微服务事务一致性问题。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.004.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;微服务架构强调的服务能够独立开发,独立演进,独立部署, 独立团队。&lt;/p&gt;
 +
 +&lt;p&gt;那微服务相关的数据是采用什么方式进行存储的呢?&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.005.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;传统的单体应用一般采用的是数据库提供的事务一致性,通过数据库提供的提交以及回滚机制来保证相关操作的ACID,这些操作要么同时成功,要么同时失败。各个服务看到数据库中的数据是一致的,同时数据库的操作也是相互隔离的,最后数据也是在数据库中持久存储的。这样的架构不具备横向扩展能力,服务之间的耦合程度也比较高,会存在单点故障。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.006.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;在微服务架构中, 有一个database per service的模式, 这个模式就是每一个服务一个数据库。 这样可以保证微服务独立开发,独立演进,独立部署, 独立团队。&lt;/p&gt;
 +
 +&lt;p&gt;由于一个应用是由一组相互协作的微服务所组成,在分布式环境下由于各个服务访问的数据是相互分离的, 服务之间不能靠数据库来保证事务一致性。   这就需要在应用层面提供一个协调机制,来保证一组事务执行要么成功,要么失败。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.007.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;两阶段提交其实比较简单,这边有两个资源提供准备和提交两个接口。&lt;/p&gt;
 +
 +&lt;p&gt;由于隔离性互斥的要求,在事务执行过程中,所有的资源都是被锁定的,这种情况只适合执行时间确定的短事务。  但是为了保证分布式事务的一致性,大都是采用串行化的隔离级别来保证事务一致性,这样会降低系统的吞吐。&lt;/p&gt;
 +
 +&lt;p&gt;但因为2PC的协议成本比较高,又有全局锁的问题,性能会比较差。 因此现在大家基本上不会采用这种强一致解决方案。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.008.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;这里先简单介绍一下酸碱平衡中的酸 ACID。 原子性 事务作为整体来执行,要么全部执行,要么都不执行。一致性 事务应确保数据从一个一致的状态转变为另一个一致的状态。隔离性 多个事务并发执行时,一个事务的执行不应影响其他事务的执行。持久性 已提交的事务修改数据会被持久保持&lt;/p&gt;
 +
 +&lt;p&gt;酸碱平衡中的碱 BASE。 基本可用 可以保证分布式事务参与方不一定同时在线。柔性状态 允许系统状态更新有一定的延时,这个延时对客户来说不一定能察觉。最终一致性 通常是通过消息可达的方式保证系统的最终一致性。&lt;/p&gt;
 +
 +&lt;p&gt;这是分布式事务的一些基础理论数据库以及分布式的两阶段提交都提供了ACID的保证。 由于隔离性互斥的要求,在事务执行过程中,所有的资源都是被锁定的,这种情况只适合执行时间确定的短事务。后续大家开始通过业务逻辑将互斥锁操作从资源层面上移到业务层面,这并不是完全放弃了ACID,而是通过放宽一致性要求,借助本地事务来实现最终分布式事务一致性的同时也保证系统的吞吐。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.009.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;TCC名字的由来是其中包含了 try, confirm, cancel三个操作。&lt;/p&gt;
 +
 +&lt;p&gt;与两阶段提交相比,TCC位于业务服务层, 没有单独的准备阶段,Try操作可以灵活选择业务资源锁的粒度。TCC是通过最终一致性来解决系统性能问题的这个设计,对我们设计抉择有很大的启发。 有些时候&lt;strong&gt;系统的技术问题是可以通过业务建模的方式来解决的&lt;/strong&gt;。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.010.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;​回顾之前的酸碱平衡的示例,我们得到的启发我们可以通过业务模型的改进提升系统性能。有关领域建模,这里给大家推荐两本书,一个是《领域驱动设计》,还有一个是《实现领域驱动设计》。&lt;/p&gt;
 +
 +&lt;p&gt;微服务设计目标高内聚低耦合,领域驱动设计能帮助构建一致的业务模型和系统实现模型,通过领域驱动设计可以明确微服务的界限上下文。通过在业务层面上把它们之间的强耦合关系拆开之后,带来最大的好处是,它们自身可以借助传统的数据库所提供的功能来实现一致性。只不过是在微服务与微服务之间,它们需要通过前面提到的这种柔性事务方式来做这件事情。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.011.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;微服务架构是一个在限定界限上下文内的松耦合的服务架构。微服务事务一致性的建议是什么呢?就是内刚外柔。在限定上下文内容借助数据库提供事务一致性来做强一致。在限定上下文之间依靠最终一致性方案来解决服务间协同问题。&lt;/p&gt;
 +
 +&lt;p&gt;对于柔性事务来常见的实现方式有TCC,和Saga,今天我们主要向大家介绍Saga的实现。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.012.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;Saga其实是30年前的一篇数据库论文里提到的一个概念。在论文中一个Saga事务是由多个本地事务所组成, 每个本地事务有相应的执行模块和补偿模块,当saga事务中的任意一个本地事务出错了, 可以通过调用相关的补充方法恢复之前的事务,达到事务的最终一致性。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.013.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;Saga概念虽然提出来快30年了, 随着微服务的复杂,引出了分布式Saga问题近些年也逐步受到大家的关注。&lt;/p&gt;
 +
 +&lt;p&gt;我们在实现Saga模型的时候,主要是参考了Caitie McCaffrey 在分布式Saga论文,以及Chris Richardson的研究。 大家可以通过下面的链接获取相关的信息。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.016.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;在分布式系统中由于网络请求可能的延时,在Caitie的论文中对被Saga调用的服务提出两点要求,我们需要Saga调用的服务支持幂等。 在服务请求的过程中,可能会出现超时重试的情况,我们需要通过幂等来避免多次请求所带来的问题。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.017.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;前面提到了超时重试的机制,现在我们再来看看重试取消的情况。补偿可交换原则是指Saga并行处理的过程中,如果发生了超时重试事件之后,并进行了补偿的操作,那么补偿操作是直接生效的。&lt;/p&gt;
 +
 +&lt;p&gt;为了满足这个要求,需要我们在设计系统的过程中保留所有的事务数据。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.018.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;由此我们可以知道Saga模型只支持ACD,不提供隔离性的保证。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.019.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;因为saga事务没有准备阶段,事务没有隔离,如果两个saga事务同时操作同一资源就会遇到我们操作多线程临界资源的的情况。因此会产生更新丢失,脏数据读取等问题。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.020.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;为了解决隔离性带来的问题,我们可以参考一下TCC的解决方案,从业务层面入手加入一Session以及锁的机制来保证能够串行化操作资源。也可以在业务层面通过预先冻结资金的方式隔离这部分资源, 最后在业务操作的过程中可以通过及时读取当前状态的方式获取到最新的更新。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.021.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;目前业界提供了两类Saga的实现方式。 一个是集中式协调器的实现方式,一个分布式的实现方式。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.022.1.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;集中式的Saga实现一般是通过一个Saga对象来追踪所有的Saga子任务的调用情况, 根据调用情况来决定是否需要调用对应的补偿方面,协调器和调用方是在一个进程中的。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.022.2.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;这里附上的是Camel最近实现的Saga EIP, 通过这个DSL可以很方便地实现执行操作和取消操作。
 +集中式的Saga实现方式比较直观并且容易控制,问题是业务耦合程度会比较高。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.023.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;布式的Saga 一般是采用事件驱动方式让参与的服务方进行相关的交互。相关的业务方只需要订阅相关的领域事件即可。 Chirs提供了基于事件溯源的实现,同时axonframework也提供了相关的实现,详细的内容大家可以参考上面的链接。&lt;/p&gt;
 +
 +&lt;p&gt;分布式saga实现的好处: 采用事件源的方式降低系统复杂程度,提升系统扩展性, 处理模块通过订阅事件的方式降低系统的耦合程度。当然这也的实现也有一些问题: saga系统会涉及大量的业务事件,这样会对编码和调试会带来一些问题;还有就是相关的业务逻辑处理是基于事件,相关事件处理模块可能会有循环依赖的问题。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.024.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;前面理论铺垫已经做完了,现在讲一讲我们的实现。 ServiceComb是去年5月份华为开源的微服务框架,它是华为云微服务框架引擎很重要的一个组成部分。大家可以通过下面链接来访问ServiceComb官网以及相关的代码库。&lt;/p&gt;
 +
 +&lt;p&gt;目前ServiceComb主要有三个项目组成:第一个是ServiceCenter做服务发现的,这是go语言在etcd
 +基础实现的服务注册中心,另外是java的一个微服务框架,这块是基于vertx的基础上实现了全异步操作接口,框架有比较好的性能。 Saga项目其实就是我们针对前面刚刚提到Saga模式的提供的一个实现。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.025.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;集中式的Saga协调器构建过程参考了Caitie的论文,实现了一个集中式Saga调用协调器。 后续我们在开发的过程中,发现如果不提供DSL的话,让用户定义Saga事件很困难。后来我们受到Zipkin的启发,我们实现了一个分布式的Saga协调器。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.026.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;集中式的协调器,包含了Saga调用请求接收,分析,以及执行和结果查询这部分的内容。任务代理模块需要预先知道Saga事务调用关系图。执行模块根据生成的调用图产生调用任务,调用相关微服务服务接口。如果服务调用执行出错,会调用服务的相关的补偿方法回滚。&lt;/p&gt;
 +
 +&lt;p&gt;下面是我们实现的两个不同的调度模型。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.027.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;这里Saga执行模块通过分析请求的Json数据,构建一个调用关系图,这里我们是通过JSon来描述Saga事务串行调用子事务或者并行调用子事务。关系调用图被Saga实现中的任务运行模块分解成为一个一个执行任务,执行任务由任务消费者获取并生成相关的调用 (这里同时支持串行和并行调用)。&lt;/p&gt;
 +
 +&lt;p&gt;Saga任务会根据执行的情况向Saga log中记录对应的Saga事务的关键事件,同时我们的事件查看器查看到Saga事务相关的执行情况。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.028.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;后续我们采用了Actor模型对任务的调度模块进行了重构,在不进行调优的情况下,系统性能提升一倍。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.029.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;集中式Saga的实现的好处是易于监控和协调, 但是坏处就是需要依赖工具对Saga调用进行相关的描述。那我们有没有一个好的方式自动获取Saga事务的定义呢? 为了解决这一问题,我们对内部的Saga实现进行新的改进。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.030.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;正如前面提到的,Zipkin通过在服务调用双方传递上下文的方式可以构建出完整的调用链, 这个调用链和我们需要的Saga子事务调用信息很类似。 因此我们借助Zipkin实现了一套Saga调用关系追踪的模块。&lt;/p&gt;
 +
 +&lt;p&gt;为了实现这个事务追踪模型,就需要我们在应用端部署相关的监控模块,同时监控模块需要和后台进行协同交互,于是我们设计了Pack狼群架构。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.031.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;狼群架构有两个参与者, 一个是Alpha, 一个是Omega。Alpha是狼群首领,负责协调事务执行情况,Omega是狼群成员,负责收集事务,向狼群首领上报情况,并执行相关指令。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.032.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;Omega会以切面编程的方式向应用程序注入相关的处理模块。这里有拦截请求的模块, 用来帮助我们构建分布式事务调用的上下文。 同时在事务处理初始阶段处理事务的相关准备的操作,例如创建Saga 起始事件,以及相关的子起始事件, 根据事务的执行的成功或者失败生产相关的事务终止或者失败事件。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.033.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;Omega会与Alpha进行链接会把这些事件通知给Alpha。 Alpha可以在后台进行分析,根据Saga事务执行的情况给Omega下达相关的指令进行相关的回滚恢复。&lt;/p&gt;
 +
 +&lt;p&gt;这样设计的好处是Saga实现代码与用户的代码分离, 用户只需要添加几个annotation,Saga实现就能Saga事件的执行情况并进行相关的处理。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.034.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;这是Omega和Alpha之间的正常业务逻辑的交互图,这里Omega通过分析调用上下文决定是否发生Saga事务的起始事件到Alpha,后续ServiceA在调用ServiceB,会将相关的调用上下文传递给ServiceB。ServiceB的Omega模块会截取这个调用上下文生成相关子事务事件信息。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.035.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;如果服务调用的过程中抛出异常,Omega会将终止事件发送到Alpha端, Alpha的后台进程会定时做扫描,扫描过程中会发现有需要恢复的事件。Alpha会向Omega发消息调用相关的恢复操作,来保证整个Saga事务的原子性。目前Omega也开始提供重试功能,也就是事务调用如果失败了, Omega会根据设置进行重试尝试。
 +&lt;img src=&quot;/assets/images/saga/Saga.036.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;未来的开发计划,第一个就是Alpha这边会提供多租服务架构,这样可以在云上提供Saga协调服务;为了保证系统的可达性,我们可能会用消息队列的方式来做传递事件信息。还有就是刚刚给大家提到的TCC协调器也是我们下一步的工作重点。如果能在Omega端来保证幂等操作的话,可以极大减轻大家的业务编程负担。另外根据Saga的执行这个情况,也要做一些可视化的事情,这块其实也是前端,大家如果有做前端技能的话,可以跟我联系一下。&lt;/p&gt;
 +
 +&lt;p&gt;还有Omega需要解决多线程共享调用的问题。&lt;/p&gt;
 +
 +&lt;p&gt;我们问题都列在下面的JIRA上面,大家可以通过这个&lt;a href=&quot;https://issues.apache.org/jira/browse/SCB-333?jql=project%20%3D%20SCB%20AND%20status%20%3D%20Open%20AND%20fixVersion%20in%20(EMPTY%2C%20java-chassis-1.0.0-m2)%20AND%20labels%20%3D%20newbie&quot;&gt;链接&lt;/a&gt;入门任务。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.037.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;简单小节一下,我们对事务一致性做了简单的回顾,业界的SAGA解决方案也提了一下,简单介绍一下ServiceComb的Saga实现,以及我们后续的开发计划。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.038.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
 +
 +&lt;p&gt;这个最关键了,大家扫码,上面是ServiceComb小助手,可以帮你拉到微信群里,如果大家有兴趣想加入到我们SAGA项目开发可以与ServiceComb小助手联系。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;img src=&quot;/assets/images/saga/Saga.039.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;</content><author><name>Willem Jiang</name></author><category term="Saga" /><category term="QCon" /><summary type="html">2018年QConBeijing Saga分布式事务解决方案与实践演讲实录</summary></entry><entry xml:lang="cn"><title type="html">如何设计一个优质的微服务框架:Apache ServiceComb 的开放性设计</title><link href="/cn/docs/open-design/" rel="alternate" type="text/html" title="如何设计一个优质的微服务框架:Apache ServiceComb 的开放性设计" /><publishe [...]
 +本文讲述了整个 开源微服务框架 Apache ServiceComb 设计形成的前因后果,尝试从理念、思想和实践结合的维度剖析一个优质的微服务框架应该具备哪些要素,包括但不限于 对开发者友好、高性能、内外部扩展性等。  &lt;br /&gt;
 +阅读本文有利于加深对微服务理念和框架的理解,给予微服务用户或开发者以帮助,这也是 Apache ServiceComb 的前身华为云微服务引擎的智慧结晶,从细节处承载了华为云自身多年云化转型的经验。&lt;/p&gt;
 +
 +&lt;!-- more --&gt;
 +
 +&lt;h2 id=&quot;写在前面&quot;&gt;写在前面&lt;/h2&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 的前身为华为云的 &lt;a href=&quot;https://support.huaweicloud.com/usermanual-servicestage/zh-cn_topic_0053812706.html&quot;&gt;微服务引擎 CSE (Cloud Service Engine) 云服务&lt;/a&gt;,  ServiceComb 的早期版本和多数第一批做微服务或分布式框架先贤一样,为了追求高性能,做过非常多如 改善编码效率 和改进通信协议等尝试。然而,随着业务规模的递增,需求也逐渐呈现多样化,单方面通过传统手段追求高性能导致在面对多样化需求时遇到了各种挑战,遗留系统的通信、接入各种不同的终端、协议健壮性、防攻击等各种挑战迎面而来。&lt;/p&gt;
 +
 +&lt;p&gt;Apache ServiceComb,愿景是帮助企业快速构建云原生应用,通过一系列解决方案帮助用户快速开发微服务应用的同时实现对这些微服务应用的高效运维管理,保持中立性以避免厂商LockIn成为了关键任务。对于此, Apache ServiceComb 需要有友好的机制能够对接各微服务主流技术栈技术 或 开发框架。&lt;/p&gt;
 +
 +&lt;p&gt;在系列挑战的驱动下, Aapche ServiceComb 设计团队逐步形成了 “全面开放,使用标准协议,架构易于拆分和扩展,对开发人员友好,可以与业界其他主流框架互通集成” 的共识, 本文将着重分享这些共识是如何体现在Apache ServiceComb 的设计中的。&lt;/p&gt;
 +
 +&lt;h2 id=&quot;开放和标准&quot;&gt;开放和标准&lt;/h2&gt;
 +
 +&lt;p&gt;开放和标准应用到设计的不同的层面。一方面是连接组织和开发人员,一方面是连接异构系统。组织和开发人员的复杂性来源于技能的多样性,大家使用不同的开发语言,同一种开发语言存在多样的开发习惯;系统的多样性来源于系统之间的通信协议,为了实现与异构系统的通信,必须具备良好的适配不同通信协议的能力。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;连接组织和开发人员&quot;&gt;连接组织和开发人员&lt;/h3&gt;
 +
 +&lt;h4 id=&quot;编程风格&quot;&gt;编程风格&lt;/h4&gt;
 +
 +&lt;p&gt;每位技术人员都或多或少拥有自己的 Coding 习惯或爱好的技术, 使用个人熟练的方式从事技术工作往往更加高效和舒适。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 的早期版本实现了 gRPC 协议,然而在项目演进过程中我们发现大量技术人员并不熟悉书写 IDL , 对 IDL 具体支持哪些特性也不清楚。 大多数情况下,用户每碰到一个场景就需要翻开协议规范看一遍, 而 IDL 缺少配套的编辑或语法检查等工具也导致了开发效率的降低。&lt;/p&gt;
 +
 +&lt;p&gt;于是 Apache ServiceComb 设计团队开始思考是否有方法能够在确保保持用户开发习惯的前提下支持 gRPC 。&lt;/p&gt;
 +
 +&lt;p&gt;设计团队结合自己的 Java 编程史,分析当下主流框架,并听取社区用户的反馈找到了一些共性:&lt;/p&gt;
 +
 +&lt;ul&gt;
 +  &lt;li&gt;使用 RPC 方式描述对外接口。gRPC 、Corba 、WebService 等技术人员谙于此道。&lt;/li&gt;
 +  &lt;li&gt;使用 JAX-RS 或 Spring MVC 风格开发 REST 接口。REST 风格开发随着微服务架构兴起,JAX-RS 和 Spring MVC 已然成为 Java REST 的开发事实标准, Spring 的拥抱者都比较熟悉。&lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;Apache ServiceComb 很快在社区设计层面达成了一致,通过缺省支持以上共性来拥抱90%的开发者, 让大多数的 Java 开发者们能够快速开始工作。&lt;/p&gt;
 +
 +&lt;p&gt;除以上共识外,Apache ServiceComb 还额外做了进一步的优化,以保证不同编程风格的兼容性,使用户或开发者倍感灵活及舒适。&lt;/p&gt;
 +
 +&lt;p&gt;在下面的例子中,展示了 Provider和Consumer 代码的各种实现,在同一个微服务中,这些编程方式可以同时出现;同一段 Consumer 代码中可以访问各种不同的编程风格的 Provider 实现。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;RPC 方式的 Provider&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@RpcSchema&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schemaId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HelloImpl&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sayHi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sayHello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Helloperson&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;&lt;strong&gt;JAX-RS 方式的 Provider&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;em&gt;代码片段来自于 &lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/samples/jaxrs-sample&quot;&gt;Apache ServiceComb JAX-RS sample&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@RestSchema&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schemaId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;jaxrsHello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;nd&quot;&gt;@Path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/jaxrshello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;nd&quot;&gt;@Produces&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MediaType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;APPLICATION_JSON&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;JaxrsHelloImpl&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/sayhi&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@POST&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sayHi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/sayhello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@POST&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sayHello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Helloperson&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Spring MVC 方式的 Provider&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;em&gt;代码片段来自于 &lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/samples/springmvc-sample&quot;&gt;Apache ServiceComb Spring MVC sample&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@RestSchema&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schemaId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;springmvcHello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 +&lt;span class=&quot;nd&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/springmvchello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;produces&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MediaType&lt;/span&gt;&lt;span class=&qu [...]
 +&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SpringmvcHelloImpl&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/sayhi&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RequestMethod&lt;/span&gt;&lt;span class=&quot;o& [...]
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sayHi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@RequestParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;o&quo [...]
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +
 +  &lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
 +  &lt;span class=&quot;nd&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/sayhello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RequestMethod&lt;/span&gt;&lt;span class=&quot [...]
 +  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sayHello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@RequestBody&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;){&lt;/span&gt;
 +    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Helloperson&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
 +  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;&lt;strong&gt;RPC 方式访问上述三种服务的 Consumer&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@RpcReference&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;microserviceName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schemaId&lt;/span&gt;&lt;sp [...]
 +&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Hello&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 +&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sayHi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;spa [...]
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;&lt;em&gt;以上代码片段全部出自 &lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/samples/&quot;&gt;Apache ServiceComb Samples&lt;/a&gt;,有兴趣者可阅读了解或贡献更多的智慧。&lt;/em&gt;&lt;/p&gt;
 +
 +&lt;p&gt;直至此处,或许开发者会产生疑问,既然 Consumer 可以通过一致的 API 方式访问不同的Provider,为何还需要额外的 JAX-RS 和 Spring MVC 标签?&lt;/p&gt;
 +
 +&lt;p&gt;原因是,这里的设计依据是 &lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;Apache ServiceComb&lt;/a&gt;的 Consumer考虑的不仅限于 类SDK 的 Consumer,还有浏览器等非 SDK 类的 Consumer,浏览器的 Conumer 识别的是 Http 形式的消息。 通过定义和使用这些标签, 我们可以更加精细的指定浏览器如何访问后台接口。 类似于 Web Service 的 WSDL 描述语言, Apache ServiceComb 称之为&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/service-contract/&quot;&gt;服务契约&lt;/a&gt;。&lt;/p&gt;
 +
 +&lt;p&gt;服务的契约会在服务运行时通过代码定义自动生成,并注册到&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-service-center&quot;&gt;服务中心&lt;/a&gt;。契约也可在运行时用于独立的服务治理逻辑开发,生成 Consumer 代码。此外,也可作为 API 文档对外发布,供非 SDK 的 Consumer 参考。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;服务契约&quot;&gt;&lt;strong&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/service-contract/&quot;&gt;服务契约&lt;/a&gt;&lt;/strong&gt;&lt;/h4&gt;
 +
 +&lt;p&gt;微服务强调服务自治,对外体现的功能全部以松耦合的接口方式提供,并且只能以通信的方式实现相互访问。此原则给团队协作带来了根本性的变革。&lt;/p&gt;
 +
 +&lt;p&gt;微服务的一个开发团队通常由5~6个人的全功能团队组成,端到端的完成 场景需求分析、架构功能设计、开发和运维,团队组织结构和业务系统的架构相匹配。团队建立后的核心问题就是团队之间如何进行高效的协作沟通,以决定不同微服务之间的协作通信。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;Apache ServiceComb&lt;/a&gt; 通过确保让开发人员保持自己的固有编程习惯及设计上的松耦合灵活性,让微服务团队之间可以进行高效协作,以避免在不同的微服务团队讨论编程风格受限于历史旧账而浪费宝贵的精力和时间。&lt;/p&gt;
 +
 +&lt;p&gt;在 RPC 的世界里,有 Corda IDL,WSDL,ProtoBuffer 等可以参考的优秀实践, REST 风格的接口让团队之间可以通过 HTTP 语义进行沟通,但却不能像 IDL 一样描述跨语言的数据格式。Open API 的出现很好地解决了这个问题。&lt;/p&gt;
 +
 +&lt;p&gt;Open API 首先是一个不断发展壮大中的开放的标准。Open API 能兼顾 RPC 、REST 等不同的开发方式,并且吸收了大量的跨语言经验,能够在不同的语言之间进行解析。&lt;/p&gt;
 +
 +&lt;p&gt;对于 Java 开发者,下面的代码片段是日常所打交道的:&lt;/p&gt;
 +
 +&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;type:object&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;properties&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;type:integer&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;如果开发人员有丰富的跨语言开发经验,可以看出 Swagger 在解决跨语言编程方面API定义冲突的努力, 如 Swagger 通过 format 来定义数据类型的存储格式,以解决不同的语言在数据类型表示上的差异:&lt;/p&gt;
 +
 +&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;type:object&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;properties&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +&lt;span class=&quot;s&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;type:integer&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;format:int32&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache SerivceComb&lt;/a&gt; 既遵循常规开发规范也特别关注开发效率。开发者可以先写接口定义后写代码, 也可直接通过自己熟悉的方式编写写代码, 两种方式都会生成 &lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/service-contract/&quot;&gt;服务契约&lt;/a&gt;(Open API 描述文件),并且将内容注册到&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-service-center&quot;&gt;服务中心&lt;/a&gt;。使用者可以从服务中心下载相关的服务契约进行开发。 Apache ServiceComb 的各种治理结构也是基于契约的,可以让开发者独立于业务实现对系统 [...]
 +
 +&lt;h3 id=&quot;连接异构系统&quot;&gt;连接异构系统&lt;/h3&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 早期版本提供了gRPC、REST、SOAP等多种协议,当前主要&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/communicate-protocol/&quot;&gt;支持 REST 和Highway 高性能私有 RPC 两种协议&lt;/a&gt;。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;highway-高性能私有-rpc-协议&quot;&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/communicate-protocol/#highway-rpc%E5%8D%8F%E8%AE%AE&quot;&gt;Highway 高性能私有 RPC 协议&lt;/a&gt;&lt;/h4&gt;
 +
 +&lt;p&gt;gRPC 相对于 REST 的最显著优点就是性能,它采用长连接、高效的二进制序列化方式,提供多种语言支持, 提供了 IDL 语言约束开发者按照标准的方式工作, 一切看起来是那么的完美。&lt;/p&gt;
 +
 +&lt;p&gt;实际上,&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;Apache ServiceComb &lt;/a&gt;的第一轮重构,首选也是 gRPC 。历史第一次在&lt;a href=&quot;https://support.huaweicloud.com/usermanual-servicestage/zh-cn_topic_0053812706.html&quot;&gt;华为云 微服务引擎 CSE&lt;/a&gt; 上线以后,面对了来自网关压力挑战。&lt;/p&gt;
 +
 +&lt;p&gt;网关作为业务接入端,必须高效的管理连接和保证公平,长连接容易导致拒绝服务。gRPC 程序开发完成后,开发人员无法利用系统提供的各种工具进行测试,网络包分析也变得困难,给生产环境上的开发联调造成了困难。随着业务规模的增长,gRPC 面临了诸如“其他三方系统如何与之直接通信? 如何跨网关与它间接通信?”等更严峻的挑战。&lt;/p&gt;
 +
 +&lt;p&gt;解决这些问题,将需要我们扩展和改善老的协议和程序,提供 gRPC 客户端支持,开发者需自行提供一个额外的表示层用于业务接口的逻辑转换,造成大量的重复代码。同时由于 gRPC 依赖于接口定义,并根据定义生成代码,一套代码只能跑在 gRPC 协议上,如果用户希望业务应用可以使用如 REST等其他更加灵活的方式, 就需自行重新实现一套新的代码逻辑。据以上的血泪史, gRPC 最终被 Apache ServiceComb 设计团队定义为只能在中小型系统内部之间使用,并通过协议网关与外部系统进行通信。并实现了 &lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/communicate-protocol/#highway-rpc%E5%8D%8F%E8%AE%AE&quot;&gt;高性能私有协议 Highway&lt;/a&gt; 作为RPC首选默认协议。&lt;/p&gt;
 +
 +&lt;h4 id=&quot;rest-通信协议&quot;&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/communicate-protocol/&quot;&gt;REST 通信协议&lt;/a&gt;&lt;/h4&gt;
 +
 +&lt;p&gt;REST 相较 gRPC ,最大的痛点是性能。&lt;/p&gt;
 +
 +&lt;p&gt;多数技术人员脑海里一个不成文的根深蒂固的观点:”二进制编码效率远高于文本协议,采用二进制编码的系统的性能远高于采用文本的 HTTP ”。该观点甚至会让多数决策止步于理论,多数人甚至不愿尝试去优化 REST。&lt;/p&gt;
 +
 +&lt;p&gt;可喜的是 &lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 迈出了重构 REST 底层通信实现的第一步,基于 Netty 的异步框架来替换 Tomcat 实现,实践的效果大大超出预期,部分基准测试数据结果显示比 gRPC 还好, gRPC最终输在了HTTP2 协议上的额外报文。&lt;/p&gt;
 +
 +&lt;p&gt;优化后的 REST 和业界开源的其他基于二进制的 RPC 实现的性能基本持平。在一个简单的提供数据库查询的代码逻辑中,优化后的REST通信框架处理时间,占比总处理时间远小于千分之一,这意味着再继续在框架层面进行大量优化也抵不上业务应用层面最简单的一个操作带来的消耗,Apache ServiceComb对 REST 的优化已经满足要求,最终也选择了 &lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/communicate-protocol/&quot;&gt;REST&lt;/a&gt; 作为首选和缺省协议(HTTP + json)。&lt;/p&gt;
 +
 +&lt;p&gt;我们并没有就此止步。&lt;/p&gt;
 +
 +&lt;p&gt;需要迁移到 &lt;a href=&quot;https://support.huaweicloud.com/usermanual-servicestage/zh-cn_topic_0053812706.html&quot;&gt;华为云 微服务引擎 CSE&lt;/a&gt;  的业务日益增长,部分历史遗留系统也需进行对接。通信协议对应不同的开发者接口,每每增加通信协议,则需要对业务代码进行大量的重复构建,造成大量无谓消耗。这是当时的华为云化转型以及当下很多云化转型企业或者云原生企业必将面临的痛点。&lt;/p&gt;
 +
 +&lt;p&gt;于是乎,通信协议层被剥离了出来,和业务代码隔离,系统运行基于契约,&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 实现通信协议扩展机制。通信协议扩展机制,帮助用户解决与 gRPC 框架、自定义二进制框架等许多遗留系统的对接通信问题。&lt;/p&gt;
 +
 +&lt;p&gt;在 Apache ServiceComb 框架中,&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/communicate-protocol/&quot;&gt;切换协议&lt;/a&gt;非常简单,不需要修改一行业务代码。多个协议共存也是允许的。&lt;/p&gt;
 +
 +&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s&quot;&gt;ServiceComb&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;rest&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +    &lt;span class=&quot;s&quot;&gt;address:0.0.0.0:8084&lt;/span&gt;
 +  &lt;span class=&quot;s&quot;&gt;highway&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
 +    &lt;span class=&quot;s&quot;&gt;address:0.0.0.0:8094&lt;/span&gt;
 +&lt;/code&gt;&lt;/pre&gt;
 +&lt;/div&gt;
 +
 +&lt;h2 id=&quot;扩展性&quot;&gt;扩展性&lt;/h2&gt;
 +
 +&lt;p&gt;扩展性是系统进一步发展的基石。&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 创造性地将扩展性拓展到 Provider 和 Consumer,让开发者拥有一致的开发体验。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;内部系统结构&quot;&gt;内部系统结构&lt;/h3&gt;
 +
 +&lt;p&gt;连接开发者和通信协议层面已经让系统具备了很大的扩展性。微服务化给系统解耦、团队自治带来了很大的灵活性,加快了开发生产效率,但同时带来了服务管控的复杂性,在微服务领域,不得不考虑雪崩效应、调用跟踪、性能监控与分析等实际管控治理问题。&lt;/p&gt;
 +
 +&lt;p&gt;基于服务契约,&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 提供了&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/handlers&quot;&gt;动态插拔扩展的处理链机制&lt;/a&gt;,并且为这些管控治理能力提供了默认实现,用户可以灵活插拔这些处理模块,或调整它们的顺序以应对不同的处理场景,或自行实现以增加新的处理模块。Provider 和 Consumer 都会经过该处理链,这给客户端治理功能开发带来了极大的便利性。Apache ServiceComb 的运行结构如下:&lt;/p&gt;
 +
 +&lt;p class=&quot;figure-caption&quot;&gt;&lt;img src=&quot;/assets/images/open-design-running-arch.png&quot; alt=&quot;running-arch&quot; class=&quot;align-center&quot; /&gt;  &lt;br /&gt;
 +图1 Apache ServiceComb 运行时架构&lt;/p&gt;
 +
 +&lt;p&gt;Apache ServiceComb 同时支持同步和异步两种编程接口,并在通信实现上采用了纯异步方式,对于运行模型的扩展,也是基于异步回调接口的。该方式提供了比同步模式(比如 Filter)更加优雅灵活的扩展方式。&lt;/p&gt;
 +
 +&lt;p&gt;在Apache ServiceComb 结构中,几个核心的扩展机制均在 &lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/core/src/main/java/org/apache/servicecomb/core&quot;&gt;core 模块&lt;/a&gt; 进行定义:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/core/src/main/java/org/apache/servicecomb/core/provider/producer&quot;&gt;Producer Provider&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;Provider 编程模型的扩展,通过实现这个接口,可以适配不同的 Provider编 程风格;默认支持 RPC、Spring MVC 和 JAX-RS 三种风格。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/core/src/main/java/org/apache/servicecomb/core/provider/consumer&quot;&gt;Consumer Provider&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;Consumer 编程模型的扩展,通过实现这个接口,可以适配不同的 Consumer 编程风格;默认支持 RPC和RestTemplate 两种风格。RestTemplate 是 Spring MVC 提供的 REST 编程接口,可以在服务层解除接口依赖,只依赖数据模型。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/core/src/main/java/org/apache/servicecomb/core/handler&quot;&gt;Handler&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;处理链的接口,通过扩展该接口,可以在处理过程中插入任意的逻辑。默认已经支持&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/handlers/handler-loadbalance&quot;&gt;负载均衡&lt;/a&gt;、&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/handlers/handler-fault-injection&quot;&gt;错误注入&lt;/a&gt;、&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/handlers/handler-flowcontrol-qps&quot;&gt;流量控制&lt;/a&gt;和&lt;a hr [...]
 +
 +&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/transports&quot;&gt;Transport&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;通信协议扩展,默认支持&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/users/communicate-protocol/&quot;&gt;REST over Vertx、Rest over Servlet、Highway&lt;/a&gt;协议。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;Invocation&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;中立的对象。所有的运行模型都面向这个中立的对象进行编程,当定义好服务接口后,对服务的治理和服务业务逻辑的开发可并行进行。在编程模型和通信模型里面,也面向这个对象进行编解码。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;对接外部系统&quot;&gt;对接外部系统&lt;/h3&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis&quot;&gt;Apache ServiceComb Java-chassis&lt;/a&gt; 预留了对接外部系统的接口,以让开发者或用户可以灵活快速切换使用第三方提供的服务,这里所指的外部系统包括但不限于:服务注册发现的服务中心、配置管控和治理的配置中心、运行监控和运维的治理中心等。&lt;/p&gt;
 +
 +&lt;p&gt;下图展示了不同的开发框架支持和运行的第三方系统情况,这些基础服务都给开发者预留了可以进行支持接入的接口。&lt;/p&gt;
 +
 +&lt;p class=&quot;figure-caption&quot;&gt;&lt;img src=&quot;/assets/images/open-design-third-party-plugin.png&quot; alt=&quot;third-party-plugin&quot; class=&quot;align-center&quot; /&gt;   &lt;br /&gt;
 +图2 Apache ServiceComb 外部扩展接入&lt;/p&gt;
 +
 +&lt;p&gt;重要的扩展:&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client&quot;&gt;ServiceRegistryClient&lt;/a&gt;:&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;实现这个接口以对接不同的注册服务。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/foundations/foundation-config&quot;&gt;ConfigCenterConfigurationSource&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;实现这个接口以对接不同的配置服务。&lt;/p&gt;
 +
 +&lt;p&gt;此外,ServiceComb还提供了对接&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/tracing/tracing-zipkin&quot;&gt;Zipkin&lt;/a&gt;、Servo等开源系统的功能,这些可以从&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/&quot;&gt;github代码&lt;/a&gt;中查找到对应的例子。&lt;/p&gt;
 +
 +&lt;h3 id=&quot;运行环境集成&quot;&gt;运行环境集成&lt;/h3&gt;
 +
 +&lt;p&gt;一个完整的业务系统不是使用RPC框架就算完成了,它们还需要其他的计算资源。对于一般的业务系统都需要访问数据库,或者基于 J2EE 的设施进行工作。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;开源微服务框架 Apache ServiceComb&lt;/a&gt; 可以以轻量级的方式运行,也可集成到其他系统框架。下面的示意图说明了 Apache ServiceComb 的一些工作环境。&lt;/p&gt;
 +
 +&lt;p class=&quot;figure-caption&quot;&gt;&lt;img src=&quot;/assets/images/open-design-integrate-with-running-environment.png&quot; alt=&quot;integrate-with-running-environment&quot; class=&quot;align-center&quot; /&gt;   &lt;br /&gt;
 +图3 Apache ServiceComb 运行环境集成&lt;/p&gt;
 +
 +&lt;ul&gt;
 +  &lt;li&gt;若业务只需 REST 接口,可以轻量级的方式运行 Apache ServiceComb 。所有的REST接口运行于ServiceComb 提供的 Netty HTTP 之上。&lt;/li&gt;
 +  &lt;li&gt;若业务是基于 J2EE 来构建,那么 Apache ServiceComb 可以作为一个 Servlet ,运行于 Web 容器里面(如 Tomcat、Jetty 等)。&lt;/li&gt;
 +  &lt;li&gt;若业务基于 Spring Boot 生态构建,Apache ServiceComb 可作为一个starter对外提供 REST 服务,开发者可以自由使用其他基于 Spring Boot 的功能。&lt;/li&gt;
 +&lt;/ul&gt;
 +
 +&lt;p&gt;由于 Apache ServiceComb 使用了Spring,因此天然继承了Spring的原有优势,可和很多通用的组件很好的集成,如 mybatis、JPA 等。各种集成方式,都可以从&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;ServiceComb官网&lt;/a&gt;或者&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis/tree/master/demo&quot;&gt;ServiceComb 示例库&lt;/a&gt;找到对应的例子。&lt;/p&gt;
 +
 +&lt;h2 id=&quot;写在最后&quot;&gt;写在最后&lt;/h2&gt;
 +
 +&lt;p&gt;开源微服务框架 Apache ServiceComb 的主体代码是由华为云微服务引擎捐赠给 Apache 软件基金会的,愿景是帮助企业快速构建云原生应用,通过一系列解决方案帮助用户快速开发微服务应用的同时实现对这些微服务应用的高效运维管理。本次设计团队将开放性设计部分细节点点滴滴分享出来也是为了能够解放开发者和用户。&lt;/p&gt;
 +
 +&lt;p&gt;当前越来越多的贡献者已加入到 社区行列,Apache ServiceComb 会和这些志愿者们一起一如既往坚持这个理念,争取给业界带来更多好的技术和分享。也期望有更多有志者一起行动。&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/docs/join_the_community/&quot;&gt;&lt;strong&gt;如何加入Apache ServiceComb 社区&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;致谢原稿作者: 刘宝&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;strong&gt;参考文献&lt;/strong&gt;&lt;/p&gt;
 +
 +&lt;p&gt;[1] 开源微服务框架 Apache ServiceComb 官网&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;http://servicecomb.incubator.apache.org/cn/&quot;&gt;http://servicecomb.incubator.apache.org/cn/&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;[2] 开源微服务框架 Apache ServiceComb 代码&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-java-chassis&quot;&gt;https://github.com/apache/incubator-servicecomb-java-chassis&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-service-center&quot;&gt;https://github.com/apache/incubator-servicecomb-service-center&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;&lt;a href=&quot;https://github.com/apache/incubator-servicecomb-saga&quot;&gt;https://github.com/apache/incubator-servicecomb-saga&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;[3] 华为云微服务引擎 CSE(Cloud Service Engine)&lt;/p&gt;
 +
 +&lt;p&gt;入口 &lt;a href=&quot;https://www.huaweicloud.com/product/cse.html&quot;&gt;https://www.huaweicloud.com/product/cse.html&lt;/a&gt;&lt;/p&gt;
 +
 +&lt;p&gt;资料 &lt;a href=&quot;http://support.huaweicloud.com/cse_dld/index.html&quot;&gt;http://support.huaweicloud.com/cse_dld/index.html&lt;/a&gt;&lt;/p&gt;</content><author><name>Zen Lin, Bao Liu</name></author><category term="设计" /><category term="开放,扩展" /><summary type="html">本文讲述了整个 开源微服务框架 Apache ServiceComb 设计形成的前因后果,尝试从理念、思想和实践结合的维度剖析一个优质的微服务框架应该具备哪些要素,包括但不限于 对开发者友好、高性能、内外部扩展性&gt;等。</summary></entry></feed>