http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/blob/af2718af/content/docs/batch-example/index.html
----------------------------------------------------------------------
diff --cc content/docs/batch-example/index.html
index 3f4408d,0000000..ae99855
mode 100644,000000..100644
--- a/content/docs/batch-example/index.html
+++ b/content/docs/batch-example/index.html
@@@ -1,692 -1,0 +1,692 @@@
 +<!doctype html>
 +<html lang="en" class="no-js">
 +  <head>
 +    <meta charset="utf-8">
 +
 +<!-- begin SEO -->
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +<title>Batch Example - Apache RocketMQ</title>
 +
 +
 +
 +
 +<meta name="description" content="How to use batch in Rocketmq">
 +
 +
 +
 +
 +<meta property="og:locale" content="en">
 +<meta property="og:site_name" content="Apache RocketMQ">
 +<meta property="og:title" content="Batch Example">
 +
 +
 +
 +
 +  <meta property="og:description" content="How to use batch in Rocketmq">
 +
 +
 +
 +  <meta name="twitter:site" content="@ApacheRocketMQ">
 +  <meta name="twitter:title" content="Batch Example">
 +  <meta name="twitter:description" content="How to use batch in Rocketmq">
 +  <meta name="twitter:url" content="">
 +
 +  
 +    <meta name="twitter:card" content="summary">
 +    
 +  
 +
 +  
 +
 +
 +
 +  
 +
 +  
 +
 +
 +
 +
 +
 +  <meta property="og:type" content="article">
-   <meta property="article:published_time" content="2017-06-08T17:34:10+08:00">
++  <meta property="article:published_time" content="2017-06-08T18:09:33+08:00">
 +
 +
 +
 +
 +
 +
 +
 +
 +  <script type="application/ld+json">
 +    {
 +      "@context" : "http://schema.org";,
 +      "@type" : "Person",
 +      "name" : "Apache RocketMQ",
 +      "url" : null,
 +      "sameAs" : null
 +    }
 +  </script>
 +
 +
 +
 +  <meta name="google-site-verification" 
content="aand0XZkSGsziuC-UPD4ZJniFD0m0JhGx6820y2mAQY" />
 +
 +
 +  <meta name="baidu-site-verification" content="wD06EbDRkQ" />
 +
 +
 +
 +
 +<!-- end SEO -->
 +
 +
 +<link href="/feed.xml" type="application/atom+xml" rel="alternate" 
title="Apache RocketMQ 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>
 +
 +<!-- For all browsers -->
 +<link rel="stylesheet" href="/assets/css/main.css">
 +
 +<meta http-equiv="cleartype" content="on">
 +    <!-- start custom head snippets -->
 +
 +<!-- insert favicons. use http://realfavicongenerator.net/ -->
 +
 +<!-- 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">
 +        <button><div class="navicon"></div></button>
 +        <ul class="visible-links">
 +          <li class="masthead__menu-item masthead__menu-item--lg"><a 
href="/">Apache RocketMQ</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/docs/quick-start/">Documentation</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/year-archive/">Blog</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/community/">Community</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/customer/">Customer</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/about/team/">About</a></li>
 +          
 +        </ul>
 +        <ul class="hidden-links hidden"></ul>
 +      </nav>
 +    </div>
 +  </div>
 +</div>
 +
 +    
 +
 +
 +
 +<div id="main" role="main">
 +  
 +  <div class="sidebar sticky">
 +  
 +  
 +    
 +      
 +      
 +      
 +    
 +    
 +      
 +
 +<nav class="nav__list">
 +  
 +  <input id="ac-toc" name="accordion-toc" type="checkbox" />
 +  <label for="ac-toc">Toggle Menu</label>
 +  <ul class="nav__items">
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">User Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/motivation/" class="">Why RocketMQ</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/quick-start/" class="">Quick Start</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/simple-example/" class="">Simple 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/order-example/" class="">Order Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/broadcast-example/" class="">Broadcasting 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/schedule-example/" class="">Schedule 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/batch-example/" class="active">Batch 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/filter-by-sql92-example/" class="">Filter 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/faq/" class="">FAQ</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Deployment & Operations</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-arc/" class="">Architecture</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-deployment/" class="">Deployment</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/cli-admin-tool/" class="">CLI Admin 
Tool</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Contributor Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/code-guidelines/" class="">Code 
Guidelines</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/pull-request/" class="">Manage Pull 
Request</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/release-manual" class="">Release 
Manual</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Best Practice</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/core-concept/" class="">Core Concept</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-broker/" class="">Broker</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-producer/" 
class="">Producer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-consumer/" 
class="">Consumer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-namesvr/" 
class="">NameServer</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Release Notes</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/dowloading/releases/" class="">Download</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/release_notes/release-notes-4.0.0-incubating/" 
class="">4.0.0-incubating</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          
 +          
 +
 +          <a href="/docs/roadmap/"><span 
class="nav__sub-title">RoadMap</span></a>
 +        
 +
 +        
 +      </li>
 +    
 +  </ul>
 +</nav>
 +    
 +  
 +  </div>
 +
 +
 +  <article class="page" itemscope itemtype="http://schema.org/CreativeWork";>
 +    <meta itemprop="headline" content="Batch Example">
 +    <meta itemprop="description" content="How to use batch in Rocketmq">
 +    <meta itemprop="datePublished" content="June 08, 2017">
 +    <meta itemprop="dateModified" content="April 24, 2017">
 +
 +    <div class="page__inner-wrap">
 +      
 +        <header>
 +          <h1 class="page__title" itemprop="headline">Batch Example
 +</h1>
 +          
 +        </header>
 +      
 +
 +      <section class="page__content" itemprop="text">
 +        <aside class="sidebar__right">
 +<nav class="toc">
 +    <header><h4 class="nav__title"><i class="fa fa-file-text"></i> On This 
Page</h4></header>
 +<ul class="toc__menu" id="markdown-toc">
 +  <li><a href="#why-batch" id="markdown-toc-why-batch">Why batch?</a></li>
 +  <li><a href="#usage-constraints" id="markdown-toc-usage-constraints">Usage 
constraints</a></li>
 +  <li><a href="#how-to-use-batch" id="markdown-toc-how-to-use-batch">How to 
use batch</a></li>
 +  <li><a href="#split-into-lists" id="markdown-toc-split-into-lists">Split 
into lists</a></li>
 +</ul>
 +
 +  </nav>
 +</aside>
 +
 +<h4 id="why-batch">Why batch?</h4>
 +<p>Sending messages in batch improves performance of delivering small 
messages.</p>
 +
 +<h4 id="usage-constraints">Usage constraints</h4>
 +<p>Messages of the same batch should have: same topic, same waitStoreMsgOK 
and no schedule support.</p>
 +
 +<p>Besides, the total size of the messages in one batch should be no more 
than 1MiB.</p>
 +
 +<h4 id="how-to-use-batch">How to use batch</h4>
 +<p>If you just send messages of no more than 1MiB at a time, it is easy to 
use batch:</p>
 +
 +<div class="language-java highlighter-rouge"><pre 
class="highlight"><code><span class="n">String</span> <span 
class="n">topic</span> <span class="o">=</span> <span 
class="s">"BatchTest"</span><span class="o">;</span>
 +<span class="n">List</span><span class="o">&lt;</span><span 
class="n">Message</span><span class="o">&gt;</span> <span 
class="n">messages</span> <span class="o">=</span> <span class="k">new</span> 
<span class="n">ArrayList</span><span class="o">&lt;&gt;();</span>
 +<span class="n">messages</span><span class="o">.</span><span 
class="na">add</span><span class="o">(</span><span class="k">new</span> <span 
class="n">Message</span><span class="o">(</span><span 
class="n">topic</span><span class="o">,</span> <span 
class="s">"TagA"</span><span class="o">,</span> <span 
class="s">"OrderID001"</span><span class="o">,</span> <span class="s">"Hello 
world 0"</span><span class="o">.</span><span class="na">getBytes</span><span 
class="o">()));</span>
 +<span class="n">messages</span><span class="o">.</span><span 
class="na">add</span><span class="o">(</span><span class="k">new</span> <span 
class="n">Message</span><span class="o">(</span><span 
class="n">topic</span><span class="o">,</span> <span 
class="s">"TagA"</span><span class="o">,</span> <span 
class="s">"OrderID002"</span><span class="o">,</span> <span class="s">"Hello 
world 1"</span><span class="o">.</span><span class="na">getBytes</span><span 
class="o">()));</span>
 +<span class="n">messages</span><span class="o">.</span><span 
