You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/04/09 23:29:31 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #4015: Allow to configure TypedMessageBuilder through a Map conf object

sijie commented on a change in pull request #4015: Allow to configure TypedMessageBuilder through a Map conf object
URL: https://github.com/apache/pulsar/pull/4015#discussion_r273741798
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/TypedMessageBuilderImpl.java
 ##########
 @@ -130,6 +131,32 @@ public MessageId send() throws PulsarClientException {
         return this;
     }
 
+    @SuppressWarnings("unchecked")
+    @Override
+    public TypedMessageBuilder<T> loadConf(Map<String, Object> config) {
+        config.forEach((key, value) -> {
+            if (key.equals("key")) {
+                this.key(checkType(value, String.class));
+            } else if (key.equals("properties")) {
+                this.properties(checkType(value, Map.class));
+            } else if (key.equals("eventTime")) {
+                this.eventTime(checkType(value, Number.class).longValue());
 
 Review comment:
   why it is `Number.class` not `Long.class`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services