当前位置: 首页>>代码示例>>Java>>正文


Java ConnectRecord类代码示例

本文整理汇总了Java中org.apache.kafka.connect.connector.ConnectRecord的典型用法代码示例。如果您正苦于以下问题:Java ConnectRecord类的具体用法?Java ConnectRecord怎么用?Java ConnectRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConnectRecord类属于org.apache.kafka.connect.connector包,在下文中一共展示了ConnectRecord类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertRecord

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
public static void assertRecord(ConnectRecord expected, ConnectRecord actual, String message) {
  final String prefix = null != message ? message + ": " : "";
  if (null == expected) {
    assertNull(actual, prefix + "actual should be null.");
    return;
  }

  assertNotNull(actual, prefix + "actual should not be null.");
  assertEquals(expected.kafkaPartition(), actual.kafkaPartition(), prefix + "kafkaPartition() does not match.");
  assertEquals(expected.topic(), actual.topic(), prefix + "topic() does not match.");
  assertEquals(expected.timestamp(), actual.timestamp(), prefix + "timestamp() does not match.");
  assertSchema(expected.keySchema(), actual.keySchema(), prefix + "keySchema() does not match");
  assertValue(expected.key(), actual.key(), prefix + "key() does not match.");
  assertSchema(expected.valueSchema(), actual.valueSchema(), prefix + "valueSchema() does not match");
  assertValue(expected.value(), actual.value(), prefix + "value() does not match.");
}
 
开发者ID:jcustenborder,项目名称:connect-utils,代码行数:17,代码来源:AssertConnectRecord.java

示例2: assertSourceRecord

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
void assertSourceRecord(final Map<String, ?> expected, final ConnectRecord record, final String topic) throws JsonProcessingException {
  assertNotNull(record, "record should not be null.");
  assertNotNull(record.value(), "record.value() should not be null.");
  assertEquals(topic, record.topic(), "topic does not match.");
  assertTrue(record.key() instanceof Struct, "record.key() should be a struct");
  assertTrue(record.value() instanceof Struct, "record.value() should be a struct");

  Struct keyStruct = (Struct) record.key();
  keyStruct.validate();

  Struct valueStruct = (Struct) record.value();
  valueStruct.validate();

  for (Map.Entry<String, ?> entry : expected.entrySet()) {
    Object structValue = valueStruct.get(entry.getKey());

    if (entry.getValue() instanceof Map) {
      String text = ObjectMapperFactory.INSTANCE.writeValueAsString(entry.getValue());
      String structText = (String) structValue;
      assertEquals(text, structText, entry.getKey() + " should match.");
    } else {
      assertEquals(entry.getValue(), structValue, entry.getKey() + " should match.");
    }
  }
}
 
开发者ID:jcustenborder,项目名称:kafka-connect-splunk,代码行数:26,代码来源:EventConverterTest.java

示例3: apply

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
@TestFactory
public Stream<DynamicTest> apply() throws IOException {
  List<TestCase> testCases = TestDataUtils.loadJsonResourceFiles(this.getClass().getPackage().getName() + ".records", TestCase.class);

  return testCases.stream().map(testCase -> dynamicTest(testCase.testName(), () -> {
    ConnectRecord actual = this.transformation.apply(testCase.input);
    assertRecord(testCase.expected, actual);
  }));
}
 
开发者ID:jcustenborder,项目名称:kafka-connect-transform-cef,代码行数:10,代码来源:CEFTransformationTest.java

示例4: requireSinkRecord

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
public static SinkRecord requireSinkRecord(ConnectRecord<?> record, String purpose) {
    if (!(record instanceof SinkRecord)) {
        throw new DataException("Only SinkRecord supported for [" + purpose + "], found: " + nullSafeClassName(record));
    }
    return (SinkRecord) record;
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:7,代码来源:Requirements.java

示例5: noOp

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
public static <R extends ConnectRecord<R>> TransformationChain<R> noOp() {
    return new TransformationChain<R>(Collections.<Transformation<R>>emptyList());
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:4,代码来源:TransformationChain.java

示例6: newTranformations

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
public <R extends ConnectRecord<R>> Transformation<R> newTranformations(
        String transformationClassOrAlias
) {
    return null;
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:6,代码来源:Plugins.java

示例7: ConnectTemplateHashModel

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
ConnectTemplateHashModel(ConnectRecord connectRecord, Struct struct) {
  this.connectRecord = connectRecord;
  this.struct = struct;
}
 
开发者ID:jcustenborder,项目名称:connect-utils,代码行数:5,代码来源:ConnectTemplateHashModel.java

示例8: execute

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
public String execute(String templateName, ConnectRecord record, Struct struct, Map<String, ?> additionalValues) {
  ConnectTemplateHashModel connectTemplateHashModel = new ConnectTemplateHashModel(record, struct);
  return executeInternal(templateName, connectTemplateHashModel);
}
 
开发者ID:jcustenborder,项目名称:connect-utils,代码行数:5,代码来源:StructTemplate.java

示例9: extract

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
@Override
public Long extract(ConnectRecord<?> record) {
  return Time.SYSTEM.milliseconds();
}
 
开发者ID:confluentinc,项目名称:kafka-connect-storage-common,代码行数:5,代码来源:TimeBasedPartitioner.java

示例10: shouldChangeSchema

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
boolean shouldChangeSchema(
    ConnectRecord<?> record,
    Schema currentkeySchema,
    Schema currentValueSchema
);
 
开发者ID:confluentinc,项目名称:kafka-connect-storage-common,代码行数:6,代码来源:SchemaCompatibility.java

示例11: extract

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
@Override
public Long extract(ConnectRecord<?> record) {
  return time.milliseconds();
}
 
开发者ID:confluentinc,项目名称:kafka-connect-storage-cloud,代码行数:5,代码来源:TopicPartitionWriterTest.java

示例12: extract

import org.apache.kafka.connect.connector.ConnectRecord; //导入依赖的package包/类
Long extract(ConnectRecord<?> record); 
开发者ID:confluentinc,项目名称:kafka-connect-storage-common,代码行数:2,代码来源:TimestampExtractor.java


注:本文中的org.apache.kafka.connect.connector.ConnectRecord类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。