class="na">add</span><span class="o">(</span><span class="k">new</span> <span 
class="n">Message</span><span class="o">(</span><span 
class="n">topic</span><span class="o">,</span> <span 
class="s">"TagA"</span><span class="o">,</span> <span 
class="s">"OrderID003"</span><span class="o">,</span> <span class="s">"Hello 
world 2"</span><span class="o">.</span><span class="na">getBytes</span><span 
class="o">()));</span>
 +<span class="k">try</span> <span class="o">{</span>
 +    <span class="n">producer</span><span class="o">.</span><span 
class="na">send</span><span class="o">(</span><span 
class="n">messages</span><span class="o">);</span>
 +<span class="o">}</span> <span class="k">catch</span> <span 
class="o">(</span><span class="n">Exception</span> <span 
class="n">e</span><span class="o">)</span> <span class="o">{</span>
 +    <span class="n">e</span><span class="o">.</span><span 
class="na">printStackTrace</span><span class="o">();</span>
 +    <span class="c1">//handle the error</span>
 +<span class="o">}</span>
 +    
 +</code></pre>
 +</div>
 +<h4 id="split-into-lists">Split into lists</h4>
 +<p>The complexity only grow when you send large batch and you may not sure if 
it exceeds the size limit (1MiB).</p>
 +
 +<p>At this time, you’d better split the lists:</p>
 +
 +<div class="language-java highlighter-rouge"><pre 
class="highlight"><code><span class="kd">public</span> <span 
class="kd">class</span> <span class="nc">ListSplitter</span> <span 
class="kd">implements</span> <span class="n">Iterator</span><span 
class="o">&lt;</span><span class="n">List</span><span 
class="o">&lt;</span><span class="n">Message</span><span 
class="o">&gt;&gt;</span> <span class="o">{</span>
 +    <span class="kd">private</span> <span class="kd">final</span> <span 
class="kt">int</span> <span class="n">SIZE_LIMIT</span> <span 
class="o">=</span> <span class="mi">1000</span> <span class="o">*</span> <span 
class="mi">1000</span><span class="o">;</span>
 +    <span class="kd">private</span> <span class="kd">final</span> <span 
class="n">List</span><span class="o">&lt;</span><span 
class="n">Message</span><span class="o">&gt;</span> <span 
class="n">messages</span><span class="o">;</span>
 +    <span class="kd">private</span> <span class="kt">int</span> <span 
class="n">currIndex</span><span class="o">;</span>
 +    <span class="kd">public</span> <span class="nf">ListSplitter</span><span 
class="o">(</span><span class="n">List</span><span class="o">&lt;</span><span 
class="n">Message</span><span class="o">&gt;</span> <span 
class="n">messages</span><span class="o">)</span> <span class="o">{</span>
 +            <span class="k">this</span><span class="o">.</span><span 
class="na">messages</span> <span class="o">=</span> <span 
class="n">messages</span><span class="o">;</span>
 +    <span class="o">}</span>
 +    <span class="nd">@Override</span> <span class="kd">public</span> <span 
class="kt">boolean</span> <span class="nf">hasNext</span><span 
class="o">()</span> <span class="o">{</span>
 +        <span class="k">return</span> <span class="n">currIndex</span> <span 
class="o">&lt;</span> <span class="n">messages</span><span 
class="o">.</span><span class="na">size</span><span class="o">();</span>
 +    <span class="o">}</span>
 +    <span class="nd">@Override</span> <span class="kd">public</span> <span 
class="n">List</span><span class="o">&lt;</span><span 
class="n">Message</span><span class="o">&gt;</span> <span 
class="nf">next</span><span class="o">()</span> <span class="o">{</span>
 +        <span class="kt">int</span> <span class="n">nextIndex</span> <span 
class="o">=</span> <span class="n">currIndex</span><span class="o">;</span>
 +        <span class="kt">int</span> <span class="n">totalSize</span> <span 
class="o">=</span> <span class="mi">0</span><span class="o">;</span>
 +        <span class="k">for</span> <span class="o">(;</span> <span 
class="n">nextIndex</span> <span class="o">&lt;</span> <span 
class="n">messages</span><span class="o">.</span><span 
class="na">size</span><span class="o">();</span> <span 
class="n">nextIndex</span><span class="o">++)</span> <span class="o">{</span>
 +            <span class="n">Message</span> <span class="n">message</span> 
<span class="o">=</span> <span class="n">messages</span><span 
class="o">.</span><span class="na">get</span><span class="o">(</span><span 
class="n">nextIndex</span><span class="o">);</span>
 +            <span class="kt">int</span> <span class="n">tmpSize</span> <span 
class="o">=</span> <span class="n">message</span><span class="o">.</span><span 
class="na">getTopic</span><span class="o">().</span><span 
class="na">length</span><span class="o">()</span> <span class="o">+</span> 
<span class="n">message</span><span class="o">.</span><span 
class="na">getBody</span><span class="o">().</span><span 
class="na">length</span><span class="o">;</span>
 +            <span class="n">Map</span><span class="o">&lt;</span><span 
class="n">String</span><span class="o">,</span> <span 
class="n">String</span><span class="o">&gt;</span> <span 
class="n">properties</span> <span class="o">=</span> <span 
class="n">message</span><span class="o">.</span><span 
class="na">getProperties</span><span class="o">();</span>
 +            <span class="k">for</span> <span class="o">(</span><span 
class="n">Map</span><span class="o">.</span><span class="na">Entry</span><span 
class="o">&lt;</span><span class="n">String</span><span class="o">,</span> 
<span class="n">String</span><span class="o">&gt;</span> <span 
class="n">entry</span> <span class="o">:</span> <span 
class="n">properties</span><span class="o">.</span><span 
class="na">entrySet</span><span class="o">())</span> <span class="o">{</span>
 +                <span class="n">tmpSize</span> <span class="o">+=</span> 
<span class="n">entry</span><span class="o">.</span><span 
class="na">getKey</span><span class="o">().</span><span 
class="na">length</span><span class="o">()</span> <span class="o">+</span> 
<span class="n">entry</span><span class="o">.</span><span 
class="na">getValue</span><span class="o">().</span><span 
class="na">length</span><span class="o">();</span>
 +            <span class="o">}</span>
 +            <span class="n">tmpSize</span> <span class="o">=</span> <span 
class="n">tmpSize</span> <span class="o">+</span> <span 
class="mi">20</span><span class="o">;</span> <span class="c1">//for log 
overhead</span>
 +            <span class="k">if</span> <span class="o">(</span><span 
class="n">tmpSize</span> <span class="o">&gt;</span> <span 
class="n">SIZE_LIMIT</span><span class="o">)</span> <span class="o">{</span>
 +                <span class="c1">//it is unexpected that single message 
exceeds the SIZE_LIMIT</span>
 +                <span class="c1">//here just let it go, otherwise it will 
block the splitting process</span>
 +                <span class="k">if</span> <span class="o">(</span><span 
class="n">nextIndex</span> <span class="o">-</span> <span 
class="n">currIndex</span> <span class="o">==</span> <span 
class="mi">0</span><span class="o">)</span> <span class="o">{</span>
 +                   <span class="c1">//if the next sublist has no element, add 
this one and then break, otherwise just break</span>
 +                   <span class="n">nextIndex</span><span class="o">++;</span> 
 
 +                <span class="o">}</span>
 +                <span class="k">break</span><span class="o">;</span>
 +            <span class="o">}</span>
 +            <span class="k">if</span> <span class="o">(</span><span 
class="n">tmpSize</span> <span class="o">+</span> <span 
class="n">totalSize</span> <span class="o">&gt;</span> <span 
class="n">SIZE_LIMIT</span><span class="o">)</span> <span class="o">{</span>
 +                <span class="k">break</span><span class="o">;</span>
 +            <span class="o">}</span> <span class="k">else</span> <span 
class="o">{</span>
 +                <span class="n">totalSize</span> <span class="o">+=</span> 
<span class="n">tmpSize</span><span class="o">;</span>
 +            <span class="o">}</span>
 +    
 +        <span class="o">}</span>
 +        <span class="n">List</span><span class="o">&lt;</span><span 
class="n">Message</span><span class="o">&gt;</span> <span 
class="n">subList</span> <span class="o">=</span> <span 
class="n">messages</span><span class="o">.</span><span 
class="na">subList</span><span class="o">(</span><span 
class="n">currIndex</span><span class="o">,</span> <span 
class="n">nextIndex</span><span class="o">);</span>
 +        <span class="n">currIndex</span> <span class="o">=</span> <span 
class="n">nextIndex</span><span class="o">;</span>
 +        <span class="k">return</span> <span class="n">subList</span><span 
class="o">;</span>
 +    <span class="o">}</span>
 +<span class="o">}</span>
 +<span class="c1">//then you could split the large list into small ones:</span>
 +<span class="n">ListSplitter</span> <span class="n">splitter</span> <span 
