本文整理匯總了Java中org.apache.kafka.connect.data.Schema.INT64_SCHEMA屬性的典型用法代碼示例。如果您正苦於以下問題:Java Schema.INT64_SCHEMA屬性的具體用法?Java Schema.INT64_SCHEMA怎麽用?Java Schema.INT64_SCHEMA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.kafka.connect.data.Schema
的用法示例。
在下文中一共展示了Schema.INT64_SCHEMA屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: poll
@Override
public List<SourceRecord> poll() throws InterruptedException {
long sendStartMs = System.currentTimeMillis();
if (throttler.shouldThrottle(seqno - startingSeqno, sendStartMs))
throttler.throttle();
long nowMs = System.currentTimeMillis();
Map<String, Object> data = new HashMap<>();
data.put("name", name);
data.put("task", id);
data.put("topic", this.topic);
data.put("time_ms", nowMs);
data.put("seqno", seqno);
String dataJson;
try {
dataJson = JSON_SERDE.writeValueAsString(data);
} catch (JsonProcessingException e) {
dataJson = "Bad data can't be written as json: " + e.getMessage();
}
System.out.println(dataJson);
Map<String, Long> ccOffset = Collections.singletonMap(SEQNO_FIELD, seqno);
SourceRecord srcRecord = new SourceRecord(partition, ccOffset, topic, Schema.INT32_SCHEMA, id, Schema.INT64_SCHEMA, seqno);
List<SourceRecord> result = Arrays.asList(srcRecord);
seqno++;
return result;
}
示例2: typeSchema
@Override
public Schema typeSchema() {
return Schema.INT64_SCHEMA;
}