You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/03 19:39:27 UTC
[GitHub] [pulsar-client-node] jbmusso commented on issue #78: Error: Failed to send message: AlreadyClosed
jbmusso commented on issue #78:
URL: https://github.com/apache/pulsar-client-node/issues/78#issuecomment-1236187846
I'm new to Pulsar and I'm having the exact same issue, when running the official examples using:
* pulsar-client: 1.6.2
* libpulsar/2.10.1_1
* Node 18.8.0
* Apache Pulsar 2.10.1
Official `producer.js` example:
```javascript
const Pulsar = require('pulsar-client');
(async () => {
// Create a client
const client = new Pulsar.Client({
serviceUrl: 'pulsar://localhost:6650',
});
// Create a producer
const producer = await client.createProducer({
topic: 'my-topic',
});
// Send messages
for (let i = 0; i < 10; i += 1) {
const msg = `my-message-${i}`;
producer.send({
data: Buffer.from(msg),
});
console.log(`Sent message: ${msg}`);
}
await producer.flush();
await producer.close();
await client.close();
})();
```
Output of running `node producer.js`:
```
2022-09-03 21:29:38.915 INFO [0x16f867000] ExecutorService:41 | Run io_service in a single thread
2022-09-03 21:29:38.916 INFO [0x16dfc3000] ClientConnection:189 | [<none> -> pulsar://localhost:6650] Create ClientConnection, timeout=10000
2022-09-03 21:29:38.916 INFO [0x16dfc3000] ConnectionPool:96 | Created connection for pulsar://localhost:6650
2022-09-03 21:29:38.918 WARN [0x16f867000] ClientConnection:436 | [<none> -> pulsar://localhost:6650] Failed to establish connection: Connection refused
2022-09-03 21:29:38.919 INFO [0x16f867000] ClientConnection:375 | [127.0.0.1:57853 -> 127.0.0.1:6650] Connected to broker
2022-09-03 21:29:38.956 INFO [0x16f867000] HandlerBase:64 | [persistent://public/default/my-topic, ] Getting connection from pool
2022-09-03 21:29:39.013 INFO [0x16f867000] ProducerImpl:189 | [persistent://public/default/my-topic, ] Created producer on broker [127.0.0.1:57853 -> 127.0.0.1:6650]
Sent message: my-message-0
Sent message: my-message-1
Sent message: my-message-2
Sent message: my-message-3
Sent message: my-message-4
Sent message: my-message-5
Sent message: my-message-6
Sent message: my-message-7
Sent message: my-message-8
Sent message: my-message-9
2022-09-03 21:29:39.037 INFO [0x16dfc3000] ProducerImpl:661 | [persistent://public/default/my-topic, standalone-0-54] Closing producer for topic persistent://public/default/my-topic
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: Failed to send message: AlreadyClosed]
Node.js v18.8.0
2022-09-03 21:29:39.038 INFO [0x16f867000] ProducerImpl:704 | [persistent://public/default/my-topic, standalone-0-54] Closed producer
```
Environment info:
Output of `brew info libpulsar`
```
==> libpulsar: stable 2.10.1 (bottled)
Apache Pulsar C++ library
https://pulsar.apache.org/
/opt/homebrew/Cellar/libpulsar/2.10.1_1 (57 files, 14.4MB) *
Poured from bottle on 2022-09-03 at 16:24:09
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libpulsar.rb
License: Apache-2.0
==> Dependencies
Build: cmake ✔, pkg-config ✔
Required: boost ✔, openssl@1.1 ✔, protobuf ✔, snappy ✔, zstd ✔
==> Analytics
install: 250 (30 days), 898 (90 days), 3,403 (365 days)
install-on-request: 251 (30 days), 899 (90 days), 3,404 (365 days)
build-error: 1 (30 days)
```
I installed the C++ client with the installation instructions here: https://pulsar.apache.org/docs/client-libraries-cpp/#compilation
Let me know if I should open another issue. I don't know C++ but it appears that the patch added in https://github.com/apache/pulsar-client-node/pull/85 isn't in current `master`: https://github.com/apache/pulsar-client-node/blob/8893e47e87118f89ad324ccf5e60785eabc5b34d/src/Client.cc -- unsure if this is related or not.
Thanks.
--
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.
To unsubscribe, e-mail: dev-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org