class="o">=</span> <span class="k">new</span> <span 
class="n">ListSplitter</span><span class="o">(</span><span 
class="n">messages</span><span class="o">);</span>
 +<span class="k">while</span> <span class="o">(</span><span 
class="n">splitter</span><span class="o">.</span><span 
class="na">hasNext</span><span class="o">())</span> <span class="o">{</span>
 +   <span class="k">try</span> <span class="o">{</span>
 +       <span class="n">List</span><span class="o">&lt;</span><span 
class="n">Message</span><span class="o">&gt;</span>  <span 
class="n">listItem</span> <span class="o">=</span> <span 
class="n">splitter</span><span class="o">.</span><span 
class="na">next</span><span class="o">();</span>
 +       <span class="n">producer</span><span class="o">.</span><span 
class="na">send</span><span class="o">(</span><span 
class="n">listItem</span><span class="o">);</span>
 +   <span class="o">}</span> <span class="k">catch</span> <span 
class="o">(</span><span class="n">Exception</span> <span 
class="n">e</span><span class="o">)</span> <span class="o">{</span>
 +       <span class="n">e</span><span class="o">.</span><span 
class="na">printStackTrace</span><span class="o">();</span>
 +       <span class="c1">//handle the error</span>
 +   <span class="o">}</span>
 +<span class="o">}</span>
 +</code></pre>
 +</div>
 +
 +        
 +      </section>
 +
 +      <footer class="page__meta">
 +        
 +        
 +
 +
 +        
 +          <p class="page__date"><strong><i class="fa fa-fw fa-calendar" 
aria-hidden="true"></i> Updated:</strong> <time datetime="2017-04-24">April 24, 
2017</time></p>
 +        
 +      </footer>
 +
 +      <section class="page__share">
 +  
 +    <h4 class="page__share-title">Share on</h4>
 +  
 +
 +  <a href="https://twitter.com/intent/tweet?via=ApacheRocketMQ&text=Batch 
Example /docs/batch-example/" 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/batch-example/"; 
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/batch-example/"; 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/batch-example/"; 
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="/docs/roadmap/" class="pagination--pager" title="The RoadMap 
of Apache RocketMQ
 +">Previous</a>
 +    
 +    
 +      <a href="/docs/broadcast-example/" class="pagination--pager" 
title="Broadcasting
 +">Next</a>
 +    
 +  </nav>
 +
 +    </div>
 +
 +    
 +      <div class="page__comments">
 +  
 +  
 +    <h4 class="page__comments-title">Leave a Comment</h4>
 +    <section id="disqus_thread"></section>
 +  
 +</div>
 +    
 +  </article>
 +
 +  
 +  
 +</div>
 +
 +    <div class="page__footer">
 +      <footer>
 +        <!-- start custom footer snippets -->
 +
 +<!-- end custom footer snippets -->
 +        <style type="text/css">
 +  div.columns   { float: left; margin-left: 10px;}
 +  div.clear     { clear: both; } 
 +</style>
 +<div>
 +  <div class="columns">
 +    <a href="https://www.apache.org/";><img 
src="/assets/images/feather-small.gif" alt="Apache Software Foundation" 
style="height: 88px !important" /></a>
 +  </div>
 +  <div class="columns" style="width: 80%">
 +    <div class="page__footer-follow">
 +      <ul class="social-icons">
 +        
 +          <li><strong>Follow:</strong></li>
 +        
 +        
 +          <li><a href="https://twitter.com/ApacheRocketMQ";><i class="fa fa-fw 
fa-twitter-square" aria-hidden="true"></i> Twitter</a></li>
 +        
 +        
 +        
 +          <li><a href="http://github.com/apache/incubator-rocketmq";><i 
class="fa fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
 +        
 +        
 +        <li><a href="/feed.xml"><i class="fa fa-fw fa-rss-square" 
aria-hidden="true"></i> Feed</a></li>
 +      </ul>
 +    </div>
 +
 +    <div class="page__footer-copyright">Copyright &copy; 2017 <a 
href="http://www.apache.org/";>The Apache Software Foundation</a>. All Rights 
Reserved.</div>
 +  </div>
 +</div>
 +<div class="clear"></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','//www.google-analytics.com/analytics.js','ga');
 +
 +  ga('create', 'UA-89603173-1', 'auto');
 +  ga('send', 'pageview');
 +</script>
 +
 +<script>
 +var _hmt = _hmt || [];
 +(function() {
 +  var hm = document.createElement("script");
 +  hm.src = "https://hm.baidu.com/hm.js?36428f2b841d08e7405724cbf7f860d2";;
 +  var s = document.getElementsByTagName("script")[0]; 
 +  s.parentNode.insertBefore(hm, s);
 +})();
 +</script>
 +
 +
 +
 +
 +  
 +  <script type="text/javascript">
 +      /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * 
* */
 +      var disqus_shortname = 'rocketmq';
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function() {
 +              var dsq = document.createElement('script'); dsq.type = 
'text/javascript'; dsq.async = true;
 +              dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
 +              (document.getElementsByTagName('head')[0] || 
document.getElementsByTagName('body')[0]).appendChild(dsq);
 +      })();
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function () {
 +              var s = document.createElement('script'); s.async = true;
 +              s.type = 'text/javascript';
 +              s.src = '//' + disqus_shortname + '.disqus.com/count.js';
 +              (document.getElementsByTagName('HEAD')[0] || 
document.getElementsByTagName('BODY')[0]).appendChild(s);
 +      }());
 +  </script>
 +  <noscript>Please enable JavaScript to view the <a 
href="http://disqus.com/?ref_noscript";>comments powered by 
Disqus.</a></noscript>
 +
 +
 +
 +
 +
 +
 +  </body>
 +</html>

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/blob/af2718af/content/docs/best-practice-broker/index.html
----------------------------------------------------------------------
diff --cc content/docs/best-practice-broker/index.html
index 4a7380c,0000000..2ae7faa
mode 100644,000000..100644
--- a/content/docs/best-practice-broker/index.html
+++ b/content/docs/best-practice-broker/index.html
@@@ -1,621 -1,0 +1,621 @@@
 +<!doctype html>
 +<html lang="en" class="no-js">
 +  <head>
 +    <meta charset="utf-8">
 +
 +<!-- begin SEO -->
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +<title>Best Practice For Broker - Apache RocketMQ</title>
 +
 +
 +
 +
 +<meta name="description" content="Some useful tips for users.">
 +
 +
 +
 +
 +<meta property="og:locale" content="en">
 +<meta property="og:site_name" content="Apache RocketMQ">
 +<meta property="og:title" content="Best Practice For Broker">
 +
 +
 +
 +
 +  <meta property="og:description" content="Some useful tips for users.">
 +
 +
 +
 +  <meta name="twitter:site" content="@ApacheRocketMQ">
 +  <meta name="twitter:title" content="Best Practice For Broker">
 +  <meta name="twitter:description" content="Some useful tips for users.">
 +  <meta name="twitter:url" content="">
 +
 +  
 +    <meta name="twitter:card" content="summary">
 +    
 +  
 +
 +  
 +
 +
 +
 +  
 +
 +  
 +
 +
 +
 +
 +
 +  <meta property="og:type" content="article">
-   <meta property="article:published_time" content="2017-06-08T17:34:10+08:00">
++  <meta property="article:published_time" content="2017-06-08T18:09:33+08:00">
 +
 +
 +
 +
 +
 +
 +
 +
 +  <script type="application/ld+json">
 +    {
 +      "@context" : "http://schema.org";,
 +      "@type" : "Person",
 +      "name" : "Apache RocketMQ",
 +      "url" : null,
 +      "sameAs" : null
 +    }
 +  </script>
 +
 +
 +
 +  <meta name="google-site-verification" 
