You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Topic | Topic specify the topic this consumer will subscribe to. This argument is required when constructing the reader. ||
261
311
| Name | Name specify a name for the producer. If not assigned, the system will generate a globally unique name which can be access with Producer.ProducerName(). ||
262
312
| Properties | Properties attach a set of application defined properties to the producer This properties will be visible in the topic stats ||
313
+
| SendTimeout | SendTimeout set the timeout for a message that is not acknowledged by the server | 30s |
314
+
| DisableBlockIfQueueFull | DisableBlockIfQueueFull control whether Send and SendAsync block if producer's message queue is full | false |
263
315
| MaxPendingMessages| MaxPendingMessages set the max size of the queue holding the messages pending to receive an acknowledgment from the broker. ||
264
316
| HashingScheme | HashingScheme change the `HashingScheme` used to chose the partition on where to publish a particular message. | JavaStringHash |
265
317
| CompressionType | CompressionType set the compression type for the producer. | not compressed |
318
+
| CompressionLevel | Define the desired compression level. Options: Default, Faster and Better | Default |
266
319
| MessageRouter | MessageRouter set a custom message routing policy by passing an implementation of MessageRouter ||
267
320
| DisableBatching | DisableBatching control whether automatic batching of messages is enabled for the producer. | false |
268
321
| BatchingMaxPublishDelay | BatchingMaxPublishDelay set the time period within which the messages sent will be batched | 1ms |
269
322
| BatchingMaxMessages | BatchingMaxMessages set the maximum number of messages permitted in a batch. | 1000 |
323
+
| BatchingMaxSize | BatchingMaxSize sets the maximum number of bytes permitted in a batch. | 128KB |
324
+
| Schema | Schema set a custom schema type by passing an implementation of `Schema`| bytes[]|
325
+
| Interceptors | A chain of interceptors. These interceptors are called at some points defined in the `ProducerInterceptor` interface. | None |
326
+
| MaxReconnectToBroker | MaxReconnectToBroker set the maximum retry number of reconnectToBroker | ultimate |
327
+
| BatcherBuilderType | BatcherBuilderType sets the batch builder type. This is used to create a batch container when batching is enabled. Options: DefaultBatchBuilder and KeyBasedBatchBuilder | DefaultBatchBuilder |
270
328
271
329
## Consumers
272
330
@@ -309,17 +367,20 @@ Method | Description | Return type
309
367
`Subscription()` | Returns the consumer's subscription name | `string`
310
368
`Unsubcribe()` | Unsubscribes the consumer from the assigned topic. Throws an error if the unsubscribe operation is somehow unsuccessful. | `error`
311
369
`Receive(context.Context)` | Receives a single message from the topic. This method blocks until a message is available. | `(Message, error)`
370
+
`Chan()` | Chan returns a channel from which to consume messages. | `<-chan ConsumerMessage`
312
371
`Ack(Message)` | [Acknowledges](reference-terminology.md#acknowledgment-ack) a message to the Pulsar [broker](reference-terminology.md#broker) |
313
372
`AckID(MessageID)` | [Acknowledges](reference-terminology.md#acknowledgment-ack) a message to the Pulsar [broker](reference-terminology.md#broker) by message ID |
373
+
`ReconsumeLater(msg Message, delay time.Duration)` | ReconsumeLater mark a message for redelivery after custom delay |
314
374
`Nack(Message)` | Acknowledge the failure to process a single message. |
315
375
`NackID(MessageID)` | Acknowledge the failure to process a single message. |
316
376
`Seek(msgID MessageID)` | Reset the subscription associated with this consumer to a specific message id. The message id can either be a specific message or represent the first or last messages in the topic. | `error`
317
377
`SeekByTime(time time.Time)` | Reset the subscription associated with this consumer to a specific message publish time. | `error`
318
378
`Close()` | Closes the consumer, disabling its ability to receive messages from the broker |
379
+
`Name()` | Name returns the name of consumer | `string`
| NackRedeliveryDelay | The delay after which to redeliver the messages that failed to be processed | 1min |
479
585
| ReadCompacted | If enabled, the consumer will read messages from the compacted topic rather than reading the full message backlog of the topic | false |
480
586
| ReplicateSubscriptionState | Mark the subscription as replicated to keep it in sync across clusters | false |
587
+
| KeySharedPolicy | Configuration for Key Shared consumer policy. ||
588
+
| RetryEnable | Auto retry send messages to default filled DLQPolicy topics | false |
589
+
| Interceptors | A chain of interceptors. These interceptors are called at some points defined in the `ConsumerInterceptor` interface. ||
590
+
| MaxReconnectToBroker | MaxReconnectToBroker set the maximum retry number of reconnectToBroker. | ultimate |
591
+
| Schema | Schema set a custom schema type by passing an implementation of `Schema`| bytes[]|
481
592
482
593
## Readers
483
594
@@ -504,6 +615,8 @@ Method | Description | Return type
504
615
`Next(context.Context)` | Receives the next message on the topic (analogous to the `Receive` method for [consumers](#consumer-operations)). This method blocks until a message is available. | `(Message, error)`
505
616
`HasNext()` | Check if there is any message available to read from the current position| (bool, error)
506
617
`Close()` | Closes the reader, disabling its ability to receive messages from the broker | `error`
618
+
`Seek(MessageID)` | Reset the subscription associated with this reader to a specific message ID | `error`
619
+
`SeekByTime(time time.Time)` | Reset the subscription associated with this reader to a specific message publish time | `error`
507
620
508
621
### Reader example
509
622
@@ -666,7 +779,9 @@ The following methods parameters are available for `ProducerMessage` objects:
666
779
Parameter | Description
667
780
:---------|:-----------
668
781
`Payload` | The actual data payload of the message
782
+
`Value` | Value and payload is mutually exclusive, `Value interface{}` for schema message.
669
783
`Key` | The optional key associated with the message (particularly useful for things like topic compaction)
784
+
`OrderingKey` | OrderingKey sets the ordering key of the message.
670
785
`Properties` | A key-value map (both keys and values must be strings) for any application-specific metadata attached to the message
671
786
`EventTime` | The timestamp associated with the message
672
787
`ReplicationClusters` | The clusters to which this message will be replicated. Pulsar brokers handle message replication automatically; you should only change this setting if you want to override the broker default.
0 commit comments