This is an automated email from the ASF dual-hosted git repository.
duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 622bbbf add some doc of the API_Reference_DefaultMQProducer of
English.
new 5908ca7 Merge pull request #3056 from zplovekq/doc_add
622bbbf is described below
commit 622bbbf05cf41d4cbc6e2f1b1783ed6c4f791476
Author: zplkq <[email protected]>
AuthorDate: Thu Jun 24 00:26:03 2021 +0800
add some doc of the API_Reference_DefaultMQProducer of English.
---
.../client/java/API_Reference_DefaultMQProducer.md | 71 ++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/docs/en/client/java/API_Reference_DefaultMQProducer.md
b/docs/en/client/java/API_Reference_DefaultMQProducer.md
new file mode 100644
index 0000000..152f45d
--- /dev/null
+++ b/docs/en/client/java/API_Reference_DefaultMQProducer.md
@@ -0,0 +1,71 @@
+## DefaultMQProducer
+---
+### Class introduction
+
+`public class DefaultMQProducer
+extends ClientConfig
+implements MQProducer`
+
+>`DefaultMQProducer` is the entry point for an application to post messages,
out of the box,ca quickly create a producer with a no-argument construction.
it is mainly responsible for message sending, support
synchronous、asynchronous、one-way send. All of these send methods support batch
send. The parameters of the sender can be adjusted through the getter/setter
methods , provided by this class. `DefaultMQProducer` has multi send method and
each method is slightly different. Make sure [...]
+
+``` java
+public class Producer {
+ public static void main(String[] args) throws MQClientException {
+ // create a produce with producer_group_name
+ DefaultMQProducer producer = new
DefaultMQProducer("ProducerGroupName");
+
+ // start the producer
+ producer.start();
+
+ for (int i = 0; i < 128; i++)
+ try {
+ // construct the msg
+ Message msg = new Message("TopicTest",
+ "TagA",
+ "OrderID188",
+ "Hello
world".getBytes(RemotingHelper.DEFAULT_CHARSET));
+
+ // send sync
+ SendResult sendResult = producer.send(msg);
+
+ // print the result
+ System.out.printf("%s%n", sendResult);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ producer.shutdown();
+ }
+}
+```
+
+**Note** : This class is thread safe. It can be safely shared between multiple
threads after configuration and startup is complete.
+
+### Variable
+
+|Type|Name| description |
+|------|-------|-------|
+|DefaultMQProducerImpl|defaultMQProducerImpl|The producer's internal default
implementation|
+|String|producerGroup|The producer's group|
+|String|createTopicKey| Topics that do not exist on the server are
automatically created when the message is sent |
+|int|defaultTopicQueueNums|The default number of queues to create a topic|
+|int|sendMsgTimeout|The timeout for the message to be sent|
+|int|compressMsgBodyOverHowmuch|the threshold of the compress of message body|
+|int|retryTimesWhenSendFailed|Maximum number of internal attempts to send a
message in synchronous mode|
+|int|retryTimesWhenSendAsyncFailed|Maximum number of internal attempts to send
a message in asynchronous mode|
+|boolean|retryAnotherBrokerWhenNotStoreOK|Whether to retry another broker if
an internal send fails|
+|int|maxMessageSize| Maximum length of message
|
+|TraceDispatcher|traceDispatcher| Message trackers. Use rcpHook to track
messages |
+
+### construction method
+
+|方法名称|方法描述|
+|-------|------------|
+|DefaultMQProducer()| creates a producer with default parameter values
|
+|DefaultMQProducer(final String producerGroup)| creates a producer with
producer group name. |
+|DefaultMQProducer(final String producerGroup, boolean enableMsgTrace)|creates
a producer with producer group name and set whether to enable message tracking|
+|DefaultMQProducer(final String producerGroup, boolean enableMsgTrace, final
String customizedTraceTopic)|creates a producer with producer group name and
set whether to enable message tracking、the trace topic.|
+|DefaultMQProducer(RPCHook rpcHook)|creates a producer with a rpc hook.|
+|DefaultMQProducer(final String producerGroup, RPCHook rpcHook)|creates a
producer with a rpc hook and producer group.|
+|DefaultMQProducer(final String producerGroup, RPCHook rpcHook, boolean
enableMsgTrace,final String customizedTraceTopic)|all of above.|
+