content="aand0XZkSGsziuC-UPD4ZJniFD0m0JhGx6820y2mAQY" />
 +
 +
 +  <meta name="baidu-site-verification" content="wD06EbDRkQ" />
 +
 +
 +
 +
 +<!-- end SEO -->
 +
 +
 +<link href="/feed.xml" type="application/atom+xml" rel="alternate" 
title="Apache RocketMQ 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>
 +
 +<!-- For all browsers -->
 +<link rel="stylesheet" href="/assets/css/main.css">
 +
 +<meta http-equiv="cleartype" content="on">
 +    <!-- start custom head snippets -->
 +
 +<!-- insert favicons. use http://realfavicongenerator.net/ -->
 +
 +<!-- 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">
 +        <button><div class="navicon"></div></button>
 +        <ul class="visible-links">
 +          <li class="masthead__menu-item masthead__menu-item--lg"><a 
href="/">Apache RocketMQ</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/docs/quick-start/">Documentation</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/year-archive/">Blog</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/community/">Community</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/customer/">Customer</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/about/team/">About</a></li>
 +          
 +        </ul>
 +        <ul class="hidden-links hidden"></ul>
 +      </nav>
 +    </div>
 +  </div>
 +</div>
 +
 +    
 +
 +
 +
 +<div id="main" role="main">
 +  
 +  <div class="sidebar sticky">
 +  
 +  
 +    
 +      
 +      
 +      
 +    
 +    
 +      
 +
 +<nav class="nav__list">
 +  
 +  <input id="ac-toc" name="accordion-toc" type="checkbox" />
 +  <label for="ac-toc">Toggle Menu</label>
 +  <ul class="nav__items">
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">User Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/motivation/" class="">Why RocketMQ</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/quick-start/" class="">Quick Start</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/simple-example/" class="">Simple 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/order-example/" class="">Order Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/broadcast-example/" class="">Broadcasting 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/schedule-example/" class="">Schedule 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/batch-example/" class="">Batch Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/filter-by-sql92-example/" class="">Filter 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/faq/" class="">FAQ</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Deployment & Operations</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-arc/" class="">Architecture</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-deployment/" class="">Deployment</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/cli-admin-tool/" class="">CLI Admin 
Tool</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Contributor Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/code-guidelines/" class="">Code 
Guidelines</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/pull-request/" class="">Manage Pull 
Request</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/release-manual" class="">Release 
Manual</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Best Practice</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/core-concept/" class="">Core Concept</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-broker/" 
class="active">Broker</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-producer/" 
class="">Producer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-consumer/" 
class="">Consumer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-namesvr/" 
class="">NameServer</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Release Notes</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/dowloading/releases/" class="">Download</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/release_notes/release-notes-4.0.0-incubating/" 
class="">4.0.0-incubating</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          
 +          
 +
 +          <a href="/docs/roadmap/"><span 
class="nav__sub-title">RoadMap</span></a>
 +        
 +
 +        
 +      </li>
 +    
 +  </ul>
 +</nav>
 +    
 +  
 +  </div>
 +
 +
 +  <article class="page" itemscope itemtype="http://schema.org/CreativeWork";>
 +    <meta itemprop="headline" content="Best Practice For Broker">
 +    <meta itemprop="description" content="Some useful tips for users.">
 +    <meta itemprop="datePublished" content="June 08, 2017">
 +    <meta itemprop="dateModified" content="December 24, 2016">
 +
 +    <div class="page__inner-wrap">
 +      
 +        <header>
 +          <h1 class="page__title" itemprop="headline">Best Practice For Broker
 +</h1>
 +          
 +        </header>
 +      
 +
 +      <section class="page__content" itemprop="text">
 +        <p>Some useful tips for users.</p>
 +
 +<aside class="sidebar__right">
 +<nav class="toc">
 +    <header><h4 class="nav__title"><i class="fa fa-file-text"></i> On This 
Page</h4></header>
 +<ul class="toc__menu" id="markdown-toc">
 +  <li><a href="#broker-role" id="markdown-toc-broker-role">Broker 
Role</a></li>
 +  <li><a href="#flushdisktype" 
id="markdown-toc-flushdisktype">FlushDiskType</a></li>
 +  <li><a href="#reentrantlock-vs-cas" 
id="markdown-toc-reentrantlock-vs-cas">ReentrantLock vs CAS</a></li>
 +  <li><a href="#ossh" id="markdown-toc-ossh">os.sh</a></li>
 +</ul>
 +
 +  </nav>
 +</aside>
 +
 +<h2 id="broker-role">Broker Role</h2>
 +<p>Broker Role is ASYNC_MASTER, SYNC_MASTER or SLAVE.
 +If you cannot tolerate message missing, we suggest you deploy SYNC_MASTER and 
attach a SLAVE to it.
 +If you feel ok about missing, but you want the Broker to be always available, 
you may deploy ASYNC_MASTER with SLAVE.
 +If you just want to make it easy, you may only need a ASYNC_MASTER without 
SLAVE.</p>
 +<h2 id="flushdisktype">FlushDiskType</h2>
 +<p>ASYNC_FLUSH is recommended, for SYNC_FLUSH is expensive and will cause too 
much performance loss. If you want reliability, we recommend you use 
SYNC_MASTER with SLAVE.</p>
 +<h2 id="reentrantlock-vs-cas">ReentrantLock vs CAS</h2>
 +<p>to be finished</p>
 +<h2 id="ossh">os.sh</h2>
 +<p>to be finished</p>
 +
 +
 +        
 +      </section>
 +
 +      <footer class="page__meta">
 +        
 +        
 +
 +
 +        
 +          <p class="page__date"><strong><i class="fa fa-fw fa-calendar" 
aria-hidden="true"></i> Updated:</strong> <time datetime="2016-12-24">December 
24, 2016</time></p>
 +        
 +      </footer>
 +
 +      <section class="page__share">
 +  
 +    <h4 class="page__share-title">Share on</h4>
 +  
 +
 +  <a href="https://twitter.com/intent/tweet?via=ApacheRocketMQ&text=Best 
Practice For Broker /docs/best-practice-broker/" 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/best-practice-broker/"; 
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/best-practice-broker/"; 
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/best-practice-broker/";
 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="/docs/filter-by-sql92-example/" class="pagination--pager" 
title="Filter Example
 +">Previous</a>
 +    
 +    
 +      <a href="/docs/best-practice-consumer/" class="pagination--pager" 
title="Best Practice For Consumer
 +">Next</a>
 +    
 +  </nav>
 +
 +    </div>
 +
 +    
 +      <div class="page__comments">
 +  
 +  
 +    <h4 class="page__comments-title">Leave a Comment</h4>
 +    <section id="disqus_thread"></section>
 +  
 +</div>
 +    
 +  </article>
 +
 +  
 +  
 +</div>
 +
 +    <div class="page__footer">
 +      <footer>
 +        <!-- start custom footer snippets -->
 +
 +<!-- end custom footer snippets -->
 +        <style type="text/css">
 +  div.columns   { float: left; margin-left: 10px;}
 +  div.clear     { clear: both; } 
 +</style>
 +<div>
 +  <div class="columns">
 +    <a href="https://www.apache.org/";><img 
src="/assets/images/feather-small.gif" alt="Apache Software Foundation" 
style="height: 88px !important" /></a>
 +  </div>
 +  <div class="columns" style="width: 80%">
 +    <div class="page__footer-follow">
 +      <ul class="social-icons">
 +        
 +          <li><strong>Follow:</strong></li>
 +        
 +        
 +          <li><a href="https://twitter.com/ApacheRocketMQ";><i class="fa fa-fw 
fa-twitter-square" aria-hidden="true"></i> Twitter</a></li>
 +        
 +        
 +        
 +          <li><a href="http://github.com/apache/incubator-rocketmq";><i 
class="fa fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
 +        
 +        
 +        <li><a href="/feed.xml"><i class="fa fa-fw fa-rss-square" 
aria-hidden="true"></i> Feed</a></li>
 +      </ul>
 +    </div>
 +
 +    <div class="page__footer-copyright">Copyright &copy; 2017 <a 
