Skip to content

Commit 8fa6e4e

Browse files
committed
merge upstream main into docs-23836-client-download-links
2 parents 5b59795 + c0271a7 commit 8fa6e4e

2,968 files changed

Lines changed: 269863 additions & 7069 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-build-site.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
name: Build and publish pulsar website-next
3232
runs-on: ubuntu-latest
3333
timeout-minutes: 600
34+
permissions:
35+
contents: write
3436
steps:
3537
- uses: actions/checkout@v6
3638
with:
@@ -39,7 +41,6 @@ jobs:
3941
with:
4042
ref: 'asf-site-next'
4143
path: tmp/asf-site-next
42-
token: ${{ secrets.PULSARBOT_TOKEN }}
4344
- name: Install poetry
4445
run: pipx install poetry
4546
- uses: actions/setup-python@v6
@@ -53,6 +54,8 @@ jobs:
5354
- run: corepack enable
5455
- name: Update generated docs
5556
working-directory: tools/pytools
57+
env:
58+
GITHUB_TOKEN: ${{ github.token }}
5659
run: |
5760
poetry install
5861
poetry run bin/site-publisher.py --site-path=$GITHUB_WORKSPACE/tmp/asf-site-next

client-libraries/consumers.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ Create a new consumer and subscribe with the `Exclusive` subscription type.
7979
<TabItem value="Java">
8080
8181
```java
82-
Consumer consumer = client.newConsumer()
82+
Consumer<byte[]> consumer = client.newConsumer()
8383
.topic("my-topic")
8484
.subscriptionName("my-subscription")
8585
.subscriptionType(SubscriptionType.Exclusive)
86-
.subscribe()
86+
.subscribe();
8787
```
8888
8989
</TabItem>
@@ -117,18 +117,18 @@ Create new consumers and subscribe with the `Failover` subscription type.
117117
<TabItem value="Java">
118118
119119
```java
120-
Consumer consumer1 = client.newConsumer()
120+
Consumer<byte[]> consumer1 = client.newConsumer()
121121
.topic("my-topic")
122122
.subscriptionName("my-subscription")
123123
.subscriptionType(SubscriptionType.Failover)
124-
.subscribe()
125-
Consumer consumer2 = client.newConsumer()
124+
.subscribe();
125+
Consumer<byte[]> consumer2 = client.newConsumer()
126126
.topic("my-topic")
127127
.subscriptionName("my-subscription")
128128
.subscriptionType(SubscriptionType.Failover)
129-
.subscribe()
130-
//conumser1 is the active consumer, consumer2 is the standby consumer.
131-
//consumer1 receives 5 messages and then crashes, consumer2 takes over as an active consumer.
129+
.subscribe();
130+
//consumer1 is the active consumer, consumer2 is the standby consumer.
131+
//consumer1 receives 5 messages and then crashes, consumer2 takes over as an active consumer.
132132
```
133133
134134
</TabItem>
@@ -184,17 +184,17 @@ Create new consumers and subscribe with `Shared` subscription type.
184184
<TabItem value="Java">
185185
186186
```java
187-
Consumer consumer1 = client.newConsumer()
187+
Consumer<byte[]> consumer1 = client.newConsumer()
188188
.topic("my-topic")
189189
.subscriptionName("my-subscription")
190190
.subscriptionType(SubscriptionType.Shared)
191-
.subscribe()
191+
.subscribe();
192192
193-
Consumer consumer2 = client.newConsumer()
193+
Consumer<byte[]> consumer2 = client.newConsumer()
194194
.topic("my-topic")
195195
.subscriptionName("my-subscription")
196196
.subscriptionType(SubscriptionType.Shared)
197-
.subscribe()
197+
.subscribe();
198198
//Both consumer1 and consumer2 are active consumers.
199199
```
200200
@@ -253,17 +253,17 @@ When using Key_Shared subscriptions, producers **must** either **disable batchin
253253
<TabItem value="Java">
254254
255255
```java
256-
Consumer consumer1 = client.newConsumer()
256+
Consumer<byte[]> consumer1 = client.newConsumer()
257257
.topic("my-topic")
258258
.subscriptionName("my-subscription")
259259
.subscriptionType(SubscriptionType.Key_Shared)
260-
.subscribe()
260+
.subscribe();
261261
262-
Consumer consumer2 = client.newConsumer()
262+
Consumer<byte[]> consumer2 = client.newConsumer()
263263
.topic("my-topic")
264264
.subscriptionName("my-subscription")
265265
.subscriptionType(SubscriptionType.Key_Shared)
266-
.subscribe()
266+
.subscribe();
267267
//Both consumer1 and consumer2 are active consumers.
268268
```
269269

