Commit e1a6c421 authored by Clovis NZOUENDJOU's avatar Clovis NZOUENDJOU
Browse files

Adding the documentation of the Queue Module

parent 0d9e6ce98cd1
......@@ -55,6 +55,19 @@
<div class="viewcode-block" id="AnybusQueue"><a class="viewcode-back" href="../../../../technical_doc/anybus.html#openerp.addons.anybus.queue.AnybusQueue">[docs]</a><span class="k">class</span> <span class="nc">AnybusQueue</span><span class="p">(</span><span class="n">osv</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This class overrides the Entity class and adds the spéfiques fields</span>
<span class="sd"> for the handling of Queue.</span>
<span class="sd"> .. Warning::</span>
<span class="sd"> The name of the Entity (Exchange and Queue) must be unique !</span>
<span class="sd"> .. Note::</span>
<span class="sd"> ``Queue`` is the point of consumption of messages as well as for exchanges,</span>
<span class="sd"> it is possible to have multiple consumers on the same queue.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">_name</span> <span class="o">=</span> <span class="s">&#39;anybus.entity.queue&#39;</span>
<span class="n">_description</span> <span class="o">=</span> <span class="s">&#39;anybus queue&#39;</span>
<span class="n">_inherit</span> <span class="o">=</span> <span class="s">&#39;abstract.anybus.entity&#39;</span>
......@@ -78,6 +91,15 @@
<span class="k">def</span> <span class="nf">_get_entity</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">queue</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">binding</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; This function return an entity containing the informations</span>
<span class="sd"> of queue, binding, exchange and channel</span>
<span class="sd"> :param queue: Object Queue</span>
<span class="sd"> :param channel: Object Channel</span>
<span class="sd"> :param binding: Object Binding</span>
<span class="sd"> :return: Object Queue</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_entity_name</span><span class="p">(</span><span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">queue</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
<span class="k">if</span> <span class="n">context</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">context</span> <span class="o">=</span> <span class="p">{}</span>
......@@ -126,6 +148,12 @@
<span class="k">def</span> <span class="nf">_get_already_declared_entity</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">queue</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span>
<span class="n">context</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; This function return declared entity</span>
<span class="sd"> :param queue: Object Queue</span>
<span class="sd"> :param channel: Object Channel</span>
<span class="sd"> :return: Object Queue</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_entity_name</span><span class="p">(</span><span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">queue</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Queue</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
......@@ -151,6 +179,12 @@
<span class="n">write</span><span class="o">=</span><span class="p">{},</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="AnybusQueue.get"><a class="viewcode-back" href="../../../../technical_doc/anybus.html#openerp.addons.anybus.queue.AnybusQueue.get">[docs]</a> <span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This function looks for messages on a queue and returns</span>
<span class="sd"> the body of the various messages</span>
<span class="sd"> :param id: id of Queue</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">queue</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">browse</span><span class="p">(</span><span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
<span class="n">queue_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_entity_name</span><span class="p">(</span><span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
<span class="n">uri</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pool</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;anybus.connection&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">_get_uri</span><span class="p">(</span>
......@@ -166,6 +200,17 @@
</div></div>
<div class="viewcode-block" id="AnybusBinding"><a class="viewcode-back" href="../../../../technical_doc/anybus.html#openerp.addons.anybus.queue.AnybusBinding">[docs]</a><span class="k">class</span> <span class="nc">AnybusBinding</span><span class="p">(</span><span class="n">osv</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The Binding defines the path taken by the message</span>
<span class="sd"> A binding is a relationship between an exchange and a queue.</span>
<span class="sd"> This can be simply read as: the queue is interested in messages from this exchange</span>
<span class="sd"> .. Note::</span>
<span class="sd"> Bindings can take an extra ``routing_key`` parameter. To avoid the confusion with</span>
<span class="sd"> a ``basic_publish`` parameter we&#39;re going to call it a ``binding key``.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">_name</span> <span class="o">=</span> <span class="s">&#39;anybus.binding&#39;</span>
<span class="n">_description</span> <span class="o">=</span> <span class="s">&#39;anybus binding&#39;</span>
<span class="n">_rec_name</span> <span class="o">=</span> <span class="s">&#39;routing_key&#39;</span>
......@@ -185,6 +230,12 @@
<span class="p">}</span>
<span class="k">def</span> <span class="nf">_get_routing_key</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return the routing key of binding</span>
<span class="sd"> :param id: id of binding</span>
<span class="sd"> :return type: str</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">read</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="p">[</span><span class="s">&#39;routing_key&#39;</span><span class="p">,</span> <span class="s">&#39;queue_id&#39;</span><span class="p">,</span>
<span class="s">&#39;exchange_id&#39;</span><span class="p">],</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">read</span><span class="p">[</span><span class="s">&#39;routing_key&#39;</span><span class="p">]:</span>
......@@ -197,6 +248,12 @@
<span class="k">return</span> <span class="n">read</span><span class="p">[</span><span class="s">&#39;routing_key&#39;</span><span class="p">]</span> <span class="o">%</span> <span class="n">values</span>
<div class="viewcode-block" id="AnybusBinding.name_get"><a class="viewcode-back" href="../../../../technical_doc/anybus.html#openerp.addons.anybus.queue.AnybusBinding.name_get">[docs]</a> <span class="k">def</span> <span class="nf">name_get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cr</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">ids</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Default name_get of binding model.</span>
<span class="sd"> :param ids: list of binding&#39;s ids</span>
<span class="sd"> :return type: list</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">len</span><span class="p">(</span><span class="n">ids</span><span class="p">):</span>
<span class="k">return</span> <span class="p">[]</span>
<span class="n">reads</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">read</span><span class="p">(</span>
......
This diff is collapsed.
......@@ -23,7 +23,10 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Anybus 1.0.1 documentation" href="../index.html" />
<link rel="top" title="Anybus 1.0.1 documentation" href="../index.html" />
<link rel="up" title="anybus" href="modules.html" />
<link rel="next" title="tests Package" href="anybus.tests.html" />
<link rel="prev" title="anybus" href="modules.html" />
</head>
<body>
<div class="related">
......@@ -35,7 +38,14 @@
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Anybus 1.0.1 documentation</a> &raquo;</li>
<li class="right" >
<a href="anybus.tests.html" title="tests Package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="modules.html" title="anybus"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Anybus 1.0.1 documentation</a> &raquo;</li>
<li><a href="modules.html" accesskey="U">anybus</a> &raquo;</li>
</ul>
</div>
......@@ -300,10 +310,29 @@ simply written in the form of dot-separated identifier names.</p>
<dt id="openerp.addons.anybus.queue.AnybusBinding">
<em class="property">class </em><tt class="descclassname">openerp.addons.anybus.queue.</tt><tt class="descname">AnybusBinding</tt><big>(</big><em>pool</em>, <em>cr</em><big>)</big><a class="reference internal" href="../_modules/openerp/addons/anybus/queue.html#AnybusBinding"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#openerp.addons.anybus.queue.AnybusBinding" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">openerp.osv.orm.Model</span></tt></p>
<p>The Binding defines the path taken by the message
A binding is a relationship between an exchange and a queue.
This can be simply read as: the queue is interested in messages from this exchange</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Bindings can take an extra <tt class="docutils literal"><span class="pre">routing_key</span></tt> parameter. To avoid the confusion with
a <tt class="docutils literal"><span class="pre">basic_publish</span></tt> parameter we&#8217;re going to call it a <tt class="docutils literal"><span class="pre">binding</span> <span class="pre">key</span></tt>.</p>
</div>
<dl class="method">
<dt id="openerp.addons.anybus.queue.AnybusBinding.name_get">
<tt class="descname">name_get</tt><big>(</big><em>cr</em>, <em>uid</em>, <em>ids</em>, <em>context=None</em><big>)</big><a class="reference internal" href="../_modules/openerp/addons/anybus/queue.html#AnybusBinding.name_get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#openerp.addons.anybus.queue.AnybusBinding.name_get" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dd><p>Default name_get of binding model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>ids</strong> &#8211; list of binding&#8217;s ids</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">list</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
......@@ -311,6 +340,21 @@ simply written in the form of dot-separated identifier names.</p>
<dt id="openerp.addons.anybus.queue.AnybusQueue">
<em class="property">class </em><tt class="descclassname">openerp.addons.anybus.queue.</tt><tt class="descname">AnybusQueue</tt><big>(</big><em>pool</em>, <em>cr</em><big>)</big><a class="reference internal" href="../_modules/openerp/addons/anybus/queue.html#AnybusQueue"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#openerp.addons.anybus.queue.AnybusQueue" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">openerp.osv.orm.Model</span></tt></p>
<blockquote>
<div>This class overrides the Entity class and adds the spéfiques fields
for the handling of Queue.</div></blockquote>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<blockquote>
<div>The name of the Entity (Exchange and Queue) must be unique !</div></blockquote>
<div class="last admonition note">
<p class="first admonition-title">Note</p>
<dl class="last docutils">
<dt><tt class="docutils literal"><span class="pre">Queue</span></tt> is the point of consumption of messages as well as for exchanges,</dt>
<dd>it is possible to have multiple consumers on the same queue.</dd>
</dl>
</div>
</div>
<dl class="method">
<dt id="openerp.addons.anybus.queue.AnybusQueue.action_purge">
<tt class="descname">action_purge</tt><big>(</big><em>cr</em>, <em>uid</em>, <em>ids</em>, <em>context=None</em><big>)</big><a class="reference internal" href="../_modules/openerp/addons/anybus/queue.html#AnybusQueue.action_purge"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#openerp.addons.anybus.queue.AnybusQueue.action_purge" title="Permalink to this definition"></a></dt>
......@@ -319,7 +363,17 @@ simply written in the form of dot-separated identifier names.</p>
<dl class="method">
<dt id="openerp.addons.anybus.queue.AnybusQueue.get">
<tt class="descname">get</tt><big>(</big><em>cr</em>, <em>uid</em>, <em>id</em>, <em>context=None</em><big>)</big><a class="reference internal" href="../_modules/openerp/addons/anybus/queue.html#AnybusQueue.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#openerp.addons.anybus.queue.AnybusQueue.get" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dd><p>This function looks for messages on a queue and returns
the body of the various messages</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>id</strong> &#8211; id of Queue</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
......@@ -387,6 +441,12 @@ simply written in the form of dot-separated identifier names.</p>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="modules.html"
title="previous chapter">anybus</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="anybus.tests.html"
title="next chapter">tests Package</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/technical_doc/anybus.txt"
......@@ -418,7 +478,14 @@ simply written in the form of dot-separated identifier names.</p>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Anybus 1.0.1 documentation</a> &raquo;</li>
<li class="right" >
<a href="anybus.tests.html" title="tests Package"
>next</a> |</li>
<li class="right" >
<a href="modules.html" title="anybus"
>previous</a> |</li>
<li><a href="../index.html">Anybus 1.0.1 documentation</a> &raquo;</li>
<li><a href="modules.html" >anybus</a> &raquo;</li>
</ul>
</div>
<div class="footer">
......
......@@ -23,7 +23,9 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Anybus 1.0.1 documentation" href="../index.html" />
<link rel="top" title="Anybus 1.0.1 documentation" href="../index.html" />
<link rel="next" title="anybus Package" href="anybus.html" />
<link rel="prev" title="Welcome to Anybus’s documentation!" href="../index.html" />
</head>
<body>
<div class="related">
......@@ -35,6 +37,12 @@
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="anybus.html" title="anybus Package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../index.html" title="Welcome to Anybus’s documentation!"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Anybus 1.0.1 documentation</a> &raquo;</li>
</ul>
</div>
......@@ -198,6 +206,12 @@
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="../index.html"
title="previous chapter">Welcome to Anybus&#8217;s documentation!</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="anybus.html"
title="next chapter">anybus Package</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/technical_doc/modules.txt"
......@@ -229,6 +243,12 @@
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="anybus.html" title="anybus Package"
>next</a> |</li>
<li class="right" >
<a href="../index.html" title="Welcome to Anybus’s documentation!"
>previous</a> |</li>
<li><a href="../index.html">Anybus 1.0.1 documentation</a> &raquo;</li>
</ul>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment