GoogleCloudPlatform / GoogleCloudPlatform/data-lineage-producer-java-library
Failure to wait for events to be sent when client closes ... GcpLineageTransportConfig
- Dominant language
- Java
- Stars
- 6
- Forks
- 7
- Avg merge
- 1h 45m
- Merged PRs (30d)
- 1
Description
I have a Java application that is loosely as follows:
```
GcpLineageTransportConfig gcpLineageTransportConfig = new GcpLineageTransportConfig();
gcpLineageTransportConfig.setProjectId("**********");
gcpLineageTransportConfig.setLocation("us-central1");
OpenLineageClient client = OpenLineageClient.
builder().
transport(new GcpLineageTransport(gcpLineageTransportConfig)).
build();
...
client.emit(runStateUpdate);
client.close();
```
What I find is that the application does *not* send the event. If I change the logic to:
```
client.emit(runStateUpdate);
System.out.println("Sleeping 5 seconds");
Thread.sleep(1000*5);
client.close();
```
the event is sent. What I believe is happening is that since the default is to transmit the event asynchronously (I.e. immediate return from `client.emit(...)`), I believe that `client.close()` is not waiting for queued event emission requests to be sent/flushed/processed. I believe this to be an error. The call to `client.close()` should block/wait for queued emitted events to be processed before returning.
Contributor guide
Assessment
This issue has not been assessed yet.