You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/02/05 21:21:00 UTC

[incubator-pulsar] branch master updated: Added some missing configs on websocket producer/consumer (#1173)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 1945799  Added some missing configs on websocket producer/consumer (#1173)
1945799 is described below

commit 194579900d59bda9d9a8e1f29b10b9dc6aa8cc87
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Mon Feb 5 13:20:57 2018 -0800

    Added some missing configs on websocket producer/consumer (#1173)
---
 .../java/org/apache/pulsar/websocket/ConsumerHandler.java   |  4 ++++
 .../java/org/apache/pulsar/websocket/ProducerHandler.java   | 13 +++++++++++++
 site/docs/latest/clients/WebSocket.md                       | 10 +++++++---
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java
index f6fd0eb..27f62b1 100644
--- a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java
+++ b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java
@@ -274,6 +274,10 @@ public class ConsumerHandler extends AbstractWebSocketHandler {
             conf.setConsumerName(queryParams.get("consumerName"));
         }
 
+        if (queryParams.containsKey("priorityLevel")) {
+            conf.setPriorityLevel(Integer.parseInt(queryParams.get("priorityLevel")));
+        }
+
         return conf;
     }
 
diff --git a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ProducerHandler.java b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ProducerHandler.java
index 990f2cd..13758b8 100644
--- a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ProducerHandler.java
+++ b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ProducerHandler.java
@@ -39,6 +39,7 @@ import org.apache.pulsar.client.api.Message;
 import org.apache.pulsar.client.api.MessageBuilder;
 import org.apache.pulsar.client.api.Producer;
 import org.apache.pulsar.client.api.ProducerConfiguration;
+import org.apache.pulsar.client.api.ProducerConfiguration.HashingScheme;
 import org.apache.pulsar.client.api.ProducerConfiguration.MessageRoutingMode;
 import org.apache.pulsar.common.naming.DestinationName;
 import org.apache.pulsar.common.util.ObjectMapperFactory;
@@ -235,6 +236,18 @@ public class ProducerHandler extends AbstractWebSocketHandler {
         // Set to false to prevent the server thread from being blocked if a lot of messages are pending.
         conf.setBlockIfQueueFull(false);
 
+        if (queryParams.containsKey("producerName")) {
+            conf.setProducerName(queryParams.get("producerName"));
+        }
+
+        if (queryParams.containsKey("initialSequenceId")) {
+            conf.setInitialSequenceId(Long.parseLong("initialSequenceId"));
+        }
+
+        if (queryParams.containsKey("hashingScheme")) {
+            conf.setHashingScheme(HashingScheme.valueOf(queryParams.get("hashingScheme")));
+        }
+
         if (queryParams.containsKey("sendTimeoutMillis")) {
             conf.setSendTimeout(Integer.parseInt(queryParams.get("sendTimeoutMillis")), TimeUnit.MILLISECONDS);
         }
diff --git a/site/docs/latest/clients/WebSocket.md b/site/docs/latest/clients/WebSocket.md
index 4060289..5ca6e15 100644
--- a/site/docs/latest/clients/WebSocket.md
+++ b/site/docs/latest/clients/WebSocket.md
@@ -90,8 +90,11 @@ Key | Type | Required? | Explanation
 `batchingMaxMessages` | int | no | Maximum number of messages permitted in a batch (default: 1000)
 `maxPendingMessages` | int | no | Set the max size of the internal-queue holding the messages (default: 1000)
 `batchingMaxPublishDelay` | long | no | Time period within which the messages will be batched (default: 10ms)
-`messageRoutingMode` | string | no | Message [routing mode](https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/ProducerConfiguration.MessageRoutingMode.html) for the partitioned producer: SinglePartition/RoundRobinPartition
-`compressionType` | string | no | Compression [type](https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/CompressionType.html): LZ4/ZLIB
+`messageRoutingMode` | string | no | Message [routing mode](https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/ProducerConfiguration.MessageRoutingMode.html) for the partitioned producer: `SinglePartition`, `RoundRobinPartition`
+`compressionType` | string | no | Compression [type](https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/CompressionType.html): `LZ4`, `ZLIB`
+`producerName` | string | no | Specify the name for the producer. Pulsar will enforce only one producer with same name can be publishing on a topic
+`initialSequenceId` | long | no | Set the baseline for the sequence ids for messages published by the producer.
+`hashingScheme` | string | no | [Hashing function](http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ProducerConfiguration.HashingScheme.html) to use when publishing on a partitioned topic: `JavaStringHash`, `Murmur3_32Hash`
 
 
 #### Publishing a message
@@ -150,9 +153,10 @@ The consumer endpoint requires you to specify a {% popover property %}, {% popov
 Key | Type | Required? | Explanation
 :---|:-----|:----------|:-----------
 `ackTimeoutMillis` | long | no | Set the timeout for unacked messages (default: 0)
-`subscriptionType` | string | no | [Subscription type](https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html): Exclusive/Failover/Shared
+`subscriptionType` | string | no | [Subscription type](https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html): `Exclusive`, `Failover`, `Shared`
 `receiverQueueSize` | int | no | Size of the consumer receive queue (default: 1000)
 `consumerName` | string | no | Consumer name
+`priorityLevel` | int | no | Define a [priority](http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-) for the consumer
 
 ##### Receiving messages
 

-- 
To stop receiving notification emails like this one, please contact
mmerli@apache.org.