Debian Codegraph @

docs/api_reference/CXX/repmgr_msg_dispatch.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DbEnv::repmgr_msg_dispatch()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10 <link rel="up" href="rep.html" title="Chapter 11.  Replication Methods" />
11 <link rel="prev" href="repmgrget_ack_policy.html" title="DbEnv::repmgr_get_ack_policy()" />
12 <link rel="next" href="repmgrset_ack_policy.html" title="DbEnv::repmgr_set_ack_policy()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DbEnv::repmgr_msg_dispatch()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="repmgrget_ack_policy.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 11. 
26 Replication Methods
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="repmgrset_ack_policy.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="repmgr_msg_dispatch"></a>DbEnv::repmgr_msg_dispatch()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::repmgr_msg_dispatch(
45 void (*msg_dispatch_fcn) (DbEnv *env, DbChannel *channel,
46 Dbt *request, u_int32_t nrequest,
47 u_int32_t cb_flags),
48 u_int32_t flags); </pre>
49 <p>
50 Sets the message dispatch function. This function is responsible
51 for receiving messages sent from remote sites using either the
52 <a class="xref" href="dbchannel_send_msg.html" title="DbChannel::send_msg()">DbChannel::send_msg()</a>
53 or
54 <a class="xref" href="dbchannel_send_request.html" title="DbChannel::send_request()">DbChannel::send_request()</a>
55 methods. If the message received by this function was sent using the
56 <a class="xref" href="dbchannel_send_msg.html" title="DbChannel::send_msg()">DbChannel::send_msg()</a>
57 method then no response is required. If the message was sent using the
58 <a class="xref" href="dbchannel_send_request.html" title="DbChannel::send_request()">DbChannel::send_request()</a>
59 method, then this function must send a response using the
60 <a class="xref" href="dbchannel_send_msg.html" title="DbChannel::send_msg()">DbChannel::send_msg()</a>
61 method.
62 </p>
63 <p>
64 For best results, the
65 <code class="methodname">DbEnv::repmgr_msg_dispatch()</code> method should
66 be called before the Replication Manager has been started.
67 </p>
68 <p>
69 The <code class="methodname">DbEnv::repmgr_msg_dispatch()</code> <span>
70
71 <span>
72 method either returns a non-zero error value or throws an
73 exception that encapsulates a non-zero error value on
74 failure, and returns 0 on success.
75 </span>
76 </span>
77 </p>
78 <div class="sect2" lang="en" xml:lang="en">
79 <div class="titlepage">
80 <div>
81 <div>
82 <h3 class="title"><a id="idp9871312"></a>Parameters</h3>
83 </div>
84 </div>
85 </div>
86 <div class="sect3" lang="en" xml:lang="en">
87 <div class="titlepage">
88 <div>
89 <div>
90 <h4 class="title"><a id="idp9870664"></a>msg_dispatch_fcn</h4>
91 </div>
92 </div>
93 </div>
94 <p>
95 This parameter is the application-specific function used
96 to handle messages sent over Replication Manager message
97 channels. It takes four parameters:
98 </p>
99 <div class="itemizedlist">
100 <ul type="disc">
101 <li>
102 <p>
103 <code class="literal">channel</code>
104 </p>
105 <p>
106 Provides the DbChannel to be used to send
107 a response back to the originator of the message.
108 If the message was sent by the remote site using
109 <a class="xref" href="dbchannel_send_request.html" title="DbChannel::send_request()">DbChannel::send_request()</a>
110 then this function should send a response back to
111 the originator using the channel provided on this
112 parameter. The message should be sent by calling
113 <a class="xref" href="dbchannel_send_msg.html" title="DbChannel::send_msg()">DbChannel::send_msg()</a>
114 exactly once.
115 </p>
116 <p>
117 This channel is valid only during the current
118 invocation of the dispatch function; it is
119 destroyed when the dispatch function returns. The
120 application may not save a copy of the pointer and
121 use it later elsewhere. Methods that do not make
122 sense in the context of a message dispatch
123 function (such as
124 <a class="xref" href="dbchannel_send_request.html" title="DbChannel::send_request()">DbChannel::send_request()</a>
125 and
126 <a class="xref" href="dbchannel_close.html" title="DbChannel::close()">DbChannel::close()</a>)
127 will be rejected with <code class="literal">EINVAL</code>.
128 </p>
129 </li>
130 <li>
131 <p>
132 <code class="literal">request</code>
133 </p>
134 <p>
135 Array of Dbts containing the message
136 received from the remote site.
137 </p>
138 </li>
139 <li>
140 <p>
141 <code class="literal">nrequest</code>
142 </p>
143 <p>
144 Specifies the number of elements in the
145 <code class="literal">request</code> array.
146 </p>
147 </li>
148 <li>
149 <p>
150 <code class="literal">cb_flags</code>
151 </p>
152 <p>
153 This flag is
154 <code class="literal">DB_REPMGR_NEED_RESPONSE</code> if the
155 message requires a response. Otherwise, it is
156 <code class="literal">0</code>.
157 </p>
158 </li>
159 </ul>
160 </div>
161 <p>
162 This function does not return a value. If the function
163 encounters an error, you can reflect the error back to
164 the originator of the message by formatting an error
165 message of your own design into the response.
166 </p>
167 </div>
168 <div class="sect3" lang="en" xml:lang="en">
169 <div class="titlepage">
170 <div>
171 <div>
172 <h4 class="title"><a id="idp9883704"></a>flags</h4>
173 </div>
174 </div>
175 </div>
176 <p>
177 This parameter is currently unused, and must be
178 set to 0.
179 </p>
180 </div>
181 </div>
182 <div class="sect2" lang="en" xml:lang="en">
183 <div class="titlepage">
184 <div>
185 <div>
186 <h3 class="title"><a id="idp9877984"></a>Errors</h3>
187 </div>
188 </div>
189 </div>
190 <p>
191 The <code class="methodname">DbEnv::repmgr_msg_dispatch()</code>
192 <span>
193
194 <span>
195 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
196 exception, encapsulating one of the following non-zero errors, or return one
197 of the following non-zero errors:
198 </span>
199 </span>
200 </p>
201 <div class="sect3" lang="en" xml:lang="en">
202 <div class="titlepage">
203 <div>
204 <div>
205 <h4 class="title"><a id="idp9881048"></a>EINVAL</h4>
206 </div>
207 </div>
208 </div>
209 <p>
210 If this method is called from a Base API application,
211 or if an invalid flag value or parameter was specified.
212 </p>
213 </div>
214 </div>
215 <div class="sect2" lang="en" xml:lang="en">
216 <div class="titlepage">
217 <div>
218 <div>
219 <h3 class="title"><a id="idp9889232"></a>Class</h3>
220 </div>
221 </div>
222 </div>
223 <p>
224 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
225 </p>
226 </div>
227 <div class="sect2" lang="en" xml:lang="en">
228 <div class="titlepage">
229 <div>
230 <div>
231 <h3 class="title"><a id="idp9886080"></a>See Also</h3>
232 </div>
233 </div>
234 </div>
235 <p>
236 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a>
237 </p>
238 </div>
239 </div>
240 <div class="navfooter">
241 <hr />
242 <table width="100%" summary="Navigation footer">
243 <tr>
244 <td width="40%" align="left"><a accesskey="p" href="repmgrget_ack_policy.html">Prev</a> </td>
245 <td width="20%" align="center">
246 <a accesskey="u" href="rep.html">Up</a>
247 </td>
248 <td width="40%" align="right"> <a accesskey="n" href="repmgrset_ack_policy.html">Next</a></td>
249 </tr>
250 <tr>
251 <td width="40%" align="left" valign="top">DbEnv::repmgr_get_ack_policy() </td>
252 <td width="20%" align="center">
253 <a accesskey="h" href="index.html">Home</a>
254 </td>
255 <td width="40%" align="right" valign="top"> DbEnv::repmgr_set_ack_policy()</td>
256 </tr>
257 </table>
258 </div>
259 </body>
260 </html>