-
Notifications
You must be signed in to change notification settings - Fork 985
MSK - Glue Schema registry demo using Python #2778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* python implementation * working version * working code * simplified code * final changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a super amazing work @vaibhavjainv! I just left some small comments.
logger.info("=== MSK AVRO Consumer Lambda started ===") | ||
|
||
try: | ||
record_count = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this.
try: | ||
record_count = 0 | ||
for record in event.records: | ||
record_count += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this.
# Add your business logic here | ||
# For example: save to database, send notifications, etc. | ||
|
||
logger.info(f"Successfully processed {record_count} records") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info(f"Successfully processed {record_count} records") | |
logger.info(f"Successfully processed {len(list(event.records))} records") |
aws-lambda-powertools>=3.15.0 | ||
|
||
# Avro serialization | ||
fastavro>=1.8.0 | ||
avro>=1.11.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws-lambda-powertools>=3.15.0 | |
# Avro serialization | |
fastavro>=1.8.0 | |
avro>=1.11.0 | |
aws-lambda-powertools[kafka-consumer-avro]>=3.15.0 |
logger.exception("Error in lambda_handler", extra={ | ||
"error": str(e), | ||
"error_type": type(e).__name__ | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.exception already propagate error type and name.
logger.exception("Error in lambda_handler", extra={ | |
"error": str(e), | |
"error_type": type(e).__name__ | |
}) | |
logger.exception("Error in lambda_handler") |
response = kafka_client.get_bootstrap_brokers(ClusterArn=cluster_arn) | ||
return response['BootstrapBrokerStringSaslIam'] | ||
except Exception as e: | ||
logger.exception("Failed to get bootstrap brokers", extra={"cluster_arn": cluster_arn}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.exception("Failed to get bootstrap brokers", extra={"cluster_arn": cluster_arn}) | |
logger.exception("Failed to get bootstrap brokers", cluster_arn=cluster_arn) |
Issue #, if available:
Description of changes:
Python implementation for MSK - Glue Schema registry demo.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.