rmq-wrapper
Version:
673 lines (175 loc) • 7.77 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: rmq-wrapper</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: rmq-wrapper</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description"><p>Utility functions for connecting, producing and consuming messages on RMQ</p></div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line1">line 1</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="~consume"><span class="type-signature">(inner, constant) </span>consume<span class="type-signature"></span></h4>
<div class="description">
<p>This method connects to a queue and calls the provided callback consumeFunction when a message is received on the queue</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="~cancel"><span class="type-signature">(inner) </span>cancel<span class="signature">(queue)</span><span class="type-signature"> → {Promise}</span></h4>
<div class="description">
<p>This tells RMQ to stop announcing new messages, so the callback consumeFunction is no longer called. The queue should be re-connected to restart message delivery.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>queue</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>name of the queue to listen on</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line90">line 90</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<span class="param-type">exception</span>
</div>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved when the queue was cancelled</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="~produce"><span class="type-signature">(async, inner) </span>produce<span class="signature">(queue, message, persistent<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
<div class="description">
<p>This produces a message on RMQ, assumes that the connect() method was previously called</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>queue</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>name of the queue to listen on</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>stringified text to be put on the queue</p></td>
</tr>
<tr>
<td class="name"><code>persistent</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
"true"
</td>
<td class="description last"><p>if true the message is stored peristently on the queue</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line72">line 72</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<span class="param-type">exception</span>
</div>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved when the message was produced on the queue</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-rmq-wrapper.html">rmq-wrapper</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Wed May 22 2019 11:39:36 GMT+0100 (British Summer Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>