href="http://www.apache.org/";>The Apache Software Foundation</a>. All Rights 
Reserved.</div>
 +  </div>
 +</div>
 +<div class="clear"></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','//www.google-analytics.com/analytics.js','ga');
 +
 +  ga('create', 'UA-89603173-1', 'auto');
 +  ga('send', 'pageview');
 +</script>
 +
 +<script>
 +var _hmt = _hmt || [];
 +(function() {
 +  var hm = document.createElement("script");
 +  hm.src = "https://hm.baidu.com/hm.js?36428f2b841d08e7405724cbf7f860d2";;
 +  var s = document.getElementsByTagName("script")[0]; 
 +  s.parentNode.insertBefore(hm, s);
 +})();
 +</script>
 +
 +
 +
 +
 +  
 +  <script type="text/javascript">
 +      /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * 
* */
 +      var disqus_shortname = 'rocketmq';
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function() {
 +              var dsq = document.createElement('script'); dsq.type = 
'text/javascript'; dsq.async = true;
 +              dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
 +              (document.getElementsByTagName('head')[0] || 
document.getElementsByTagName('body')[0]).appendChild(dsq);
 +      })();
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function () {
 +              var s = document.createElement('script'); s.async = true;
 +              s.type = 'text/javascript';
 +              s.src = '//' + disqus_shortname + '.disqus.com/count.js';
 +              (document.getElementsByTagName('HEAD')[0] || 
document.getElementsByTagName('BODY')[0]).appendChild(s);
 +      }());
 +  </script>
 +  <noscript>Please enable JavaScript to view the <a 
href="http://disqus.com/?ref_noscript";>comments powered by 
Disqus.</a></noscript>
 +
 +
 +
 +
 +
 +
 +  </body>
 +</html>

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/blob/af2718af/content/docs/best-practice-consumer/index.html
----------------------------------------------------------------------
diff --cc content/docs/best-practice-consumer/index.html
index 00645d2,0000000..2ad1fe5
mode 100644,000000..100644
--- a/content/docs/best-practice-consumer/index.html
+++ b/content/docs/best-practice-consumer/index.html
@@@ -1,646 -1,0 +1,646 @@@
 +<!doctype html>
 +<html lang="en" class="no-js">
 +  <head>
 +    <meta charset="utf-8">
 +
 +<!-- begin SEO -->
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +<title>Best Practice For Consumer - Apache RocketMQ</title>
 +
 +
 +
 +
 +<meta name="description" content="Some useful tips for users.">
 +
 +
 +
 +
 +<meta property="og:locale" content="en">
 +<meta property="og:site_name" content="Apache RocketMQ">
 +<meta property="og:title" content="Best Practice For Consumer">
 +
 +
 +
 +
 +  <meta property="og:description" content="Some useful tips for users.">
 +
 +
 +
 +  <meta name="twitter:site" content="@ApacheRocketMQ">
 +  <meta name="twitter:title" content="Best Practice For Consumer">
 +  <meta name="twitter:description" content="Some useful tips for users.">
 +  <meta name="twitter:url" content="">
 +
 +  
 +    <meta name="twitter:card" content="summary">
 +    
 +  
 +
 +  
 +
 +
 +
 +  
 +
 +  
 +
 +
 +
 +
 +
 +  <meta property="og:type" content="article">
-   <meta property="article:published_time" content="2017-06-08T17:34:10+08:00">
++  <meta property="article:published_time" content="2017-06-08T18:09:33+08:00">
 +
 +
 +
 +
 +
 +
 +
 +
 +  <script type="application/ld+json">
 +    {
 +      "@context" : "http://schema.org";,
 +      "@type" : "Person",
 +      "name" : "Apache RocketMQ",
 +      "url" : null,
 +      "sameAs" : null
 +    }
 +  </script>
 +
 +
 +
 +  <meta name="google-site-verification" 
content="aand0XZkSGsziuC-UPD4ZJniFD0m0JhGx6820y2mAQY" />
 +
 +
 +  <meta name="baidu-site-verification" content="wD06EbDRkQ" />
 +
 +
 +
 +
 +<!-- end SEO -->
 +
 +
 +<link href="/feed.xml" type="application/atom+xml" rel="alternate" 
title="Apache RocketMQ 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>
 +
 +<!-- For all browsers -->
 +<link rel="stylesheet" href="/assets/css/main.css">
 +
 +<meta http-equiv="cleartype" content="on">
 +    <!-- start custom head snippets -->
 +
 +<!-- insert favicons. use http://realfavicongenerator.net/ -->
 +
 +<!-- 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">
 +        <button><div class="navicon"></div></button>
 +        <ul class="visible-links">
 +          <li class="masthead__menu-item masthead__menu-item--lg"><a 
href="/">Apache RocketMQ</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/docs/quick-start/">Documentation</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/year-archive/">Blog</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/community/">Community</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/customer/">Customer</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/about/team/">About</a></li>
 +          
 +        </ul>
 +        <ul class="hidden-links hidden"></ul>
 +      </nav>
 +    </div>
 +  </div>
 +</div>
 +
 +    
 +
 +
 +
 +<div id="main" role="main">
 +  
 +  <div class="sidebar sticky">
 +  
 +  
 +    
 +      
 +      
 +      
 +    
 +    
 +      
 +
 +<nav class="nav__list">
 +  
 +  <input id="ac-toc" name="accordion-toc" type="checkbox" />
 +  <label for="ac-toc">Toggle Menu</label>
 +  <ul class="nav__items">
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">User Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/motivation/" class="">Why RocketMQ</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/quick-start/" class="">Quick Start</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/simple-example/" class="">Simple 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/order-example/" class="">Order Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/broadcast-example/" class="">Broadcasting 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/schedule-example/" class="">Schedule 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/batch-example/" class="">Batch Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/filter-by-sql92-example/" class="">Filter 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/faq/" class="">FAQ</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Deployment & Operations</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-arc/" class="">Architecture</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-deployment/" class="">Deployment</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/cli-admin-tool/" class="">CLI Admin 
Tool</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Contributor Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/code-guidelines/" class="">Code 
Guidelines</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/pull-request/" class="">Manage Pull 
Request</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/release-manual" class="">Release 
Manual</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Best Practice</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/core-concept/" class="">Core Concept</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-broker/" class="">Broker</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-producer/" 
class="">Producer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-consumer/" 
class="active">Consumer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-namesvr/" 
class="">NameServer</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Release Notes</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/dowloading/releases/" class="">Download</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/release_notes/release-notes-4.0.0-incubating/" 
class="">4.0.0-incubating</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          
 +          
 +
 +          <a href="/docs/roadmap/"><span 
class="nav__sub-title">RoadMap</span></a>
 +        
 +
 +        
 +      </li>
 +    
 +  </ul>
 +</nav>
 +    
 +  
 +  </div>
 +
 +
 +  <article class="page" itemscope itemtype="http://schema.org/CreativeWork";>
 +    <meta itemprop="headline" content="Best Practice For Consumer">
 +    <meta itemprop="description" content="Some useful tips for users.">
 +    <meta itemprop="datePublished" content="June 08, 2017">
 +    <meta itemprop="dateModified" content="December 24, 2016">
 +
 +    <div class="page__inner-wrap">
 +      
 +        <header>
 +          <h1 class="page__title" itemprop="headline">Best Practice For 
Consumer
 +</h1>
 +          
 +        </header>
 +      
 +
 +      <section class="page__content" itemprop="text">
 +        <p>Some useful tips for users.</p>
 +
 +<aside class="sidebar__right">
 +<nav class="toc">
 +    <header><h4 class="nav__title"><i class="fa fa-file-text"></i> On This 
Page</h4></header>
 +<ul class="toc__menu" id="markdown-toc">
 +  <li><a href="#consumer-group-and-subscriptions" 
id="markdown-toc-consumer-group-and-subscriptions">Consumer Group and 
Subscriptions</a></li>
 +  <li><a href="#messagelistener" 
id="markdown-toc-messagelistener">MessageListener</a>    <ul>
 +      <li><a href="#orderly" id="markdown-toc-orderly">Orderly</a></li>
 +      <li><a href="#concurrently" 
id="markdown-toc-concurrently">Concurrently</a></li>
 +      <li><a href="#consume-status" id="markdown-toc-consume-status">Consume 
