Insert timestamp field¶
The following example will insert a field timestamp into the value of the record.
{
"transforms" : "timestampNowField",
"transforms.timestampNowField.type" : "com.github.jcustenborder.kafka.connect.transform.common.TimestampNowField$Value",
"transforms.timestampNowField.fields" : "timestamp"
}
{
"topic" : "testing",
"kafkaPartition" : 1,
"valueSchema" : {
"type" : "STRUCT",
"isOptional" : false,
"fieldSchemas" : {
"firstName" : {
"type" : "STRING",
"isOptional" : true
},
"lastName" : {
"type" : "STRING",
"isOptional" : true
}
}
},
"value" : {
"schema" : {
"type" : "STRUCT",
"isOptional" : false,
"fieldSchemas" : {
"firstName" : {
"type" : "STRING",
"isOptional" : true
},
"lastName" : {
"type" : "STRING",
"isOptional" : true
}
}
},
"fieldValues" : [ {
"name" : "firstName",
"schema" : {
"type" : "STRING",
"isOptional" : true
},
"storage" : "example"
}, {
"name" : "lastName",
"schema" : {
"type" : "STRING",
"isOptional" : true
},
"storage" : "user"
} ]
},
"timestamp" : 123412351,
"timestampType" : "NO_TIMESTAMP_TYPE",
"offset" : 12345,
"headers" : [ ]
}
Change(s) in the output are emphasized if delta(s) are detected.
{
"topic" : "testing",
"kafkaPartition" : 1,
"valueSchema" : {
"type" : "STRUCT",
"isOptional" : false,
"fieldSchemas" : {
"firstName" : {
"type" : "STRING",
"isOptional" : true
},
"lastName" : {
"type" : "STRING",
"isOptional" : true
},
"timestamp" : {
"name" : "org.apache.kafka.connect.data.Timestamp",
"type" : "INT64",
"version" : 1,
"isOptional" : false
}
}
},
"value" : {
"schema" : {
"type" : "STRUCT",
"isOptional" : false,
"fieldSchemas" : {
"firstName" : {
"type" : "STRING",
"isOptional" : true
},
"lastName" : {
"type" : "STRING",
"isOptional" : true
},
"timestamp" : {
"name" : "org.apache.kafka.connect.data.Timestamp",
"type" : "INT64",
"version" : 1,
"isOptional" : false
}
}
},
"fieldValues" : [ {
"name" : "firstName",
"schema" : {
"type" : "STRING",
"isOptional" : true
},
"storage" : "example"
}, {
"name" : "lastName",
"schema" : {
"type" : "STRING",
"isOptional" : true
},
"storage" : "user"
}, {
"name" : "timestamp",
"schema" : {
"name" : "org.apache.kafka.connect.data.Timestamp",
"type" : "INT64",
"version" : 1,
"isOptional" : false
},
"storage" : 1665683591820
} ]
},
"timestamp" : 123412351,
"timestampType" : "NO_TIMESTAMP_TYPE",
"offset" : 12345,
"headers" : [ ]
}