FAQ

<p class="shortdesc"></p> <section class="section" id="faqs__section_mpt_vvg_2mb"><h2 class="doc-tairway">How can I know if the message has been successfully sent?</h2> <p class="p">The client producer calls the send message method. As long as there is no exception, it means that the message has been sent successfully. However, there are multiple states for sending messages successfully, which are defined in sendResult.</p> <table class="table" id="faqs__table_dfl_jyg_2mb"><caption></caption><colgroup><col><col></colgroup><thead class="thead"> <tr class="row"> <th class="entry" id="faqs__table_dfl_jyg_2mb__entry__1">Return status</th> <th class="entry" id="faqs__table_dfl_jyg_2mb__entry__2">Meaning</th> </tr> </thead><tbody class="tbody"> <tr class="row"> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__1 "><code class="ph codeph">SEND_OK</code></td> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__2 "> <p class="p">The message has been sent successfully.</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__1 "><code class="ph codeph">FLUSH_DISK_TIMEOUT</code></td> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__2 "> <p class="p">The message has been sent successfully. But the server flush disk times out and the message has entered the server queue, the message will not be lost unless the MASTER server goes down at this time.</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__1 "><code class="ph codeph">FLUSH_SLAVE_TIMEOUT</code></td> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__2 "> <p class="p">The message has been sent successfully. But the server flush slave times out when synchronizing to SLAVE, and the message has entered the server queue, the message will not be lost unless the SLAVE server goes down at this time.</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__1 "><code class="ph codeph">SLAVE_NOT_AVAILABLE</code></td> <td class="entry" headers="faqs__table_dfl_jyg_2mb__entry__2 "> <p class="p">The message has been sent successfully. But the SLAVE service is not available, and the message has entered the server queue, the message will not be lost unless the SLAVE server goes down at this time.</p> </td> </tr> </tbody></table> <p class="p">Currently, PAMQ uses 4 broker machines with two master brokers and two slave brokers. For most business systems, as long as PAMQ does not prompt an exception, the message has been sent successfully by default. It is recommended that business system print warning logs for all messages that are not in the SEND_OK status after being sent, and set monitoring rules on the operating side to send email reminders in a timely manner.</p> </section> <section class="section" id="faqs__section_rkf_tyg_2mb"><h2 class="doc-tairway">How can I know if I have successfully consumed messages?</h2> <p class="p">The client consumer implements pushMessage() in the FCMessageListener, and will feed back consumption status to the PAMQ after viewing and processing the message. There are only two states, including consumption success and consumption failure.</p> <table class="table" id="faqs__table_ufy_vyg_2mb"><caption></caption><colgroup><col><col></colgroup><thead class="thead"> <tr class="row"> <th class="entry" id="faqs__table_ufy_vyg_2mb__entry__1">Consumer status</th> <th class="entry" id="faqs__table_ufy_vyg_2mb__entry__2">Meaning</th> </tr> </thead><tbody class="tbody"> <tr class="row"> <td class="entry" headers="faqs__table_ufy_vyg_2mb__entry__1 "><code class="ph codeph">CONSUME_OK</code></td> <td class="entry" headers="faqs__table_ufy_vyg_2mb__entry__2 "> <p class="p">Consumption succeeded.</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_ufy_vyg_2mb__entry__1 "><code class="ph codeph">CONSUME_FAIL</code></td> <td class="entry" headers="faqs__table_ufy_vyg_2mb__entry__2 "> <p class="p">Consumption failed.</p> </td> </tr> </tbody></table> </section> <section class="section" id="faqs__section_wbk_zyg_2mb"><h2 class="doc-tairway">How does the consumer client realize regular consumption?</h2> <p class="p">In specific business scenarios, the consumer client wants to start pulling messages from the PAMQ when the business is in off hours (for example, after 12 midnight). And it wants to turn off the consumption function before the peak hours to reduce system load. This kind of scenarios involve how to turn on and off PAMQ consumer services for multiple times without stopping business services.</p> <p class="p">The PAMQ consumer itself can be initialized by multiple instances, and the consumer service of each instance is also opened and closed independently, which can easily enable the scenario of regular consumption.</p> <p class="p">We recommend that you follow the operations below if you have similar demands:</p> <ol class="ol" id="faqs__ol_a4z_zyg_2mb"> <li class="li">The business system needs more function switches, turning on or off consumer services through configuration is supported. The implementation is relatively simple, that is calling the PAMQ consumer's <code class="ph codeph">start || shutdown</code> methodss. You need to add upper-level logic encapsulation to the method to achieve customized requirements, if necessary.</li> <li class="li">Do not immediately initialize the next consumer object and enable the service after calling the shutdown method of the consumer object. We recommend that you delay it for at least a few seconds until the resources are reclaimed.</li> <li class="li">Improve the logs of opening or closing message services to facilitate subsequent operation and maintenance.</li> </ol> </section> <section class="section" id="faqs__section_hh1_mzg_2mb"><h2 class="doc-tairway">How does the producer client realize sending messages regularly?</h2> <p class="p">The producer client operates with a single instance, and the resources can only be initialized once. Even after calling the shutdown() method of the producer, multiple initializations will still report errors. Compared with the consumer, the timing control of sending messages is relatively simple. Call the send() method as needed when you send the message.</p> </section> <section class="section" id="faqs__section_mrj_11h_2mb"><h2 class="doc-tairway">The consumer client has not received the message, so how can I locate the problem?</h2> <p class="p">Under normal circumstances, the producer sends a message to the PAMQ, and the delay for the message being sent to the consumer should be in milliseconds. If the consumer has not received the message, we recommend that you follow these steps to solve the problem:</p> <p class="p">Get the message ID or message key, and find its consumption status according to your consumer ID in the query module of Ping An Cloud MQ. Common delivery statuses are as follows:</p> <table class="table" id="faqs__table_ftp_h1h_2mb"><caption></caption><colgroup><col><col></colgroup><thead class="thead"> <tr class="row"> <th class="entry" id="faqs__table_ftp_h1h_2mb__entry__1">Status</th> <th class="entry" id="faqs__table_ftp_h1h_2mb__entry__2">Meaning</th> </tr> </thead><tbody class="tbody"> <tr class="row"> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__1 "><code class="ph codeph">SUBSCRIBED_AND_CONSUMED</code></td> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__2 "> <p class="p">Subscribed and consumed (offset is passed over).</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__1 "><code class="ph codeph">SUBSCRIBED_BUT_FILTERD</code></td> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__2 "> <p class="p">Subscribed but filtered.</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__1 "><code class="ph codeph">the consumer group[***] not online</code></td> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__2 "> <p class="p">Subscribed, but not enabled by the consumer.</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__1 "><code class="ph codeph">SUBSCRIBED_AND_NOT_CONSUME_YET</code></td> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__2 "> <p class="p">Subscribed but not consumed.</p> </td> </tr> <tr class="row"> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__1 "><code class="ph codeph">UNKNOW_EXCEPTION</code></td> <td class="entry" headers="faqs__table_ftp_h1h_2mb__entry__2 "> <p class="p">Unknown exception.</p> </td> </tr> </tbody></table> <div class="note note note_note"><span class="note__title">Note:</span> <ul class="ul" id="faqs__ul_pvq_x1h_2mb"> <li class="li">The status of SUBSCRIBED_AND_CONSUMED indicates that the message has been consumed normally. If there is an abnormal condition at this time, the business system needs to check the log and to analyze whether it is the abnormality occurred for the parsing of messages that results in abnormal message processing.</li> <li class="li">The status of SUBSCRIBED_BUT_FILTERD indicates that the business system needs to check whether the TagList matches the tag defined by the producer when the consumer object is initialized.</li> <li class="li">The status of SUBSCRIBED_AND_NOT_CONSUME_YET indicates that the messages may possibly heap up and not be taken away. You can wait for tens of seconds and then check the status again.</li> <li class="li">The status of the consumer group[***] not online indicates that consumers who respond to the CID have not been online. The business system needs to check whether the consumer has been online. If it has been, check whether an error is reported. It may be the incorrect configuration items that cause the verification failure of the consumer.</li> <li class="li">The status of UNKNOW_EXCEPTION indicates that the message platform has abnormal conditions.</li> </ul> </div> </section> <section class="section" id="faqs__section_mw5_4bh_2mb"><h2 class="doc-tairway">How to avoid garbled messages received?</h2> <p class="p">For the producer, we recommend that you specify UTF-8 encoding when converting the message body to a byte array. For the consumer, we recommend that you specify UTF-8 encoding when converting the byte array to a string after receiving the message. This can avoid garbled messages in the parsing of the consumer client due to the Chinese or special characters in the message body, which may cause the message parsing to fail.</p> </section> <section class="section" id="faqs__section_dv4_sbh_2mb"><h2 class="doc-tairway">How to use tags?</h2> <p class="p">In the actual use scenario of message middleware, consumers may only need to receive part of the messages in the message queue, and it is expected that the rest are not received by default and are discarded. For similar scenarios, PAMQ reasonably uses message tags to flexibly filter messages in the queue at the consumer client. This is realized in the following manner:</p> <ol class="ol" id="faqs__ol_b5q_5bh_2mb"> <li class="li">Both the producer and the consumer agree on the specific setting value of the message tag and the meaning thereof.</li> <li class="li">When the producer sends a message or assembles the message object, the correct message tag should be set.<pre class="pre codeblock"><code>FCMessage msg = new FCMessage(); //Set filter tags --- case sensitive msg.setTag("SystemTag");</code></pre></li> <li class="li">When the consumer assembles the consumer object, the filter for message filtering should be set.<pre class="pre codeblock"><code>FCMessageFilter FCFilter = new FCMessageFilter (); List<String> list = new ArrayList<String>(); FCFilter.setTags(list); // It should be noted that multiple application instances under the same CID need to set the same tag list to filter messages, so as to avoid that the message is filtered and taken away but is not processed by the business system list.add ("SystemTag").</code></pre></li> </ol> </section>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products