Status</a></li>
 +      <li><a href="#blocking" id="markdown-toc-blocking">Blocking</a></li>
 +    </ul>
 +  </li>
 +  <li><a href="#thread-number" id="markdown-toc-thread-number">Thread 
Number</a></li>
 +  <li><a href="#consumefromwhere" 
id="markdown-toc-consumefromwhere">ConsumeFromWhere</a></li>
 +  <li><a href="#duplication" 
id="markdown-toc-duplication">Duplication</a></li>
 +</ul>
 +
 +  </nav>
 +</aside>
 +<h2 id="consumer-group-and-subscriptions">Consumer Group and 
Subscriptions</h2>
 +<p>The first thing you should be aware of is that different Consumer Group 
can consume the same topic independently, and each of them will have their own 
consuming offsets.
 +Please make sure each Consumer within the same Group to subscribe the same 
topics.</p>
 +<h2 id="messagelistener">MessageListener</h2>
 +<h3 id="orderly">Orderly</h3>
 +<p>The Consumer will lock each MessageQueue to make sure it is consumed one 
by one in order. This will cause a performance loss, but it is useful when you 
care about the order of the messages.
 +It is not recommended to throw exceptions, you can return 
ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT instead.</p>
 +<h3 id="concurrently">Concurrently</h3>
 +<p>As the name tells, the Consumer will consume the messages concurrently. It 
is recommended to use this for good performance.
 +It is not recommended to throw exceptions, you can return 
ConsumeConcurrentlyStatus.RECONSUME_LATER instead.</p>
 +<h3 id="consume-status">Consume Status</h3>
 +<p>For MessageListenerConcurrently, you can return RECONSUME_LATER to tell 
the consumer that you can not consume it right now and want to reconsume it 
later. Then you can continue to consume other messages. 
 +For MessageListenerOrderly, because you care about the order, you can not 
jump over the message, but you can return SUSPEND_CURRENT_QUEUE_A_MOMENT to 
tell the consumer to wait for a moment.</p>
 +<h3 id="blocking">Blocking</h3>
 +<p>It is not recommend to block the Listener, because it will block the 
thread pool, and eventually may stop the consuming process.</p>
 +<h2 id="thread-number">Thread Number</h2>
 +<p>The consumer use a ThreadPoolExecutor to process consuming internally, so 
you can change it by setting setConsumeThreadMin or setConsumeThreadMax.</p>
 +<h2 id="consumefromwhere">ConsumeFromWhere</h2>
 +<p>When a new Consumer Group is established, it will need to decide whether 
it needs to consume the historical messages which had already existed in the 
Broker.
 +CONSUME_FROM_LAST_OFFSET will ignore the historical messages, and consume 
anything produced after that.
 +CONSUME_FROM_FIRST_OFFSET will consume every message existed in the Broker.
 +You can also use CONSUME_FROM_TIMESTAMP to consume messages produced after 
the specified timestamp.</p>
 +<h2 id="duplication">Duplication</h2>
 +<p>Many circumstances could cause duplication, such as:</p>
 +<ul>
 +  <li>Producer resend messages(i.e, in case of FLUSH_SLAVE_TIMEOUT)</li>
 +  <li>Consumer shutdown with some offsets not updated to the Broker in 
time.</li>
 +</ul>
 +
 +<p>So you may need to do some external work to handle this if your 
application cannot tolerate duplication. For example, you may check the primary 
key of your DB.</p>
 +
 +
 +        
 +      </section>
 +
 +      <footer class="page__meta">
 +        
 +        
 +
 +
 +        
 +          <p class="page__date"><strong><i class="fa fa-fw fa-calendar" 
aria-hidden="true"></i> Updated:</strong> <time datetime="2016-12-24">December 
24, 2016</time></p>
 +        
 +      </footer>
 +
 +      <section class="page__share">
 +  
 +    <h4 class="page__share-title">Share on</h4>
 +  
 +
 +  <a href="https://twitter.com/intent/tweet?via=ApacheRocketMQ&text=Best 
Practice For Consumer /docs/best-practice-consumer/" 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/best-practice-consumer/";
 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/best-practice-consumer/"; 
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/best-practice-consumer/";
 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="/docs/best-practice-broker/" class="pagination--pager" 
title="Best Practice For Broker
 +">Previous</a>
 +    
 +    
 +      <a href="/docs/create-pull-request/" class="pagination--pager" 
title="How to create Pull Request
 +">Next</a>
 +    
 +  </nav>
 +
 +    </div>
 +
 +    
 +      <div class="page__comments">
 +  
 +  
 +    <h4 class="page__comments-title">Leave a Comment</h4>
 +    <section id="disqus_thread"></section>
 +  
 +</div>
 +    
 +  </article>
 +
 +  
 +  
 +</div>
 +
 +    <div class="page__footer">
 +      <footer>
 +        <!-- start custom footer snippets -->
 +
 +<!-- end custom footer snippets -->
 +        <style type="text/css">
 +  div.columns   { float: left; margin-left: 10px;}
 +  div.clear     { clear: both; } 
 +</style>
 +<div>
 +  <div class="columns">
 +    <a href="https://www.apache.org/";><img 
src="/assets/images/feather-small.gif" alt="Apache Software Foundation" 
style="height: 88px !important" /></a>
 +  </div>
 +  <div class="columns" style="width: 80%">
 +    <div class="page__footer-follow">
 +      <ul class="social-icons">
 +        
 +          <li><strong>Follow:</strong></li>
 +        
 +        
 +          <li><a href="https://twitter.com/ApacheRocketMQ";><i class="fa fa-fw 
fa-twitter-square" aria-hidden="true"></i> Twitter</a></li>
 +        
 +        
 +        
 +          <li><a href="http://github.com/apache/incubator-rocketmq";><i 
class="fa fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
 +        
 +        
 +        <li><a href="/feed.xml"><i class="fa fa-fw fa-rss-square" 
aria-hidden="true"></i> Feed</a></li>
 +      </ul>
 +    </div>
 +
 +    <div class="page__footer-copyright">Copyright &copy; 2017 <a 
href="http://www.apache.org/";>The Apache Software Foundation</a>. All Rights 
Reserved.</div>
 +  </div>
 +</div>
 +<div class="clear"></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','//www.google-analytics.com/analytics.js','ga');
 +
 +  ga('create', 'UA-89603173-1', 'auto');
 +  ga('send', 'pageview');
 +</script>
 +
 +<script>
 +var _hmt = _hmt || [];
 +(function() {
 +  var hm = document.createElement("script");
 +  hm.src = "https://hm.baidu.com/hm.js?36428f2b841d08e7405724cbf7f860d2";;
 +  var s = document.getElementsByTagName("script")[0]; 
 +  s.parentNode.insertBefore(hm, s);
 +})();
 +</script>
 +
 +
 +
 +
 +  
 +  <script type="text/javascript">
 +      /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * 
* */
 +      var disqus_shortname = 'rocketmq';
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function() {
 +              var dsq = document.createElement('script'); dsq.type = 
'text/javascript'; dsq.async = true;
 +              dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
 +              (document.getElementsByTagName('head')[0] || 
document.getElementsByTagName('body')[0]).appendChild(dsq);
 +      })();
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function () {
 +              var s = document.createElement('script'); s.async = true;
 +              s.type = 'text/javascript';
 +              s.src = '//' + disqus_shortname + '.disqus.com/count.js';
 +              (document.getElementsByTagName('HEAD')[0] || 
document.getElementsByTagName('BODY')[0]).appendChild(s);
 +      }());
 +  </script>
 +  <noscript>Please enable JavaScript to view the <a 
href="http://disqus.com/?ref_noscript";>comments powered by 
Disqus.</a></noscript>
 +
 +
 +
 +
 +
 +
 +  </body>
 +</html>

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/blob/af2718af/content/docs/best-practice-namesvr/index.html
----------------------------------------------------------------------
diff --cc content/docs/best-practice-namesvr/index.html
index 9643b48,0000000..e178c42
mode 100644,000000..100644
--- a/content/docs/best-practice-namesvr/index.html
+++ b/content/docs/best-practice-namesvr/index.html
@@@ -1,682 -1,0 +1,682 @@@
 +<!doctype html>
 +<html lang="en" class="no-js">
 +  <head>
 +    <meta charset="utf-8">
 +
 +<!-- begin SEO -->
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +<title>Best Practice For NameServer - Apache RocketMQ</title>
 +
 +
 +
 +
 +<meta name="description" content="In Apache RocketMQ, name servers are 
