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
Copy file name to clipboardExpand all lines: client-libraries/java-use.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ In Pulsar, consumers subscribe to topics and handle messages that producers publ
54
54
Once you've instantiated a [PulsarClient](@pulsar:javadoc:client@/org/apache/pulsar/client/api/PulsarClient) object, you can create a [Consumer](@pulsar:javadoc:client@/org/apache/pulsar/client/api/Consumer) by specifying a [topic](pathname:///docs/reference-terminology#topic) and a [subscription](pathname:///docs/concepts-messaging#subscription-types).
55
55
56
56
```java
57
-
Consumer consumer = client.newConsumer()
57
+
Consumer<byte[]> consumer = client.newConsumer()
58
58
.topic("my-topic")
59
59
.subscriptionName("my-subscription")
60
60
.subscribe();
@@ -65,7 +65,7 @@ The `subscribe` method will auto-subscribe the consumer to the specified topic a
65
65
```java
66
66
while (true) {
67
67
// Wait for a message
68
-
Message msg = consumer.receive();
68
+
Message<byte[]> msg = consumer.receive();
69
69
70
70
try {
71
71
// Do something with the message
@@ -83,16 +83,16 @@ while (true) {
83
83
If you don't want to block your main thread but constantly listen fornew messages, consider using a `MessageListener`. The `MessageListener` will use a thread pool inside the PulsarClient. You can set the number of threads to use for message listeners in the ClientBuilder.
Copy file name to clipboardExpand all lines: client-libraries/node-configs.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,11 +18,16 @@ The following configurable parameters are available for Pulsar Node.js clients:
18
18
|`ioThreads`| The number of threads to use for handling connections to Pulsar [brokers](pathname:///docs/reference-terminology#broker). | 1 |
19
19
|`messageListenerThreads`| The number of threads used by message listeners ([consumers](#consumers) and [readers](#readers)). | 1 |
20
20
|`concurrentLookupRequest`| The number of concurrent lookup requests that can be sent on each broker connection. Setting a maximum helps to keep from overloading brokers. You should set values over the default of 50000 only if the client needs to produce and/or subscribe to thousands of Pulsar topics. | 50000 |
21
-
|`tlsTrustCertsFilePath`| The file path for the trusted TLS certificate. ||
21
+
|`tlsTrustCertsFilePath`| The file path for the trusted TLS certificate. If unset, the client falls back to a `cert.pem` file bundled with the package that is seeded from the Node.js runtime's root CAs at install time. | Bundled `cert.pem`|
22
+
|`tlsCertificateFilePath`| The file path for the client TLS certificate used for mTLS. ||
23
+
|`tlsPrivateKeyFilePath`| The file path for the client TLS private key used for mTLS. ||
22
24
|`tlsValidateHostname`| The boolean value of setup whether to enable TLS hostname verification. |`false`|
23
25
|`tlsAllowInsecureConnection`| The boolean value of setup whether the Pulsar client accepts untrusted TLS certificate from broker. |`false`|
24
26
|`statsIntervalInSeconds`| Interval between each stat info. Stats is activated with positive statsInterval. The value should be set to 1 second at least | 600 |
25
-
|`log`| A function that is used for logging. |`console.log`|
27
+
|`listenerName`| The listener name the client will use when connecting to the broker. Useful when [advertising multiple endpoints](pathname:///docs/concepts-multi-tenancy). ||
28
+
|`log`| A function that is used for logging. Receives `(level, file, line, message)` arguments. |`console.log`|
29
+
|`logLevel`| The log level for client-emitted logs. Accepts `LogLevel.DEBUG` (0), `LogLevel.INFO` (1), `LogLevel.WARN` (2), or `LogLevel.ERROR` (3). |`LogLevel.INFO`|
30
+
|`connectionTimeoutMs`| Duration (in milliseconds) to wait for a broker connection to establish before failing. ||
To use a custom message router, you need to provide an implementation of the [MessageRouter](@pulsar:javadoc:client@/org/apache/pulsar/client/api/MessageRouter) interface, which has just one `choosePartition` method:
414
+
To use a custom message router, you need to provide an implementation of the [MessageRouter](@pulsar:javadoc:client@/org/apache/pulsar/client/api/MessageRouter) interface. Implement the `choosePartition(Message<?>, TopicMetadata)` method (the single-argument overload is deprecated since 1.22.0):
415
415
416
416
```java
417
417
public interface MessageRouter extends Serializable {
418
-
int choosePartition(Message msg);
418
+
int choosePartition(Message<?> msg, TopicMetadata metadata);
419
419
}
420
420
```
421
421
422
422
The following router routes every message to partition 10:
423
423
424
424
```java
425
425
public class AlwaysTenRouter implements MessageRouter {
426
-
public int choosePartition(Message msg) {
426
+
@Override
427
+
public int choosePartition(Message<?> msg, TopicMetadata metadata) {
427
428
return 10;
428
429
}
429
430
}
@@ -627,21 +628,28 @@ To intercept messages, you can add a `ProducerInterceptor` or multiple ones when
Copy file name to clipboardExpand all lines: contribute/personal-ci.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,8 @@ For example:
28
28
## CI workflows in a fork
29
29
30
30
Before using personal CI workflows, ensure GitHub Actions is enabled for your fork in the GitHub UI. You can check this under your fork's "Settings" > "Actions" > "General" tab.
31
-
Choose the "Allow all actions and reusable workflows" option.
31
+
Choose the "Allow all actions and reusable workflows" option.
32
+
Note that some workflows, such as the required "Pulsar CI" and "Pulsar CI Flaky", may still be disabled by default and must be enabled explicitly. After enabling Actions for your forked repository, you can find these workflows in the "Actions" tab. To enable a workflow, select it from the left-hand sidebar and then click the "Enable workflow" button.
32
33
33
34
Here are the steps to use your personal CI on GitHub:
0 commit comments