Skip to content
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

Configurable Kafka Properties, Dev Container Java Update & GCS BLOB Support #59

Merged
merged 25 commits into from
Jun 11, 2024

Conversation

dmccoystephenson
Copy link
Contributor

@dmccoystephenson dmccoystephenson commented May 29, 2024

Make Kafka Properties Configurable

Problem

Some properties used by Kafka are hardcoded at this time and should be configurable.

Solution

Users can now set the following as environment variables:

  • kafka auto commit
  • auto commit interval
  • session timeout

Dev Container Java Version Update

Problem

The dev container for the project is not using Java 21 at this time.

Solution

The dev container has been updated to use Java 21.

Additional Changes

The launch.json file now references the .env file.

GCS BLOB Support

Problem

There is no support for depositing into GCS Cloud storage buckets at this time.

Solution

The ability to deposit kafka messages as BLOBs into a GCS Cloud storage bucket has been added.

Testing

This was tested locally with Docker using a service account that had the following permissions:

  • storage.buckets.get
  • storage.objects.create

@dmccoystephenson dmccoystephenson changed the title Make Kafka Properties Configurable Make Kafka Properties Configurable + Dev Container Java Version Update May 31, 2024
@dmccoystephenson dmccoystephenson changed the title Make Kafka Properties Configurable + Dev Container Java Version Update Configurable Kafka Properties, Dev Container Java Update & GCS BLOB Support May 31, 2024
KAFKA_ENABLE_AUTO_COMMIT: ${KAFKA_ENABLE_AUTO_COMMIT}
KAFKA_AUTO_COMMIT_INTERVAL_MS: ${KAFKA_AUTO_COMMIT_INTERVAL_MS}
KAFKA_SESSION_TIMEOUT_MS: ${KAFKA_SESSION_TIMEOUT_MS}
GOOGLE_APPLICATION_CREDENTIALS: '/google/gcp_service_account.json'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this google credential value: ${GOOGLE_APPLICATION_CREDENTIALS}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The value of the environment variable is mounted to /google/gcp_service_account.json and then that file is referenced in the application as GOOGLE_APPLICATION_CREDENTIALS.

KAFKA_ENABLE_AUTO_COMMIT: ${KAFKA_ENABLE_AUTO_COMMIT}
KAFKA_AUTO_COMMIT_INTERVAL_MS: ${KAFKA_AUTO_COMMIT_INTERVAL_MS}
KAFKA_SESSION_TIMEOUT_MS: ${KAFKA_SESSION_TIMEOUT_MS}
GOOGLE_APPLICATION_CREDENTIALS: '/google/gcp_service_account.json'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of the environment variable is mounted to /google/gcp_service_account.json and then that file is referenced in the application as GOOGLE_APPLICATION_CREDENTIALS.

depositToGCS(gcsStorage, bucketName, record);
} else {
logger.error("Invalid destination: " + destination);
System.exit(1);
}
} catch (Exception e) {
int retryTimeout = 5000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.error("Error depositing to AWS. Retrying in " + retryTimeout / 1000 + " seconds",
										e);

Maybe include depositing to GCS besides AWS in the error message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This log statement now references the specified destination rather than 'AWS' being hardcoded.

@dan-du-car
Copy link
Collaborator

@dmccoystephenson It looks good. I have some minor comments.

dan-du-car
dan-du-car previously approved these changes Jun 10, 2024
"CONFLUENT_KEY": "<confluent key>",
"CONFLUENT_SECRET": "<confluent secret>"
}
"envFile": "${workspaceFolder}/.env",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a .env file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A sample.env file is provided. In the README the user is instructed to copy this file and rename the copy to .env

@dmccoystephenson dmccoystephenson marked this pull request as draft June 11, 2024 13:17
@dmccoystephenson
Copy link
Contributor Author

I've marked this PR as a draft until CDOT-CV#24 is merged.

…-2024

Addressing USDOT PR Comments 6/11/2024
@dmccoystephenson
Copy link
Contributor Author

This PR is ready for re-review @dan-du-car

@dan-du-car dan-du-car merged commit f273c50 into usdot-jpo-ode:develop Jun 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants