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


Java ConsumerConfigConstants类代码示例

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


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

示例1: main

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	ParameterTool pt = ParameterTool.fromArgs(args);

	StreamExecutionEnvironment see = StreamExecutionEnvironment.getExecutionEnvironment();
	see.setParallelism(1);

	Properties kinesisConsumerConfig = new Properties();
	kinesisConsumerConfig.setProperty(ConsumerConfigConstants.AWS_REGION, pt.getRequired("region"));
	kinesisConsumerConfig.setProperty(ConsumerConfigConstants.AWS_ACCESS_KEY_ID, pt.getRequired("accesskey"));
	kinesisConsumerConfig.setProperty(ConsumerConfigConstants.AWS_SECRET_ACCESS_KEY, pt.getRequired("secretkey"));

	DataStream<String> kinesis = see.addSource(new FlinkKinesisConsumer<>(
		"flink-test",
		new SimpleStringSchema(),
		kinesisConsumerConfig));

	kinesis.print();

	see.execute();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:ConsumeFromKinesis.java

示例2: testDateStringForValidateOptionDateProperty

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testDateStringForValidateOptionDateProperty() {
	String timestamp = "2016-04-04T19:58:46.480-00:00";

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, timestamp);

	try {
		KinesisConfigUtil.validateConsumerConfiguration(testConfig);
	} catch (Exception e) {
		e.printStackTrace();
		fail();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:KinesisConfigUtilTest.java

示例3: testUnixTimestampForValidateOptionDateProperty

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnixTimestampForValidateOptionDateProperty() {
	String unixTimestamp = "1459799926.480";

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, unixTimestamp);

	try {
		KinesisConfigUtil.validateConsumerConfiguration(testConfig);
	} catch (Exception e) {
		e.printStackTrace();
		fail();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:KinesisConfigUtilTest.java

示例4: testDateStringForUserDefinedDateFormatForValidateOptionDateProperty

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testDateStringForUserDefinedDateFormatForValidateOptionDateProperty() {
	String unixTimestamp = "2016-04-04";
	String pattern = "yyyy-MM-dd";

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, unixTimestamp);
	testConfig.setProperty(ConsumerConfigConstants.STREAM_TIMESTAMP_DATE_FORMAT, pattern);

	try {
		KinesisConfigUtil.validateConsumerConfiguration(testConfig);
	} catch (Exception e) {
		e.printStackTrace();
		fail();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:19,代码来源:KinesisConfigUtilTest.java

示例5: ShardConsumer

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
/** This constructor is exposed for testing purposes */
protected ShardConsumer(KinesisDataFetcher<T> fetcherRef,
						Integer subscribedShardStateIndex,
						KinesisStreamShard subscribedShard,
						SequenceNumber lastSequenceNum,
						KinesisProxyInterface kinesis) {
	this.fetcherRef = checkNotNull(fetcherRef);
	this.subscribedShardStateIndex = checkNotNull(subscribedShardStateIndex);
	this.subscribedShard = checkNotNull(subscribedShard);
	this.lastSequenceNum = checkNotNull(lastSequenceNum);
	checkArgument(
		!lastSequenceNum.equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get()),
		"Should not start a ShardConsumer if the shard has already been completely read.");

	this.deserializer = fetcherRef.getClonedDeserializationSchema();

	Properties consumerConfig = fetcherRef.getConsumerConfiguration();
	this.kinesis = kinesis;
	this.maxNumberOfRecordsPerFetch = Integer.valueOf(consumerConfig.getProperty(
		ConsumerConfigConstants.SHARD_GETRECORDS_MAX,
		Integer.toString(ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_MAX)));
	this.fetchIntervalMillis = Long.valueOf(consumerConfig.getProperty(
		ConsumerConfigConstants.SHARD_GETRECORDS_INTERVAL_MILLIS,
		Long.toString(ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_INTERVAL_MILLIS)));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:ShardConsumer.java

示例6: testUnrecognizableStreamInitPositionTypeInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnrecognizableStreamInitPositionTypeInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid initial position in stream");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "wrongInitPosition");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:KinesisConfigUtilTest.java

示例7: testStreamInitPositionTypeSetToAtTimestampButNoInitTimestampSetInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testStreamInitPositionTypeSetToAtTimestampButNoInitTimestampSetInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Please set value for initial timestamp ('"
			+ ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP + "') when using AT_TIMESTAMP initial position.");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:KinesisConfigUtilTest.java

示例8: testUnparsableDateForInitialTimestampInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnparsableDateForInitialTimestampInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for initial timestamp for AT_TIMESTAMP initial position in stream.");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, "unparsableDate");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:KinesisConfigUtilTest.java

示例9: testIllegalValueForInitialTimestampInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testIllegalValueForInitialTimestampInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for initial timestamp for AT_TIMESTAMP initial position in stream.");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, "-1.0");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:KinesisConfigUtilTest.java

示例10: testInvalidPatternForInitialTimestampInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testInvalidPatternForInitialTimestampInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for initial timestamp for AT_TIMESTAMP initial position in stream.");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, "2016-03-14");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_TIMESTAMP_DATE_FORMAT, "InvalidPattern");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:KinesisConfigUtilTest.java

示例11: testUnparsableDateForUserDefinedDateFormatForInitialTimestampInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnparsableDateForUserDefinedDateFormatForInitialTimestampInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for initial timestamp for AT_TIMESTAMP initial position in stream.");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.AWS_CREDENTIALS_PROVIDER, "BASIC");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "AT_TIMESTAMP");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, "stillUnparsable");
	testConfig.setProperty(ConsumerConfigConstants.STREAM_TIMESTAMP_DATE_FORMAT, "yyyy-MM-dd");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:KinesisConfigUtilTest.java

示例12: testUnparsableLongForDescribeStreamBackoffBaseMillisInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnparsableLongForDescribeStreamBackoffBaseMillisInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for describe stream operation base backoff milliseconds");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.STREAM_DESCRIBE_BACKOFF_BASE, "unparsableLong");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:KinesisConfigUtilTest.java

示例13: testUnparsableLongForDescribeStreamBackoffMaxMillisInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnparsableLongForDescribeStreamBackoffMaxMillisInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for describe stream operation max backoff milliseconds");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.STREAM_DESCRIBE_BACKOFF_MAX, "unparsableLong");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:KinesisConfigUtilTest.java

示例14: testUnparsableDoubleForDescribeStreamBackoffExponentialConstantInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnparsableDoubleForDescribeStreamBackoffExponentialConstantInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for describe stream operation backoff exponential constant");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.STREAM_DESCRIBE_BACKOFF_EXPONENTIAL_CONSTANT, "unparsableDouble");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:KinesisConfigUtilTest.java

示例15: testUnparsableIntForGetRecordsRetriesInConfig

import org.apache.flink.streaming.connectors.kinesis.config.ConsumerConfigConstants; //导入依赖的package包/类
@Test
public void testUnparsableIntForGetRecordsRetriesInConfig() {
	exception.expect(IllegalArgumentException.class);
	exception.expectMessage("Invalid value given for maximum retry attempts for getRecords shard operation");

	Properties testConfig = TestUtils.getStandardProperties();
	testConfig.setProperty(ConsumerConfigConstants.SHARD_GETRECORDS_RETRIES, "unparsableInt");

	KinesisConfigUtil.validateConsumerConfiguration(testConfig);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:KinesisConfigUtilTest.java


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