Provides a code example for using timestamps on HPE Ezmeral Data Fabric Event Store streams and topics.
The timestamp value can be passed as part of the ProducerRecord, for
example:
ProducerRecord<String, String> producerRecord =
new ProducerRecord<String, String>(topicName, partition, timestamp, key, value);
createtime.
If the timestamp type is logappendtime, then the timestamp value is ignored
and instead the server timestamp is used.// Create stream with default timestamp type as "LogAppendTime"
// Create a topic with timestamp type as "CreateTime"
Configuration conf = new Configuration();
Admin streamAdmin = Streams.newAdmin(conf);
// Create a stream
StreamDescriptor sDesc = Streams.newStreamDescriptor();
sDesc.setDefaultTimestampType(TimestampType.LOG_APPEND_TIME);
streamAdmin.createStream(streamName, sDesc);
// Create a topic
TopicDescriptor tDesc = Streams.newTopicDescriptor();
tDesc.setTimestampType(TimestampType.CREATE_TIME);
streamAdmin.createTopic(streamName, topicName, tDesc);
// Get topic timestamp type
TopicDescriptor rDesc = streamAdmin.getTopicDescriptor(streamName, topicName);
System.out.println(rDesc.getTimestampType().name);