client-libraries/java-use.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ In Pulsar, consumers subscribe to topics and handle messages that producers publ
5454
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).
5555
5656
```java
57-
Consumer consumer = client.newConsumer()
57+
Consumer<byte[]> consumer = client.newConsumer()
5858
.topic("my-topic")
5959
.subscriptionName("my-subscription")
6060
.subscribe();
@@ -65,7 +65,7 @@ The `subscribe` method will auto-subscribe the consumer to the specified topic a
6565
```java
6666
while (true) {
6767
// Wait for a message
68-
Message msg = consumer.receive();
68+
Message<byte[]> msg = consumer.receive();
6969
7070
try {
7171
// Do something with the message
@@ -83,16 +83,16 @@ while (true) {
8383
If you don't want to block your main thread but constantly listen for new 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.
8484
8585
```java
86-
MessageListener myMessageListener = (consumer, msg) -> {
86+
MessageListener<byte[]> myMessageListener = (consumer, msg) -> {
8787
try {
8888
System.out.println("Message received: " + new String(msg.getData()));
8989
consumer.acknowledge(msg);
9090
} catch (Exception e) {
9191
consumer.negativeAcknowledge(msg);
9292
}
93-
}
93+
};
9494
95-
Consumer consumer = client.newConsumer()
95+
Consumer<byte[]> consumer = client.newConsumer()
9696
.topic("my-topic")
9797
.subscriptionName("my-subscription")
9898
.messageListener(myMessageListener)
@@ -108,13 +108,13 @@ The following is an example.
108108
```java
109109
byte[] msgIdBytes = // Some message ID byte array
110110
MessageId id = MessageId.fromByteArray(msgIdBytes);
111-
Reader reader = pulsarClient.newReader()
111+
Reader<byte[]> reader = pulsarClient.newReader()
112112
.topic(topic)
113113
.startMessageId(id)
114114
.create();
115115
116116
while (true) {
117-
Message message = reader.readNext();
117+
Message<byte[]> message = reader.readNext();
118118
// Process message
119119
}
120120
```

client-libraries/node-configs.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ The following configurable parameters are available for Pulsar Node.js clients:
1818
| `ioThreads` | The number of threads to use for handling connections to Pulsar [brokers](pathname:///docs/reference-terminology#broker). | 1 |
1919
| `messageListenerThreads` | The number of threads used by message listeners ([consumers](#consumers) and [readers](#readers)). | 1 |
2020
| `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. | |
2224
| `tlsValidateHostname` | The boolean value of setup whether to enable TLS hostname verification. | `false` |
2325
| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar client accepts untrusted TLS certificate from broker. | `false` |
2426
| `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. | |
2631

2732

2833
## Producer configs

client-libraries/producers.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -411,19 +411,20 @@ The following is an example:
411411
values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"},{"label":"Go","value":"Go"},{"label":"Python","value":"Python"}]}>
412412
<TabItem value="Java">
413413
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, 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):
415415
416416
```java
417417
public interface MessageRouter extends Serializable {
418-
int choosePartition(Message msg);
418+
int choosePartition(Message<?> msg, TopicMetadata metadata);
419419
}
420420
```
421421
422422
The following router routes every message to partition 10:
423423
424424
```java
425425
public class AlwaysTenRouter implements MessageRouter {
426-
public int choosePartition(Message msg) {
426+
@Override
427+
public int choosePartition(Message<?> msg, TopicMetadata metadata) {
427428
return 10;
428429
}
429430
}
@@ -627,21 +628,28 @@ To intercept messages, you can add a `ProducerInterceptor` or multiple ones when
627628
```java
628629
Producer<byte[]> producer = client.newProducer()
629630
.topic(topic)
630-
.intercept(new ProducerInterceptor {
631-
@Override
632-
boolean eligible(Message message) {
633-
return true; // process all messages
634-
}
635-
636-
@Override
637-
Message beforeSend(Producer producer, Message message) {
638-
// user-defined processing logic
639-
}
640-
641-
@Override
642-
void onSendAcknowledgement(Producer producer, Message message, MessageId msgId, Throwable exception) {
643-
// user-defined processing logic
644-
}
631+
.intercept(new ProducerInterceptor() {
632+
@Override
633+
public void close() {
634+
// release any resources held by the interceptor
635+
}
636+
637+
@Override
638+
public boolean eligible(Message<?> message) {
639+
return true; // process all messages
640+
}
641+
642+
@Override
643+
public Message<?> beforeSend(Producer<?> producer, Message<?> message) {
644+
// user-defined processing logic; return the (possibly modified) message
645+
return message;
646+
}
647+
648+
@Override
649+
public void onSendAcknowledgement(Producer<?> producer, Message<?> message,
650+
MessageId msgId, Throwable exception) {
651+
// user-defined processing logic
652+
}
645653
})
646654
.create();
647655
```

client-libraries/websocket.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ All exchanges via the WebSocket API use JSON.
8181
### Authentication
8282

8383
#### Browser javascript WebSocket client
84+
> For security reasons, we suggest passing the token as headers rather than as query parameters.
8485
8586
Use the query param `token` to transport the authentication token.
8687

contribute/personal-ci.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ For example:
2828
## CI workflows in a fork
2929

3030
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.
3233

3334
Here are the steps to use your personal CI on GitHub:
3435

data/release-java.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
module.exports = [
2+
{
3+
"tagName": "v4.2.1",
4+
"vtag": "4.2.x",
5+
"releaseNotes": "/release-notes/versioned/client-java-4.2.1/",
6+
"doc": "/docs/4.2.x/client-libraries-java",
7+
"version": "v4.2.x"
8+
},
29
{
310
"tagName": "v4.2.0",
411
"vtag": "4.2.x",
512
"releaseNotes": "/release-notes/versioned/client-java-4.2.0/",
613
"doc": "/docs/4.2.x/client-libraries-java",
7-
"version": "v4.2.x"
14+
"version": ""
815
},
916
{
1017
"tagName": "v4.1.3",
@@ -34,12 +41,19 @@ module.exports = [
3441
"doc": "/docs/4.1.x/client-libraries-java",
3542
"version": ""
3643
},
44+
{
45+
"tagName": "v4.0.10",
46+
"vtag": "4.0.x",
47+
"releaseNotes": "/release-notes/versioned/client-java-4.0.10/",
48+
"doc": "/docs/4.0.x/client-libraries-java",
49+
"version": "v4.0.x"
50+
},
3751
{
3852
"tagName": "v4.0.9",
3953
"vtag": "4.0.x",
4054
"releaseNotes": "/release-notes/versioned/client-java-4.0.9/",
4155
"doc": "/docs/4.0.x/client-libraries-java",
42-
"version": "v4.0.x"
56+
"version": ""
4357
},
4458
{
4559
"tagName": "v4.0.8",
@@ -237,12 +251,19 @@ module.exports = [
237251
"doc": "/docs/3.1.x/client-libraries-java",
238252
"version": ""
239253
},
254+
{
255+
"tagName": "v3.0.17",
256+
"vtag": "3.0.x",
257+
"releaseNotes": "/release-notes/versioned/client-java-3.0.17/",
258+
"doc": "/docs/3.0.x/client-libraries-java",
259+
"version": "v3.0.x"
260+
},
240261
{
241262
"tagName": "v3.0.16",
242263
"vtag": "3.0.x",
243264
"releaseNotes": "/release-notes/versioned/client-java-3.0.16/",
244265
"doc": "/docs/3.0.x/client-libraries-java",
245-
"version": "v3.0.x"
266+
"version": ""
246267
},
247268
{
248269
"tagName": "v3.0.15",

0 commit comments

Comments
 (0)