pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] revans2 commented on issue #1000: Make sure nextTuple emits tuple with non-null values
Date Thu, 01 Jan 1970 00:00:00 GMT
revans2 commented on issue #1000: Make sure nextTuple emits tuple with non-null values
URL: https://github.com/apache/incubator-pulsar/pull/1000#issuecomment-353431864
 
 
   I am not sure this is the best solution.  You are using recursion to try and fix a problem
that should be simple to do in an iterative way.
   
   Why not have mapToValueAndEmit just return a boolean saying did I emit something or not,
and then loop until something is emitted.
   For Example
   ```
                if (LOG.isDebugEnabled()) {
                    LOG.debug("[{}] Receiving the next message from pulsar consumer to emit
to the collector", spoutId);
                }
                try {
                    boolean done=false;
                    while (!done) {
                        msg = consumer.receive(1, TimeUnit.SECONDS);
                        if (msg != null) {
                            ++messagesReceived;
                            messageSizeReceived += msg.getData().length;
                            done = mapToValueAndEmit(msg);
                        } else {
                           //There was nothing queued to emit so don't try again right now.
                           done = true;
                        }
                   }
                } catch (PulsarClientException e) {
                    LOG.error("[{}] Error receiving message from pulsar consumer", spoutId,
e);
                }
   ``` 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message