Skip to content

Commit

Permalink
feat : fixes issue with parsing data received
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Mar 18, 2024
1 parent 4db9b0a commit d11aee2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ public Consumer<Flux<List<Record>>> consumeEvent() {
kinessRecord.partitionKey(),
kinessRecord.approximateArrivalTimestamp());

String utf8String = kinessRecord.data().asUtf8String();
String substring =
utf8String.substring(utf8String.indexOf("[{"));
String recordString =
new String(kinessRecord.data().asByteArray());
String payload =
recordString.substring(recordString.indexOf("[{"));
List<IpAddressDTO> ipAddressDTOS;
try {
ipAddressDTOS =
objectMapper.readValue(
substring, new TypeReference<>() {});
payload, new TypeReference<>() {});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ spring.cloud.function.definition=producerSupplier;consumeEvent
spring.cloud.stream.bindings.producerSupplier-out-0.destination=my-test-stream

spring.cloud.stream.kinesis.binder.autoAddShards=true
spring.cloud.stream.kinesis.binder.auto-create-stream=true
spring.cloud.stream.kinesis.binder.auto-create-stream=false

spring.testcontainers.beans.startup=parallel

0 comments on commit d11aee2

Please sign in to comment.