Augustin Lafanechere created BEAM-6424:
------------------------------------------

             Summary: RabbitMqIO: NullPointerException raised on getWatermark() 
first call
                 Key: BEAM-6424
                 URL: https://issues.apache.org/jira/browse/BEAM-6424
             Project: Beam
          Issue Type: Bug
          Components: io-ideas
            Reporter: Augustin Lafanechere
            Assignee: Eugene Kirpichov


I tried to use the RabbitMqIO with the direct runner to generate an unbounded 
PCollection from a queue. I encounter a NPE :
{quote}{{java.lang.NullPointerException}}
{{ at 
org.apache.beam.runners.direct.UnboundedReadEvaluatorFactory$UnboundedReadEvaluator.processElement
 (UnboundedReadEvaluatorFactory.java:169)}}
{{....}}
{quote}
After investigation it looks like it's caused by the fact that no default is 
given to 
checkpointMark.oldestTimestamp. getWatermark() is called before the mutation of 
the currentTimestamp variable, raising a NPE. I fixed the problem on my side, 
reimplementing the class and overriding getWatermark to return Instant.now()  
if checkpointMark.oldestTimestamp is null :
{quote}@Override
publicInstantgetWatermark() {
  if (checkpointMark.oldestTimestamp == null) {
    returnInstant.now();
  }
  return checkpointMark.oldestTimestamp;
}{quote}
It looks likes this bug as [already been raised 
here|https://jira.apache.org/jira/browse/BEAM-1240?focusedCommentId=16566869&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16566869]
 on the PR for RabbitMqIO.
 
 
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to