designed to coordinate each component of the distributed systemand the 
coordination is mainly achieved through managing topic routing information.">
 +
 +
 +
 +
 +<meta property="og:locale" content="en">
 +<meta property="og:site_name" content="Apache RocketMQ">
 +<meta property="og:title" content="Best Practice For NameServer">
 +
 +
 +
 +
 +  <meta property="og:description" content="In Apache RocketMQ, name servers 
are designed to coordinate each component of the distributed systemand the 
coordination is mainly achieved through managing topic routing information.">
 +
 +
 +
 +  <meta name="twitter:site" content="@ApacheRocketMQ">
 +  <meta name="twitter:title" content="Best Practice For NameServer">
 +  <meta name="twitter:description" content="In Apache RocketMQ, name servers 
are designed to coordinate each component of the distributed systemand the 
coordination is mainly achieved through managing topic routing information.">
 +  <meta name="twitter:url" content="">
 +
 +  
 +    <meta name="twitter:card" content="summary">
 +    
 +  
 +
 +  
 +
 +
 +
 +  
 +
 +  
 +
 +
 +
 +
 +
 +  <meta property="og:type" content="article">
-   <meta property="article:published_time" content="2017-06-08T17:34:10+08:00">
++  <meta property="article:published_time" content="2017-06-08T18:09:33+08:00">
 +
 +
 +
 +
 +
 +
 +
 +
 +  <script type="application/ld+json">
 +    {
 +      "@context" : "http://schema.org";,
 +      "@type" : "Person",
 +      "name" : "Apache RocketMQ",
 +      "url" : null,
 +      "sameAs" : null
 +    }
 +  </script>
 +
 +
 +
 +  <meta name="google-site-verification" 
content="aand0XZkSGsziuC-UPD4ZJniFD0m0JhGx6820y2mAQY" />
 +
 +
 +  <meta name="baidu-site-verification" content="wD06EbDRkQ" />
 +
 +
 +
 +
 +<!-- end SEO -->
 +
 +
 +<link href="/feed.xml" type="application/atom+xml" rel="alternate" 
title="Apache RocketMQ 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>
 +
 +<!-- For all browsers -->
 +<link rel="stylesheet" href="/assets/css/main.css">
 +
 +<meta http-equiv="cleartype" content="on">
 +    <!-- start custom head snippets -->
 +
 +<!-- insert favicons. use http://realfavicongenerator.net/ -->
 +
 +<!-- 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">
 +        <button><div class="navicon"></div></button>
 +        <ul class="visible-links">
 +          <li class="masthead__menu-item masthead__menu-item--lg"><a 
href="/">Apache RocketMQ</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/docs/quick-start/">Documentation</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/year-archive/">Blog</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/community/">Community</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/customer/">Customer</a></li>
 +          
 +            
 +            <li class="masthead__menu-item"><a 
href="/about/team/">About</a></li>
 +          
 +        </ul>
 +        <ul class="hidden-links hidden"></ul>
 +      </nav>
 +    </div>
 +  </div>
 +</div>
 +
 +    
 +
 +
 +
 +<div id="main" role="main">
 +  
 +  <div class="sidebar sticky">
 +  
 +  
 +    
 +      
 +      
 +      
 +    
 +    
 +      
 +
 +<nav class="nav__list">
 +  
 +  <input id="ac-toc" name="accordion-toc" type="checkbox" />
 +  <label for="ac-toc">Toggle Menu</label>
 +  <ul class="nav__items">
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">User Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/motivation/" class="">Why RocketMQ</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/quick-start/" class="">Quick Start</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/simple-example/" class="">Simple 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/order-example/" class="">Order Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/broadcast-example/" class="">Broadcasting 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/schedule-example/" class="">Schedule 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/batch-example/" class="">Batch Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/filter-by-sql92-example/" class="">Filter 
Example</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/faq/" class="">FAQ</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Deployment & Operations</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-arc/" class="">Architecture</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/rmq-deployment/" class="">Deployment</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/cli-admin-tool/" class="">CLI Admin 
Tool</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Contributor Guide</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/code-guidelines/" class="">Code 
Guidelines</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/pull-request/" class="">Manage Pull 
Request</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/release-manual" class="">Release 
Manual</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Best Practice</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/core-concept/" class="">Core Concept</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-broker/" class="">Broker</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-producer/" 
class="">Producer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-consumer/" 
class="">Consumer</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/docs/best-practice-namesvr/" 
class="active">NameServer</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          <span class="nav__sub-title">Release Notes</span>
 +        
 +
 +        
 +        <ul>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/dowloading/releases/" class="">Download</a></li>
 +          
 +            
 +            
 +
 +            
 +            
 +
 +            <li><a href="/release_notes/release-notes-4.0.0-incubating/" 
class="">4.0.0-incubating</a></li>
 +          
 +        </ul>
 +        
 +      </li>
 +    
 +      <li>
 +        
 +          
 +          
 +
 +          <a href="/docs/roadmap/"><span 
class="nav__sub-title">RoadMap</span></a>
 +        
 +
 +        
 +      </li>
 +    
 +  </ul>
 +</nav>
 +    
 +  
 +  </div>
 +
 +
 +  <article class="page" itemscope itemtype="http://schema.org/CreativeWork";>
 +    <meta itemprop="headline" content="Best Practice For NameServer">
 +    <meta itemprop="description" content="In Apache RocketMQ, name servers 
are designed to coordinate each component of the distributed systemand the 
coordination is mainly achieved through managing topic routing information.">
 +    <meta itemprop="datePublished" content="June 08, 2017">
 +    <meta itemprop="dateModified" content="December 24, 2016">
 +
 +    <div class="page__inner-wrap">
 +      
 +        <header>
 +          <h1 class="page__title" itemprop="headline">Best Practice For 
NameServer
 +</h1>
 +          
 +        </header>
 +      
 +
 +      <section class="page__content" itemprop="text">
 +        <p>In Apache RocketMQ, name servers are designed to coordinate each 
component of the distributed system
 +and the coordination is mainly achieved through managing topic routing 
information.</p>
 +
 +<aside class="sidebar__right">
 +<nav class="toc">
 +    <header><h4 class="nav__title"><i class="fa fa-file-text"></i> On This 
Page</h4></header>
 +<ul class="toc__menu" id="markdown-toc">
 +  <li><a href="#programmatic-way" 
id="markdown-toc-programmatic-way">Programmatic Way</a></li>
 +  <li><a href="#java-options" id="markdown-toc-java-options">Java 
Options</a></li>
 +  <li><a href="#environment-variable" 
id="markdown-toc-environment-variable">Environment Variable</a></li>
 +  <li><a href="#http-endpoint" id="markdown-toc-http-endpoint">HTTP 
Endpoint</a></li>
 +  <li><a href="#priority" id="markdown-toc-priority">Priority</a></li>
 +</ul>
 +
 +  </nav>
 +</aside>
 +
 +<p>Management consists of two parts:</p>
 +<ul>
 +  <li>Brokers periodically renew meta data kept in every name server.</li>
 +  <li>Name servers are serving clients, including producers, consumers and 
command line clients with the latest routing information.</li>
 +</ul>
 +
 +<p>Therefore, before launching brokers and clients, we need to tell them how 
to reach name servers by feeding them with a name server address list.
 +In Apache RocketMQ, this can be done in four ways.</p>
 +
 +<h2 id="programmatic-way">Programmatic Way</h2>
 +
 +<p>For brokers, we can specify <code 
class="highlighter-rouge">namesrvAddr=name-server-ip1:port;name-server-ip2:port</code>
 in broker configuration file.</p>
 +
 +<p>For producers and consumers, we can feed name server address list to them 
as follows:</p>
 +
 +<div class="language-java highlighter-rouge"><pre 
class="highlight"><code><span class="n">DefaultMQProducer</span> <span 
class="n">producer</span> <span class="o">=</span> <span class="k">new</span> 
<span class="n">DefaultMQProducer</span><span class="o">(</span><span 
class="s">"please_rename_unique_group_name"</span><span class="o">);</span>
 +<span class="n">producer</span><span class="o">.</span><span 
