nats.zig/deps/nats.c/doc/html/group__stan_sub_group.html
torque 79a45fd2e3
git subrepo clone (merge) --branch=v3.6.1 https://github.com/nats-io/nats.c.git deps/nats.c
subrepo:
  subdir:   "deps/nats.c"
  merged:   "66cec7f"
upstream:
  origin:   "https://github.com/nats-io/nats.c.git"
  branch:   "v3.6.1"
  commit:   "66cec7f"
git-subrepo:
  version:  "0.4.6"
  commit:   "b8b46501e"
2023-08-15 00:21:33 -07:00

296 lines
19 KiB
HTML

<!-- 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.6"/>
<title>NATS C Client with JetStream and Streaming support: Streaming Subscription</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.6.1</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.6 -->
<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__stan_sub_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">Streaming Subscription<div class="ingroups"><a class="el" href="group__func_group.html">Functions</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:ga7b039908ec45cfc2c16ec61ba8daca9d"><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__stan_sub_group.html#ga7b039908ec45cfc2c16ec61ba8daca9d">stanSubscription_SetOnCompleteCB</a> (<a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *sub, <a class="el" href="group__callbacks_group.html#ga245131e64f1d0dff7edc8ed874a07e9a">natsOnCompleteCB</a> cb, void *closure)</td></tr>
<tr class="memdesc:ga7b039908ec45cfc2c16ec61ba8daca9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a completion callback. <br /></td></tr>
<tr class="separator:ga7b039908ec45cfc2c16ec61ba8daca9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3a1cca9fa3ea54fcf7a43fd1335a26d3"><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__stan_sub_group.html#ga3a1cca9fa3ea54fcf7a43fd1335a26d3">stanSubscription_AckMsg</a> (<a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *sub, <a class="el" href="group__types_group.html#ga2cf5db7703b42d97abe56a3e83b2a87d">stanMsg</a> *msg)</td></tr>
<tr class="memdesc:ga3a1cca9fa3ea54fcf7a43fd1335a26d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Acknowledge a message. <br /></td></tr>
<tr class="separator:ga3a1cca9fa3ea54fcf7a43fd1335a26d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafa428a7e0f6800216cb06fd738bd235e"><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__stan_sub_group.html#gafa428a7e0f6800216cb06fd738bd235e">stanSubscription_Unsubscribe</a> (<a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *sub)</td></tr>
<tr class="memdesc:gafa428a7e0f6800216cb06fd738bd235e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Permanently remove a subscription. <br /></td></tr>
<tr class="separator:gafa428a7e0f6800216cb06fd738bd235e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacfa3a7b4fa333c84acfa7521fbbb5bcc"><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__stan_sub_group.html#gacfa3a7b4fa333c84acfa7521fbbb5bcc">stanSubscription_Close</a> (<a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *sub)</td></tr>
<tr class="memdesc:gacfa3a7b4fa333c84acfa7521fbbb5bcc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Closes the subscription. <br /></td></tr>
<tr class="separator:gacfa3a7b4fa333c84acfa7521fbbb5bcc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3f6ce924f6a1830a55e30e9910aad4ba"><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__stan_sub_group.html#ga3f6ce924f6a1830a55e30e9910aad4ba">stanSubscription_Destroy</a> (<a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *sub)</td></tr>
<tr class="memdesc:ga3f6ce924f6a1830a55e30e9910aad4ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys the subscription. <br /></td></tr>
<tr class="separator:ga3f6ce924f6a1830a55e30e9910aad4ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>NATS Streaming Subscriptions. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga7b039908ec45cfc2c16ec61ba8daca9d" name="ga7b039908ec45cfc2c16ec61ba8daca9d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7b039908ec45cfc2c16ec61ba8daca9d">&#9670;&#160;</a></span>stanSubscription_SetOnCompleteCB()</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> stanSubscription_SetOnCompleteCB </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *&#160;</td>
<td class="paramname"><em>sub</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__callbacks_group.html#ga245131e64f1d0dff7edc8ed874a07e9a">natsOnCompleteCB</a>&#160;</td>
<td class="paramname"><em>cb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>closure</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>In order to make sure that an asynchronous subscription's message handler is no longer invoked once the subscription is closed (or unsubscribed) (<a class="el" href="group__stan_sub_group.html#gacfa3a7b4fa333c84acfa7521fbbb5bcc" title="Closes the subscription.">stanSubscription_Close</a>, <a class="el" href="group__stan_sub_group.html#gafa428a7e0f6800216cb06fd738bd235e" title="Permanently remove a subscription.">stanSubscription_Unsubscribe</a>), the subscription should be closed from the message handler itslef.</p>
<p>If the application closes the subscription from a different thread and immediately frees resources needed in the message handler, there is a risk of a crash since the subscription's message handler may still be invoked one last time or already in the process of executing.</p>
<p>To address this, the user can set a callback that will be invoked after the subscription is closed and the message handler has returned.</p>
<dl class="section note"><dt>Note</dt><dd>You don't need to call this function if you are not freeing resources needed in the message handler or if you always close the subscription from the message handler itself.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__callbacks_group.html#ga245131e64f1d0dff7edc8ed874a07e9a" title="Callback used to notify that an object lifecycle is complete.">natsOnCompleteCB</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5" title="Interest on a given channel.">stanSubscription</a> object </td></tr>
<tr><td class="paramname">cb</td><td>the callback to invoke when the last message of a closed subscription has been dispatched </td></tr>
<tr><td class="paramname">closure</td><td>the pointer to a user defined object (possibly <code>NULL</code>) that will be passed to the callback </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga3a1cca9fa3ea54fcf7a43fd1335a26d3" name="ga3a1cca9fa3ea54fcf7a43fd1335a26d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3a1cca9fa3ea54fcf7a43fd1335a26d3">&#9670;&#160;</a></span>stanSubscription_AckMsg()</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> stanSubscription_AckMsg </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *&#160;</td>
<td class="paramname"><em>sub</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__types_group.html#ga2cf5db7703b42d97abe56a3e83b2a87d">stanMsg</a> *&#160;</td>
<td class="paramname"><em>msg</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>If the subscription is created with manual acknowledgment mode (see <a class="el" href="group__stan_sub_opts_group.html#ga6f49ae2629e49d2bfa35990cf030bf83" title="Sets the subscription&#39;s acknowledgment mode.">stanSubOptions_SetManualAckMode</a>) then it is the user responsibility to acknowledge received messages when appropriate.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5" title="Interest on a given channel.">stanSubscription</a> object. </td></tr>
<tr><td class="paramname">msg</td><td>the message to acknowledge. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gafa428a7e0f6800216cb06fd738bd235e" name="gafa428a7e0f6800216cb06fd738bd235e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafa428a7e0f6800216cb06fd738bd235e">&#9670;&#160;</a></span>stanSubscription_Unsubscribe()</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> stanSubscription_Unsubscribe </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *&#160;</td>
<td class="paramname"><em>sub</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Removes interest on the channel. The subscription may still have a callback in progress, in that case, the subscription will still be valid until the callback returns.</p>
<p>For non-durable subscriptions, <a class="el" href="group__stan_sub_group.html#gafa428a7e0f6800216cb06fd738bd235e" title="Permanently remove a subscription.">stanSubscription_Unsubscribe</a> and <a class="el" href="group__stan_sub_group.html#gacfa3a7b4fa333c84acfa7521fbbb5bcc" title="Closes the subscription.">stanSubscription_Close</a> have the same effect.</p>
<p>For durable subscriptions, calling this function causes the server to remove the durable subscription (instead of simply suspending it). It means that once this call is made, calling <a class="el" href="group__stan_conn_sub_group.html#gae545358fdc493baf6d29429a8156781f" title="Creates a subscription.">stanConnection_Subscribe()</a> with the same durable name creates a brand new durable subscription, instead of simply resuming delivery.</p>
<dl class="section warning"><dt>Warning</dt><dd>See warning about connecting to a NATS Server v2.2.0+ in <a class="el" href="group__stan_conn_mgt_group.html#ga35e0e6e5e3b7f3818a3ac3600efb8f8f" title="Connects to a NATS Streaming Server using the provided options.">stanConnection_Connect()</a>.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5" title="Interest on a given channel.">stanSubscription</a> object. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gacfa3a7b4fa333c84acfa7521fbbb5bcc" name="gacfa3a7b4fa333c84acfa7521fbbb5bcc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacfa3a7b4fa333c84acfa7521fbbb5bcc">&#9670;&#160;</a></span>stanSubscription_Close()</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> stanSubscription_Close </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *&#160;</td>
<td class="paramname"><em>sub</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Similar to <a class="el" href="group__stan_sub_group.html#gafa428a7e0f6800216cb06fd738bd235e" title="Permanently remove a subscription.">stanSubscription_Unsubscribe()</a> except that durable interest is not removed in the server. The durable subscription can therefore be resumed.</p>
<dl class="section warning"><dt>Warning</dt><dd>See warning about connecting to a NATS Server v2.2.0+ in <a class="el" href="group__stan_conn_mgt_group.html#ga35e0e6e5e3b7f3818a3ac3600efb8f8f" title="Connects to a NATS Streaming Server using the provided options.">stanConnection_Connect()</a>.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5" title="Interest on a given channel.">stanSubscription</a> object. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga3f6ce924f6a1830a55e30e9910aad4ba" name="ga3f6ce924f6a1830a55e30e9910aad4ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3f6ce924f6a1830a55e30e9910aad4ba">&#9670;&#160;</a></span>stanSubscription_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 stanSubscription_Destroy </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5">stanSubscription</a> *&#160;</td>
<td class="paramname"><em>sub</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destroys the subscription object, freeing up memory. If not already done, this call will removes interest on the subject.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#gae4dae869fb614536f0f027c2e2660cc5" title="Interest on a given channel.">stanSubscription</a> object to destroy. </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>