nats.zig/deps/nats.c/doc/html/group__js_pub_group.html

529 lines
34 KiB
HTML
Raw Normal View History

<!-- HTML header for doxygen 1.8.10-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<title>NATS C Client with JetStream and Streaming support: Publishing</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="customdoxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;" >
<div id="projectname">NATS C Client with JetStream and Streaming support
&#160;<span id="projectnumber">3.7.0</span>
</div>
<div id="projectbrief">The nats.io C Client, Supported by Synadia Communications Inc.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__js_pub_group.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">Publishing<div class="ingroups"><a class="el" href="group__func_group.html">Functions</a> &raquo; <a class="el" href="group__js_group.html">JetStream</a></div></div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaf09f333a8675a8060c5ede07a6bdeef9" id="r_gaf09f333a8675a8060c5ede07a6bdeef9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#gaf09f333a8675a8060c5ede07a6bdeef9">jsPubOptions_Init</a> (<a class="el" href="structjs_pub_options.html">jsPubOptions</a> *opts)</td></tr>
<tr class="memdesc:gaf09f333a8675a8060c5ede07a6bdeef9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes a publish options structure. <br /></td></tr>
<tr class="separator:gaf09f333a8675a8060c5ede07a6bdeef9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac6ba005531c82d9f0efa88dd6b458477" id="r_gac6ba005531c82d9f0efa88dd6b458477"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#gac6ba005531c82d9f0efa88dd6b458477">js_Publish</a> (<a class="el" href="structjs_pub_ack.html">jsPubAck</a> **pubAck, <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *js, const char *subj, const void *data, int dataLen, <a class="el" href="structjs_pub_options.html">jsPubOptions</a> *opts, <a class="el" href="status_8h.html#a10731415ffcd3e2330df10c4d5fd3d70">jsErrCode</a> *errCode)</td></tr>
<tr class="memdesc:gac6ba005531c82d9f0efa88dd6b458477"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes data on a subject to JetStream. <br /></td></tr>
<tr class="separator:gac6ba005531c82d9f0efa88dd6b458477"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2aceeb82fac3621aea843dd246732bdd" id="r_ga2aceeb82fac3621aea843dd246732bdd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#ga2aceeb82fac3621aea843dd246732bdd">js_PublishMsg</a> (<a class="el" href="structjs_pub_ack.html">jsPubAck</a> **pubAck, <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *js, <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> *msg, <a class="el" href="structjs_pub_options.html">jsPubOptions</a> *opts, <a class="el" href="status_8h.html#a10731415ffcd3e2330df10c4d5fd3d70">jsErrCode</a> *errCode)</td></tr>
<tr class="memdesc:ga2aceeb82fac3621aea843dd246732bdd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes a message to JetStream. <br /></td></tr>
<tr class="separator:ga2aceeb82fac3621aea843dd246732bdd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaac130840b6db9109e72cf6ad9186dfc4" id="r_gaac130840b6db9109e72cf6ad9186dfc4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#gaac130840b6db9109e72cf6ad9186dfc4">jsPubAck_Destroy</a> (<a class="el" href="structjs_pub_ack.html">jsPubAck</a> *pubAck)</td></tr>
<tr class="memdesc:gaac130840b6db9109e72cf6ad9186dfc4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys the publish acknowledgment object. <br /></td></tr>
<tr class="separator:gaac130840b6db9109e72cf6ad9186dfc4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga069dfd6f0f3d96f1ff8bf2372e59900c" id="r_ga069dfd6f0f3d96f1ff8bf2372e59900c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#ga069dfd6f0f3d96f1ff8bf2372e59900c">js_PublishAsync</a> (<a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *js, const char *subj, const void *data, int dataLen, <a class="el" href="structjs_pub_options.html">jsPubOptions</a> *opts)</td></tr>
<tr class="memdesc:ga069dfd6f0f3d96f1ff8bf2372e59900c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes data to JetStream but does not wait for a <a class="el" href="structjs_pub_ack.html">jsPubAck</a>. <br /></td></tr>
<tr class="separator:ga069dfd6f0f3d96f1ff8bf2372e59900c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab7e4139a48c5ee4d2155cbb43142e873" id="r_gab7e4139a48c5ee4d2155cbb43142e873"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#gab7e4139a48c5ee4d2155cbb43142e873">js_PublishMsgAsync</a> (<a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *js, <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **msg, <a class="el" href="structjs_pub_options.html">jsPubOptions</a> *opts)</td></tr>
<tr class="memdesc:gab7e4139a48c5ee4d2155cbb43142e873"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes a message to JetStream but does not wait for a <a class="el" href="structjs_pub_ack.html">jsPubAck</a>. <br /></td></tr>
<tr class="separator:gab7e4139a48c5ee4d2155cbb43142e873"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga24813ee9a58f00c0f21d10ab9c93b81d" id="r_ga24813ee9a58f00c0f21d10ab9c93b81d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#ga24813ee9a58f00c0f21d10ab9c93b81d">js_PublishAsyncComplete</a> (<a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *js, <a class="el" href="structjs_pub_options.html">jsPubOptions</a> *opts)</td></tr>
<tr class="memdesc:ga24813ee9a58f00c0f21d10ab9c93b81d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait for all outstanding messages to be acknowledged. <br /></td></tr>
<tr class="separator:ga24813ee9a58f00c0f21d10ab9c93b81d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2ac95a3450f77f8074fae3f2fbe7e54c" id="r_ga2ac95a3450f77f8074fae3f2fbe7e54c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__js_pub_group.html#ga2ac95a3450f77f8074fae3f2fbe7e54c">js_PublishAsyncGetPendingList</a> (<a class="el" href="structnats_msg_list.html">natsMsgList</a> *pending, <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *js)</td></tr>
<tr class="memdesc:ga2ac95a3450f77f8074fae3f2fbe7e54c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the list of pending messages published asynchronously. <br /></td></tr>
<tr class="separator:ga2ac95a3450f77f8074fae3f2fbe7e54c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Publishing functions </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaf09f333a8675a8060c5ede07a6bdeef9" name="gaf09f333a8675a8060c5ede07a6bdeef9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf09f333a8675a8060c5ede07a6bdeef9">&#9670;&#160;</a></span>jsPubOptions_Init()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> jsPubOptions_Init </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structjs_pub_options.html">jsPubOptions</a> *&#160;</td>
<td class="paramname"><em>opts</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Use this before setting specific publish options and passing this configuration to the JetStream publish APIs.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">opts</td><td>the pointer to the <a class="el" href="structjs_pub_options.html">jsPubOptions</a> to initialize. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gac6ba005531c82d9f0efa88dd6b458477" name="gac6ba005531c82d9f0efa88dd6b458477"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac6ba005531c82d9f0efa88dd6b458477">&#9670;&#160;</a></span>js_Publish()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> js_Publish </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structjs_pub_ack.html">jsPubAck</a> **&#160;</td>
<td class="paramname"><em>pubAck</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *&#160;</td>
<td class="paramname"><em>js</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>subj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>dataLen</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structjs_pub_options.html">jsPubOptions</a> *&#160;</td>
<td class="paramname"><em>opts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="status_8h.html#a10731415ffcd3e2330df10c4d5fd3d70">jsErrCode</a> *&#160;</td>
<td class="paramname"><em>errCode</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Publishes the data to the given subject to JetStream.</p>
<p>See <a class="el" href="group__js_pub_group.html#ga2aceeb82fac3621aea843dd246732bdd" title="Publishes a message to JetStream.">js_PublishMsg</a> for details.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">pubAck</td><td>the location where to store the pub acknowledgment, or <code>NULL</code> if not needed. </td></tr>
<tr><td class="paramname">js</td><td>the pointer to the <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><td class="paramname">subj</td><td>the subject the data is sent to. </td></tr>
<tr><td class="paramname">data</td><td>the data to be sent, can be <code>NULL</code>. </td></tr>
<tr><td class="paramname">dataLen</td><td>the length of the data to be sent. </td></tr>
<tr><td class="paramname">opts</td><td>the publish options, possibly <code>NULL</code>. </td></tr>
<tr><td class="paramname">errCode</td><td>the location where to store the JetStream specific error code, or <code>NULL</code> if not needed. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga2aceeb82fac3621aea843dd246732bdd" name="ga2aceeb82fac3621aea843dd246732bdd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2aceeb82fac3621aea843dd246732bdd">&#9670;&#160;</a></span>js_PublishMsg()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> js_PublishMsg </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structjs_pub_ack.html">jsPubAck</a> **&#160;</td>
<td class="paramname"><em>pubAck</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *&#160;</td>
<td class="paramname"><em>js</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> *&#160;</td>
<td class="paramname"><em>msg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structjs_pub_options.html">jsPubOptions</a> *&#160;</td>
<td class="paramname"><em>opts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="status_8h.html#a10731415ffcd3e2330df10c4d5fd3d70">jsErrCode</a> *&#160;</td>
<td class="paramname"><em>errCode</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Publishes the given message to JetStream.</p>
<dl class="section note"><dt>Note</dt><dd>If you are not interested in inspecting the publish acknowledgment, you can pass <code>NULL</code>, but keep in mind that the publish acknowledgment is still sent by the server. </dd>
<dd>
The returned <a class="el" href="structjs_pub_ack.html">jsPubAck</a> object needs to be destroyed with <a class="el" href="group__js_pub_group.html#gaac130840b6db9109e72cf6ad9186dfc4" title="Destroys the publish acknowledgment object.">jsPubAck_Destroy</a> when no longer needed.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__js_pub_group.html#gaac130840b6db9109e72cf6ad9186dfc4" title="Destroys the publish acknowledgment object.">jsPubAck_Destroy</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">pubAck</td><td>the location where to store the pub acknowledgment, or <code>NULL</code> if not needed. </td></tr>
<tr><td class="paramname">js</td><td>the pointer to the <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><td class="paramname">msg</td><td>the pointer to the <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a" title="A structure holding a subject, optional reply and payload.">natsMsg</a> object to send. </td></tr>
<tr><td class="paramname">opts</td><td>the publish options, possibly <code>NULL</code>. </td></tr>
<tr><td class="paramname">errCode</td><td>the location where to store the JetStream specific error code, or <code>NULL</code> if not needed. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gaac130840b6db9109e72cf6ad9186dfc4" name="gaac130840b6db9109e72cf6ad9186dfc4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaac130840b6db9109e72cf6ad9186dfc4">&#9670;&#160;</a></span>jsPubAck_Destroy()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> void jsPubAck_Destroy </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structjs_pub_ack.html">jsPubAck</a> *&#160;</td>
<td class="paramname"><em>pubAck</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Releases memory allocated for this publish acknowledgment object.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">pubAck</td><td>the <a class="el" href="structjs_pub_ack.html">jsPubAck</a> object to destroy. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga069dfd6f0f3d96f1ff8bf2372e59900c" name="ga069dfd6f0f3d96f1ff8bf2372e59900c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga069dfd6f0f3d96f1ff8bf2372e59900c">&#9670;&#160;</a></span>js_PublishAsync()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> js_PublishAsync </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *&#160;</td>
<td class="paramname"><em>js</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>subj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>dataLen</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structjs_pub_options.html">jsPubOptions</a> *&#160;</td>
<td class="paramname"><em>opts</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>See <a class="el" href="group__js_pub_group.html#gab7e4139a48c5ee4d2155cbb43142e873" title="Publishes a message to JetStream but does not wait for a jsPubAck.">js_PublishMsgAsync</a> for details.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">js</td><td>the pointer to the <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><td class="paramname">subj</td><td>the subject the data is sent to. </td></tr>
<tr><td class="paramname">data</td><td>the data to be sent, can be <code>NULL</code>. </td></tr>
<tr><td class="paramname">dataLen</td><td>the length of the data to be sent. </td></tr>
<tr><td class="paramname">opts</td><td>the publish options, possibly <code>NULL</code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gab7e4139a48c5ee4d2155cbb43142e873" name="gab7e4139a48c5ee4d2155cbb43142e873"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab7e4139a48c5ee4d2155cbb43142e873">&#9670;&#160;</a></span>js_PublishMsgAsync()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> js_PublishMsgAsync </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *&#160;</td>
<td class="paramname"><em>js</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **&#160;</td>
<td class="paramname"><em>msg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structjs_pub_options.html">jsPubOptions</a> *&#160;</td>
<td class="paramname"><em>opts</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Publishes a message asynchronously to JetStream. User can call <a class="el" href="group__js_pub_group.html#ga24813ee9a58f00c0f21d10ab9c93b81d" title="Wait for all outstanding messages to be acknowledged.">js_PublishAsyncComplete</a> to be notified when all publish acknowledgments for the pending publish calls have been received.</p>
<dl class="section note"><dt>Note</dt><dd>If this call is successful, the library takes ownership of the message and will destroy it after the acknowledgment has been received, or will present it to the user through the <a class="el" href="group__callbacks_group.html#ga954768cc1d3388bb6ab723e777647992" title="Callback used to process asynchronous publish errors from JetStream.">jsPubAckErrHandler</a> callback. To prevent the user from accessing/destroying the message while in use by the library, this function requires a pointer to the pointer of the message so that it can be cleared. That way, the user should always call <a class="el" href="group__msg_group.html#ga9e9590018284939f43f60964283f33ae" title="Destroys the message object.">natsMsg_Destroy</a>, regardless of success or failure, since <a class="el" href="group__msg_group.html#ga9e9590018284939f43f60964283f33ae" title="Destroys the message object.">natsMsg_Destroy</a> will have no effect if the message pointer is <code>NULL</code>.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__js_pub_group.html#ga24813ee9a58f00c0f21d10ab9c93b81d" title="Wait for all outstanding messages to be acknowledged.">js_PublishAsyncComplete</a> </dd>
<dd>
<a class="el" href="group__callbacks_group.html#ga954768cc1d3388bb6ab723e777647992" title="Callback used to process asynchronous publish errors from JetStream.">jsPubAckErrHandler</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">js</td><td>the pointer to the <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><td class="paramname">msg</td><td>the memory location where the pointer to the <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a" title="A structure holding a subject, optional reply and payload.">natsMsg</a> object is located. If the library takes ownership of the message, this location will be cleared so a following call to <a class="el" href="group__msg_group.html#ga9e9590018284939f43f60964283f33ae" title="Destroys the message object.">natsMsg_Destroy</a> would have no effect. </td></tr>
<tr><td class="paramname">opts</td><td>the publish options, possibly <code>NULL</code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga24813ee9a58f00c0f21d10ab9c93b81d" name="ga24813ee9a58f00c0f21d10ab9c93b81d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga24813ee9a58f00c0f21d10ab9c93b81d">&#9670;&#160;</a></span>js_PublishAsyncComplete()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> js_PublishAsyncComplete </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *&#160;</td>
<td class="paramname"><em>js</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structjs_pub_options.html">jsPubOptions</a> *&#160;</td>
<td class="paramname"><em>opts</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This call will block until the library has received acknowledgment for all outstanding published messages.</p>
<p>To limit the wait, user can pass a <a class="el" href="structjs_pub_options.html">jsPubOptions</a> with a <code>MaxWait</code> set to the maximum number of milliseconds that the call should block.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">js</td><td>the pointer to the <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><td class="paramname">opts</td><td>the publish options, possibly <code>NULL</code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga2ac95a3450f77f8074fae3f2fbe7e54c" name="ga2ac95a3450f77f8074fae3f2fbe7e54c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2ac95a3450f77f8074fae3f2fbe7e54c">&#9670;&#160;</a></span>js_PublishAsyncGetPendingList()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> js_PublishAsyncGetPendingList </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structnats_msg_list.html">natsMsgList</a> *&#160;</td>
<td class="paramname"><em>pending</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> *&#160;</td>
<td class="paramname"><em>js</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This call returns the list of all asynchronously published messages for which no acknowledgment have been received yet.</p>
<p>The user has now back ownership of the messages and can resend send if desired or simply destroy them.</p>
<dl class="section note"><dt>Note</dt><dd>After this call returns, it is possible that acknowledgments arrive from the server but since they have been removed from the pending list, the acknowledgments will be discarded (no <a class="el" href="group__callbacks_group.html#ga954768cc1d3388bb6ab723e777647992" title="Callback used to process asynchronous publish errors from JetStream.">jsPubAckErrHandler</a> callback invoked). If the server did receive a particular message and the user in the meantime has resent that message, it would be a duplicate, so in order for the server to detect this duplicate, ensure that the stream's duplicate window setting is specified and a unique message ID was set when sending the message.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>The user must call <a class="el" href="group__msg_group.html#ga1a091d24f939d881bf04fba78b8995c2" title="Destroys this list of messages.">natsMsgList_Destroy</a> to release memory allocated by this call and destroy all pending messages still present in the list.</dd></dl>
<div class="fragment"><div class="line">natsMsgList pending;</div>
<div class="line"> </div>
<div class="line">s = js_PublishAsyncGetPendingList(&amp;pending, js);</div>
<div class="line">if (s == NATS_OK)</div>
<div class="line">{</div>
<div class="line"> int i;</div>
<div class="line"> </div>
<div class="line"> for (i=0; i&lt;pending.Count; i++)</div>
<div class="line"> {</div>
<div class="line"> if (your_decision_to_resend(pending.Msgs[i]))</div>
<div class="line"> {</div>
<div class="line"> // If the call is successful, pending.Msgs[i] will</div>
<div class="line"> // be set to NULL so the message will not be</div>
<div class="line"> // destroyed.</div>
<div class="line"> js_PublishMsgAsync(js, &amp;(pending.Msgs[i]), NULL);</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> // Calling this will release memory allocated to hold the</div>
<div class="line"> // array of messages but also call natsMsg_Destroy on all</div>
<div class="line"> // messages still present in the array.</div>
<div class="line"> natsMsgList_Destroy(&amp;pending);</div>
<div class="line">}</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">pending</td><td>pointer to a <a class="el" href="structnats_msg_list.html" title="A list of NATS messages.">natsMsgList</a> object, typically defined on the stack. </td></tr>
<tr><td class="paramname">js</td><td>the pointer to the <a class="el" href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">NATS.IO Supported By Synadia Communications Inc.
<a href="http://www.nats.io">
</a></li>
</ul>
</div>
</body>
</html>