momo-jun commented on code in PR #589:
URL: https://github.com/apache/pulsar-site/pull/589#discussion_r1209658670
##########
docs/client-libraries-producers.md:
##########
@@ -178,90 +186,84 @@ await producer.Send(data);
</Tabs>
````
-## Send messages with customized metadata
-
-- Send messages with customized metadata by using the builder.
-
- ````mdx-code-block
- <Tabs groupId="lang-choice"
- defaultValue="C#"
-
values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"},{"label":"C#","value":"C#"}]}>
-
- <TabItem value="Java">
-
- ```java
- producer.newMessage()
- .value("my-sync-message")
- .property("my-key", "my-value")
- .property("my-other-key", "my-other-value")
- .send();
- ```
+## Configure messages
- </TabItem>
-
- <TabItem value="C++">
+There are various properties of Pulsar's messages that we can set. The values
of these properties will be stored in the metadata of the message.
- ```cpp
- Message msg = MessageBuilder()
- .setContent("content")
- .setProperty("my-key", "my-value")
- .setProperty("my-other-key", "my-other-value")
- .build();
- Result res = producer.send(msg);
- ```
+````mdx-code-block
+<Tabs groupId="lang-choice"
+ defaultValue="Java"
+
values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"},{"label":"C#","value":"C#"}]}>
- </TabItem>
+<TabItem value="Java">
- <TabItem value="C#">
+ ```java
+ producer.newMessage()
+ .key("my-key") // Set the message key
+ .eventTime(System.currentTimeMillis()) // Set the event time
+ .sequenceId(1203) // Set the sequenceId for the deduplication
purposes
+ .deliverAfter(1, TimeUnit.HOURS) // Delay message delivery for
1 hour
+ .property("my-key", "my-value") // Set the customized metadata
+ .property("my-other-key", "my-other-value")
+ .replicationClusters(
+ Lists.newArrayList("r1", "r2")) // Set the
geo-replication clusters for this message.
+ .value("content")
+ .send();
+ ```
- ```csharp
- var messageId = await producer.NewMessage()
- .Property("SomeKey", "SomeValue")
- .Send(data);
- ```
+ For the Java client, we can also use `loadConf` to configure the message
metadata. Here is the example:
Review Comment:
```suggestion
For the Java client, you can also use `loadConf` to configure the message
metadata. Here is an example:
```
##########
docs/client-libraries-producers.md:
##########
@@ -178,90 +186,84 @@ await producer.Send(data);
</Tabs>
````
-## Send messages with customized metadata
-
-- Send messages with customized metadata by using the builder.
-
- ````mdx-code-block
- <Tabs groupId="lang-choice"
- defaultValue="C#"
-
values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"},{"label":"C#","value":"C#"}]}>
-
- <TabItem value="Java">
-
- ```java
- producer.newMessage()
- .value("my-sync-message")
- .property("my-key", "my-value")
- .property("my-other-key", "my-other-value")
- .send();
- ```
+## Configure messages
- </TabItem>
-
- <TabItem value="C++">
+There are various properties of Pulsar's messages that we can set. The values
of these properties will be stored in the metadata of the message.
Review Comment:
```suggestion
You can set various properties of Pulsar's messages. The values of these
properties are stored in the metadata of a message.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]