1. What is the most common use process for EMQ?
First, the user needs to create a queue. Users can specify the parameters of the queue when they create a queue under normal circumstances. Generally speaking, users can use the default parameters directly. After that, users can use this queue to send and receive Messages. After the user receives the message and processes it successfully , it calls deleteMessage()
to delete the message to avoid repeated reception. When the queue is no longer used it should be deleted in time to free up resources and avoid quota exhaustion.
2. Why is the queueName in the response returned by createQueue()
different from the request? Which one should I use when invoking other APIs?
To avoid conflicts caused by different users creating a Queue with the same name, we place the queue in each user's own namespace. In the current implementation, the "user id prefix" is used to distinguish them. All subsequent operations of the user, including message sending and receiving, queue updating, etc., should use the queueName returned by the response.
3. What is the meaning of the purgeQueue()
action? Why is this API call taking so long?
This operation will clear all Messages in the Queue, including delayed messages and invisible messages. The purgeQueue()
operation is equivalent in effect to deleting the Queue and creating it again, while keeping the attributes of the Queue and the Tags associated with the Queue unchanged. Therefore, this call consumes more resources and generally takes about 10 seconds to complete.
4. Can the deleted Queue be restored?
In the current implementation, deleting a Queue also physically deletes all Messages in the Queue and it is therefore not recoverable.
5. Can a Message be accompanied by data? For example, a picture?
It can. Users can attach several attributes when sendMessage()
. Attributes can be either String or byte[] types. For smaller images or binary files, you can directly attach it as a byte[] attribute to the Message. If the file is large, you can store the file in an object storage system (such as FDS) and use the address of the file as a String attribute.
6. Is EMQ's batch operation atomic? How many Messages can be processed by a batch operation?sendMessageBatch()
is atomic; other batch operations are not atomic. The number of messages in a batch operation is limited to 100 or less. In addition, the total size of messages sent by a sendMessageBatch()
operation (including the attached attribute of Message) should not exceed the upper limit set by the queue when it is created (up to a maximum of 256 KB).
7. What is the general use of the ChangeMessageVisibilitySeconds()
API? There is a need to use this API to change the visibility timeout of a Message when the receiver finds that it is unable to process the received message, or that the time required to process the message is greater than invisibilitySeconds.
8. Both createTag()
and receiveMessage()
can be filtered by the message attributes. What are the differences in their usage scenarios? Tags (including the queue corresponding to the default tag) can be logically treated as a message pipe. The filter in the createTag()
parameter restricts the type of message that enters the pipeline; receiveMessage()
, which sets the filter, only removes the message it needs from the pipeline. If some of the messages in the pipeline have not been taken away, it will eventually affect the collection of other messages. Specifically, if Messages are classified as A/B, they need to be received by two types of receivers. You can create a tag without a filter and specify the attributes of the received message when receiveMessage()
. If you only need to receive A and do not need B, you should specify filter when creating the tag. Otherwise, Class B Messages that enter the Tag will eventually affect the receiver's reception of A.
9. Why is the message duplicated?
Forgotten Ack (if processing anomalies), or an Ack failure due to rare circumstances (such as server restart).
10. What is causing the org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool exception?
The size of the Http Client connection pool in the SDK is not sufficient.
11. Is EMQ failure causing my system delay to increase? Is it due to EMQ causing queue message accumulation?
First check the monitoring (QPS, latency, the number of items /s).
12. How to use cross-domain?
A private circuitor proxy for SDK http Client.
13. How can I add a partition of a queue?
Contact the administrator to increase the number of partitions of the queue.
14. Default tags cannot be deleted?
Yes.