chamikaramj commented on code in PR #39612:
URL: https://github.com/apache/beam/pull/39612#discussion_r3991537112
##########
sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/write/UnboundedSolaceWriter.java:
##########
@@ -218,6 +230,37 @@ public void publishResults(BeamContextWrapper context) {
}
}
+ public void waitForAcks(BeamContextWrapper context, Set<String>
messageIdsToAck) {
+ BlockingQueue<PublishResult> queue =
+ solaceSessionServiceWithProducer().getPublishedResultsQueue();
+ long timeoutMs = System.currentTimeMillis() + ACKS_FLUSHING_INTERVAL_SECS
* 1000;
+ while (!messageIdsToAck.isEmpty()) {
+ publishResults(context, messageIdsToAck);
+ if (messageIdsToAck.isEmpty()) {
+ break;
+ }
+ long remainingTimeMs = timeoutMs - System.currentTimeMillis();
+ if (remainingTimeMs <= 0) {
+ break;
+ }
+ try {
+ PublishResult result = queue.poll(remainingTimeMs,
TimeUnit.MILLISECONDS);
+ if (result != null) {
+ publishResults(context, result, messageIdsToAck);
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+ }
+ if (!messageIdsToAck.isEmpty()) {
+ LOG.warn(
Review Comment:
This can cause data loss ? Should we raise an exception here so that
subsequent bundle retries can try to get the ack/nack ?
If not, let's add a comment on why it's safe to just ignore non-acked
messages here.
--
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]