JAVA-14987 Minor cleanup (#13113)
This commit is contained in:
parent
c5d0dbfc10
commit
f1dfbf1f46
|
@ -22,13 +22,15 @@ public class IpConsumer {
|
||||||
|
|
||||||
@Value("${ips.stream}")
|
@Value("${ips.stream}")
|
||||||
private String IPS_STREAM;
|
private String IPS_STREAM;
|
||||||
|
|
||||||
@Value("${ips.shard.id}")
|
@Value("${ips.shard.id}")
|
||||||
private String IPS_SHARD_ID;
|
private String IPS_SHARD_ID;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AmazonKinesis kinesis;
|
private AmazonKinesis kinesis;
|
||||||
|
|
||||||
private GetShardIteratorResult shardIterator;
|
private GetShardIteratorResult shardIterator;
|
||||||
|
|
||||||
|
|
||||||
@StreamListener(Sink.INPUT)
|
@StreamListener(Sink.INPUT)
|
||||||
public void consume(String ip) {
|
public void consume(String ip) {
|
||||||
System.out.println(ip);
|
System.out.println(ip);
|
||||||
|
@ -40,8 +42,7 @@ public class IpConsumer {
|
||||||
recordsRequest.setLimit(25);
|
recordsRequest.setLimit(25);
|
||||||
|
|
||||||
GetRecordsResult recordsResult = kinesis.getRecords(recordsRequest);
|
GetRecordsResult recordsResult = kinesis.getRecords(recordsRequest);
|
||||||
while (!recordsResult.getRecords()
|
while (!recordsResult.getRecords().isEmpty()) {
|
||||||
.isEmpty()) {
|
|
||||||
recordsResult.getRecords()
|
recordsResult.getRecords()
|
||||||
.stream()
|
.stream()
|
||||||
.map(record -> new String(record.getData()
|
.map(record -> new String(record.getData()
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class IpProducer {
|
||||||
|
|
||||||
@Value("${ips.partition.key}")
|
@Value("${ips.partition.key}")
|
||||||
private String IPS_PARTITION_KEY;
|
private String IPS_PARTITION_KEY;
|
||||||
|
|
||||||
@Value("${ips.stream}")
|
@Value("${ips.stream}")
|
||||||
private String IPS_STREAM;
|
private String IPS_STREAM;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.baeldung;
|
package com.baeldung;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
@ -24,8 +22,10 @@ public class KinesisApplication {
|
||||||
|
|
||||||
@Value("${aws.access.key}")
|
@Value("${aws.access.key}")
|
||||||
private String accessKey;
|
private String accessKey;
|
||||||
|
|
||||||
@Value("${aws.secret.key}")
|
@Value("${aws.secret.key}")
|
||||||
private String secretKey;
|
private String secretKey;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Processor processor;
|
private Processor processor;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ public class KinesisApplication {
|
||||||
SpringApplication.run(KinesisApplication.class, args);
|
SpringApplication.run(KinesisApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public AmazonKinesis buildAmazonKinesis() {
|
public AmazonKinesis buildAmazonKinesis() {
|
||||||
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
|
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
cloud.aws.credentials.access-key=aws-key
|
|
||||||
cloud.aws.credentials.secret-key=aws-secret
|
|
||||||
cloud.aws.region.static=eu-central-1
|
|
||||||
cloud.aws.stack.auto=false
|
|
||||||
|
|
||||||
aws.access.key=my-aws-access-key-goes-here
|
aws.access.key=my-aws-access-key-goes-here
|
||||||
aws.secret.key=my-aws-secret-key-goes-here
|
aws.secret.key=my-aws-secret-key-goes-here
|
||||||
|
|
||||||
spring.cloud.stream.bindings.output.destination=myStream
|
cloud.aws.credentials.access-key=my-aws-access-key
|
||||||
|
cloud.aws.credentials.secret-key=my-aws-secret-key
|
||||||
|
cloud.aws.region.static=eu-central-1
|
||||||
|
cloud.aws.stack.auto=false
|
||||||
|
|
||||||
spring.cloud.stream.bindings.input.destination=live-ips
|
spring.cloud.stream.bindings.input.destination=live-ips
|
||||||
spring.cloud.stream.bindings.input.group=live-ips-group
|
spring.cloud.stream.bindings.input.group=live-ips-group
|
||||||
spring.cloud.stream.bindings.input.content-type=text/plain
|
spring.cloud.stream.bindings.input.content-type=text/plain
|
||||||
|
|
||||||
|
spring.cloud.stream.bindings.output.destination=myStream
|
||||||
|
spring.cloud.stream.bindings.output.content-type=text/plain
|
||||||
|
|
||||||
ips.partition.key=ips-partition-key
|
ips.partition.key=ips-partition-key
|
||||||
ips.stream=ips-stream
|
ips.stream=ips-stream
|
Loading…
Reference in New Issue