NurramoX opened a new issue, #23063:
URL: https://github.com/apache/pulsar/issues/23063

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Read release policy
   
   - [X] I understand that unsupported versions don't get bug fixes. I will 
attempt to reproduce the issue on a supported version of Pulsar client and 
Pulsar broker.
   
   
   ### Version
   
   ### Version
   
   OS: Arch Linux x86_64
   Kernel: 6.6.40-1-lts
   Java:
     - openjdk 17.0.12 2024-07-16
     - OpenJDK Runtime Environment (build 17.0.12+7)
     - OpenJDK 64-Bit Server VM (build 17.0.12+7, mixed mode, sharing)
   
   Apache Pulsar: 3.3.0 (using apachepulsar/pulsar:3.3.0 Docker image)
   
   Java Client Libraries:
   org.apache.pulsar:pulsar-client-original:3.3.0
   org.apache.pulsar:pulsar-client-admin-original:3.3.0
   
   ### Minimal reproduce step
   
   When adding a logging statement inside the "close" method of a custom sink 
connector, uploading it to a standalone cluster, and then deleting or stopping 
the connector, the logging statement is not executed as expected.
   
   
   
   Steps to reproduce:
   1. Set up a standalone Apache Pulsar cluster using Docker Compose. Docker 
Compose configuration:
   
   
   ```yaml
   services:
     pulsar:
       container_name: pulsar
       image: apachepulsar/pulsar:3.3.0
       ports:
         - "6650:6650"
         - "8080:8080"
         - "8081:8081"
       environment:
         - PULSAR_STANDALONE_USE_ZOOKEEPER=1
       command: ["bin/pulsar", "standalone"]
   ```
   
   2. Implement a custom sink connector with logging statements in "open" and 
"close" methods. Sink Connector:
   ```java
   public class SimpleSink implements Sink<String> {
       private Logger LOG = null;
       @Override
       public void open(Map<String, Object> config, SinkContext sinkContext) {
           LOG = sinkContext.getLogger();
           LOG.info("Hello world");
       }
       @Override
       public void write(Record<String> record) {
           String value = record.getValue();
           LOG.info("Recorded {}.", value);
           record.ack();
       }
       @Override
       public void close() {
           LOG.info("Bye world");
       }
   }
   ```
   3. Upload the sink connector to the Pulsar cluster. Sink Connector 
Configuration:
   ```yaml
   tenant: "simple-tenant"
   namespace: "simple-ns"
   name: "DataSink"
   className: "dev.nurramo.sink.SimpleDataSink"
   inputs: ["persistent://simple-tenant/simple-ns/output"]
   sourceSubscriptionName: "sub-1"
   
   ```
   4. Stop or delete the connector
   5. Check logs for the expected logging statements
   
   ### What did you expect to see?
   
   The logging statements in both the "open" and "close" methods should be 
executed and visible in the logs when the connector is started and then stopped 
or deleted.
   
   ### What did you see instead?
   
   Only the logging statement from the "open" method is visible in the logs. 
The "close" method's logging statement is not executed or logged when the 
connector is stopped or deleted.
   
   Here is how I confirmed that. :
   ```bash
   /pulsar/logs/functions/simple-tenant/simple-ns/DataSink $ cat *.log | grep 
world
   2024-07-22T21:42:01,615+0000 [simple-tenant/simple-ns/DataSink-0] INFO  
function-DataSink - Hello world
   ```
   "Bye world" was not listed anywhere
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to