class="na">setNamesrvAddr</span><span class="o">(</span><span 
class="s">"name-server1-ip:port;name-server2-ip:port"</span><span 
class="o">);</span>
 +
 +<span class="n">DefaultMQPushConsumer</span> <span class="n">consumer</span> 
<span class="o">=</span> <span class="k">new</span> <span 
class="n">DefaultMQPushConsumer</span><span class="o">(</span><span 
class="s">"please_rename_unique_group_name"</span><span class="o">);</span>
 +<span class="n">consumer</span><span class="o">.</span><span 
class="na">setNamesrvAddr</span><span class="o">(</span><span 
class="s">"name-server1-ip:port;name-server2-ip:port"</span><span 
class="o">);</span>
 +</code></pre>
 +</div>
 +
 +<p>If you use admin command line from shell, you can also specify this 
way:</p>
 +
 +<div class="language-bash highlighter-rouge"><pre class="highlight"><code>sh 
mqadmin <span class="nb">command</span>-name -n 
name-server-ip1:port;name-server-ip2:port -X OTHER-OPTION
 +</code></pre>
 +</div>
 +
 +<p>A simple example is:
 +<code class="highlighter-rouge">sh mqadmin -n localhost:9876 
clusterList</code>
 +assuming to query cluster info on the name server node.</p>
 +
 +<p>If you have integrated admin tool into your own dashboard, you can:</p>
 +
 +<div class="language-java highlighter-rouge"><pre 
class="highlight"><code><span class="n">DefaultMQAdminExt</span> <span 
class="n">defaultMQAdminExt</span> <span class="o">=</span> <span 
class="k">new</span> <span class="n">DefaultMQAdminExt</span><span 
class="o">(</span><span class="s">"please_rename_unique_group_name"</span><span 
class="o">);</span>
 +<span class="n">defaultMQAdminExt</span><span class="o">.</span><span 
class="na">setNamesrvAddr</span><span class="o">(</span><span 
class="s">"name-server1-ip:port;name-server2-ip:port"</span><span 
class="o">);</span>
 +</code></pre>
 +</div>
 +
 +<h2 id="java-options">Java Options</h2>
 +
 +<p>Name server address list may also be fed to your application through 
specifying the sequel java option 
 +<code class="highlighter-rouge">rocketmq.namesrv.addr</code> before 
launching.</p>
 +
 +<h2 id="environment-variable">Environment Variable</h2>
 +
 +<p>You can export <code class="highlighter-rouge">NAMESRV_ADDR</code> 
environment variable. Brokers and clients will examine and use its value if 
set.</p>
 +
 +<h2 id="http-endpoint">HTTP Endpoint</h2>
 +
 +<p>If you do not specify name server address list using previously mentioned 
methods, Apache RocketMQ will access
 + the following HTTP end point to acquire and update name server address list 
every two minutes with initial delay of
 + ten seconds.</p>
 +
 +<p>By default, the end point is:</p>
 +
 +<p><code 
class="highlighter-rouge">http://jmenv.tbsite.net:8080/rocketmq/nsaddr</code></p>
 +
 +<p>You may override <code class="highlighter-rouge">jmenv.tbsite.net</code> 
using this Java option: <code 
class="highlighter-rouge">rocketmq.namesrv.domain</code>,
 +You may also override <code class="highlighter-rouge">nsaddr</code> part 
using this Java option: <code 
class="highlighter-rouge">rocketmq.namesrv.domain.subgroup</code></p>
 +
 +<p>If you are running Apache RocketMQ in production, this method is 
recommended because it gives you maximum flexibility
 + – you can dynamically add or remove name server nodes without necessity of 
rebooting your brokers and clients 
 + according to your name servers’ system load.</p>
 +
 +<h2 id="priority">Priority</h2>
 +
 +<p>Methods introduced first take precedence over the latter ones: <br />
 +<code class="highlighter-rouge">Programmatic Way &gt; Java Options &gt; 
Environment Variable &gt; HTTP Endpoint</code></p>
 +
 +
 +        
 +      </section>
 +
 +      <footer class="page__meta">
 +        
 +        
 +
 +
 +        
 +          <p class="page__date"><strong><i class="fa fa-fw fa-calendar" 
aria-hidden="true"></i> Updated:</strong> <time datetime="2016-12-24">December 
24, 2016</time></p>
 +        
 +      </footer>
 +
 +      <section class="page__share">
 +  
 +    <h4 class="page__share-title">Share on</h4>
 +  
 +
 +  <a href="https://twitter.com/intent/tweet?via=ApacheRocketMQ&text=Best 
Practice For NameServer /docs/best-practice-namesvr/" 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/best-practice-namesvr/";
 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/best-practice-namesvr/"; 
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/best-practice-namesvr/";
 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="/docs/create-pull-request/" class="pagination--pager" 
title="How to create Pull Request
 +">Previous</a>
 +    
 +    
 +      <a href="/docs/best-practice-producer/" class="pagination--pager" 
title="Best Practice For Producer
 +">Next</a>
 +    
 +  </nav>
 +
 +    </div>
 +
 +    
 +      <div class="page__comments">
 +  
 +  
 +    <h4 class="page__comments-title">Leave a Comment</h4>
 +    <section id="disqus_thread"></section>
 +  
 +</div>
 +    
 +  </article>
 +
 +  
 +  
 +</div>
 +
 +    <div class="page__footer">
 +      <footer>
 +        <!-- start custom footer snippets -->
 +
 +<!-- end custom footer snippets -->
 +        <style type="text/css">
 +  div.columns   { float: left; margin-left: 10px;}
 +  div.clear     { clear: both; } 
 +</style>
 +<div>
 +  <div class="columns">
 +    <a href="https://www.apache.org/";><img 
src="/assets/images/feather-small.gif" alt="Apache Software Foundation" 
style="height: 88px !important" /></a>
 +  </div>
 +  <div class="columns" style="width: 80%">
 +    <div class="page__footer-follow">
 +      <ul class="social-icons">
 +        
 +          <li><strong>Follow:</strong></li>
 +        
 +        
 +          <li><a href="https://twitter.com/ApacheRocketMQ";><i class="fa fa-fw 
fa-twitter-square" aria-hidden="true"></i> Twitter</a></li>
 +        
 +        
 +        
 +          <li><a href="http://github.com/apache/incubator-rocketmq";><i 
class="fa fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
 +        
 +        
 +        <li><a href="/feed.xml"><i class="fa fa-fw fa-rss-square" 
aria-hidden="true"></i> Feed</a></li>
 +      </ul>
 +    </div>
 +
 +    <div class="page__footer-copyright">Copyright &copy; 2017 <a 
href="http://www.apache.org/";>The Apache Software Foundation</a>. All Rights 
Reserved.</div>
 +  </div>
 +</div>
 +<div class="clear"></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','//www.google-analytics.com/analytics.js','ga');
 +
 +  ga('create', 'UA-89603173-1', 'auto');
 +  ga('send', 'pageview');
 +</script>
 +
 +<script>
 +var _hmt = _hmt || [];
 +(function() {
 +  var hm = document.createElement("script");
 +  hm.src = "https://hm.baidu.com/hm.js?36428f2b841d08e7405724cbf7f860d2";;
 +  var s = document.getElementsByTagName("script")[0]; 
 +  s.parentNode.insertBefore(hm, s);
 +})();
 +</script>
 +
 +
 +
 +
 +  
 +  <script type="text/javascript">
 +      /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * 
* */
 +      var disqus_shortname = 'rocketmq';
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function() {
 +              var dsq = document.createElement('script'); dsq.type = 
'text/javascript'; dsq.async = true;
 +              dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
 +              (document.getElementsByTagName('head')[0] || 
document.getElementsByTagName('body')[0]).appendChild(dsq);
 +      })();
 +
 +      /* * * DON'T EDIT BELOW THIS LINE * * */
 +      (function () {
 +              var s = document.createElement('script'); s.async = true;
 +              s.type = 'text/javascript';
 +              s.src = '//' + disqus_shortname + '.disqus.com/count.js';
 +              (document.getElementsByTagName('HEAD')[0] || 
document.getElementsByTagName('BODY')[0]).appendChild(s);
 +      }());
 +  </script>
 +  <noscript>Please enable JavaScript to view the <a 
href="http://disqus.com/?ref_noscript";>comments powered by 
Disqus.</a></noscript>
 +
 +
 +
 +
 +
 +
 +  </body>
 +</html>

Reply via email to