<trclass="memdesc:gac6ba005531c82d9f0efa88dd6b458477"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Publishes data on a subject to JetStream. <br/></td></tr>
<trclass="memdesc:ga2aceeb82fac3621aea843dd246732bdd"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Publishes a message to JetStream. <br/></td></tr>
<trclass="memdesc:ga069dfd6f0f3d96f1ff8bf2372e59900c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Publishes data to JetStream but does not wait for a <aclass="el"href="structjs_pub_ack.html">jsPubAck</a>. <br/></td></tr>
<trclass="memdesc:gab7e4139a48c5ee4d2155cbb43142e873"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Publishes a message to JetStream but does not wait for a <aclass="el"href="structjs_pub_ack.html">jsPubAck</a>. <br/></td></tr>
<trclass="memdesc:ga24813ee9a58f00c0f21d10ab9c93b81d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Wait for all outstanding messages to be acknowledged. <br/></td></tr>
<trclass="memdesc:ga2ac95a3450f77f8074fae3f2fbe7e54c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the list of pending messages published asynchronously. <br/></td></tr>
<p>Publishes the data to the given subject to JetStream.</p>
<p>See <aclass="el"href="group__js_pub_group.html#ga2aceeb82fac3621aea843dd246732bdd"title="Publishes a message to JetStream.">js_PublishMsg</a> for details.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">pubAck</td><td>the location where to store the pub acknowledgment, or <code>NULL</code> if not needed. </td></tr>
<tr><tdclass="paramname">js</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><tdclass="paramname">subj</td><td>the subject the data is sent to. </td></tr>
<tr><tdclass="paramname">data</td><td>the data to be sent, can be <code>NULL</code>. </td></tr>
<tr><tdclass="paramname">dataLen</td><td>the length of the data to be sent. </td></tr>
<dlclass="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 <aclass="el"href="structjs_pub_ack.html">jsPubAck</a> object needs to be destroyed with <aclass="el"href="group__js_pub_group.html#gaac130840b6db9109e72cf6ad9186dfc4"title="Destroys the publish acknowledgment object.">jsPubAck_Destroy</a> when no longer needed.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="group__js_pub_group.html#gaac130840b6db9109e72cf6ad9186dfc4"title="Destroys the publish acknowledgment object.">jsPubAck_Destroy</a></dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">pubAck</td><td>the location where to store the pub acknowledgment, or <code>NULL</code> if not needed. </td></tr>
<tr><tdclass="paramname">js</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><tdclass="paramname">msg</td><td>the pointer to the <aclass="el"href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a"title="A structure holding a subject, optional reply and payload.">natsMsg</a> object to send. </td></tr>
<p>See <aclass="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>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">js</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><tdclass="paramname">subj</td><td>the subject the data is sent to. </td></tr>
<tr><tdclass="paramname">data</td><td>the data to be sent, can be <code>NULL</code>. </td></tr>
<tr><tdclass="paramname">dataLen</td><td>the length of the data to be sent. </td></tr>
<p>Publishes a message asynchronously to JetStream. User can call <aclass="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>
<dlclass="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 <aclass="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 <aclass="el"href="group__msg_group.html#ga9e9590018284939f43f60964283f33ae"title="Destroys the message object.">natsMsg_Destroy</a>, regardless of success or failure, since <aclass="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>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="group__js_pub_group.html#ga24813ee9a58f00c0f21d10ab9c93b81d"title="Wait for all outstanding messages to be acknowledged.">js_PublishAsyncComplete</a></dd>
<dd>
<aclass="el"href="group__callbacks_group.html#ga954768cc1d3388bb6ab723e777647992"title="Callback used to process asynchronous publish errors from JetStream.">jsPubAckErrHandler</a></dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">js</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<tr><tdclass="paramname">msg</td><td>the memory location where the pointer to the <aclass="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 <aclass="el"href="group__msg_group.html#ga9e9590018284939f43f60964283f33ae"title="Destroys the message object.">natsMsg_Destroy</a> would have no effect. </td></tr>
<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 <aclass="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>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">js</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaaf12cdd24c6cc23a57c20466c92ff8c1">jsCtx</a> object. </td></tr>
<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>
<dlclass="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 <aclass="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>
<dlclass="section warning"><dt>Warning</dt><dd>The user must call <aclass="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><!-- fragment --><dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">pending</td><td>pointer to a <aclass="el"href="structnats_msg_list.html"title="A list of NATS messages.">natsMsgList</a> object, typically defined on the stack. </td></tr>
<tr><tdclass="paramname">js</td><td>the pointer to the <aclass="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 -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->
<ul>
<liclass="footer">NATS.IO Supported By Synadia Communications Inc.