Skip to content

When the ShardConsumer is started the sequenceNumber is always logged as NULL  #146

@sergiupantiru

Description

@sergiupantiru

Hello,

While looking into the logging I've noticed that whenever I start the application the sequenceNumber is always null.

INFO --- [-kinesis-consumer-1] nesis.KinesisMessageDrivenChannelAdapter : The [ShardConsumer{shardOffset=KinesisShardOffset{iteratorType=TRIM_HORIZON, sequenceNumber='null', timestamp=null, stream='xxxxxxx', shard='shardId-000000000000', reset=false}, state=NEW}] has been started.

I've looked into the code and the log method is performed before we set the sequenceNumber.

try {
	if (logger.isInfoEnabled() && this.state == ConsumerState.NEW) {
		logger.info("The [" + this + "] has been started.");
	}
	if (this.shardOffset.isReset()) {
		this.checkpointer.remove();
	}
	else {
		String checkpoint = this.checkpointer.getCheckpoint();
		if (checkpoint != null) {
			this.shardOffset.setSequenceNumber(checkpoint);
			this.shardOffset.setIteratorType(ShardIteratorType.AFTER_SEQUENCE_NUMBER);
		}
	}
	GetShardIteratorRequest shardIteratorRequest = this.shardOffset.toShardIteratorRequest();
	this.shardIterator =
			KinesisMessageDrivenChannelAdapter.this.amazonKinesis
					.getShardIterator(shardIteratorRequest)
					.getShardIterator();
	if (ConsumerState.STOP != this.state) {
		this.state = ConsumerState.CONSUME;
	}
}

I think it would make more sense to first load the checkpoint and then log "The xxx has been started".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions