Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
/** Represents a Kafka Event. **/
public class KafkaEvent {
private Map<String, List<KafkaEventRecord>> records;
private String eventSource;
private String eventSource;
private String eventSourceArn;
private String bootstrapServers;

@Data
@NoArgsConstructor
Expand Down
4 changes: 2 additions & 2 deletions aws-lambda-java-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>3.6.0</version>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -253,4 +253,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void testLoadKafkaEvent() {

assertThat(event).isNotNull();
assertThat(event.getEventSourceArn()).isEqualTo("arn:aws:kafka:us-east-1:123456789012:cluster/vpc-3432434/4834-3547-3455-9872-7929");
assertThat(event.getBootstrapServers()).isEqualTo("b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092");

KafkaEvent.KafkaEventRecord record = event.getRecords().get("mytopic-01").get(0);
assertThat(record.getValue()).decodedAsBase64().asString().isEqualTo("Hello from Kafka !!");
Expand Down
3 changes: 2 additions & 1 deletion aws-lambda-java-tests/src/test/resources/kafka_event.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"eventSource": "aws:kafka",
"eventSourceArn": "arn:aws:kafka:us-east-1:123456789012:cluster/vpc-3432434/4834-3547-3455-9872-7929",
"bootstrapServers": "b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092",
"records": {
"mytopic-01": [
{
Expand All @@ -13,4 +14,4 @@
}
]
}
}
}