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

Move debezium specific settings to the json config file #57

Closed
wants to merge 0 commits into from

Conversation

gitcliff
Copy link
Collaborator

@gitcliff gitcliff commented Nov 10, 2020

link:#51

  • moved the the debezium settings to json config file
  • added Debezium configurations class to the model

e2e test
TESTED:

mvn compile exec:java -pl streaming-binlog \
   -Dexec.args="--databaseHostName=localhost \
   --databasePort=3308 --databaseUser=root --databasePassword=Admin123\
   --databaseName=mysql --databaseSchema=openmrs --databaseServerId=223344 \
   --openmrsUserName=admin --openmrsPassword=Admin123 \
   --openmrsServerUrl=http://localhost:8081/openmrs \
   --fhirSinkPath=http://localhost:8888/fhir \
   --sinkUserName=hapi --sinkPassword=hapi123 \
   --fileParquetPath=/tmp/
```" 

@google-cla
Copy link

google-cla bot commented Nov 10, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@gitcliff gitcliff changed the title Move:Move debezium specific settings to the json config file Move debezium specific settings to the json config file Nov 10, 2020
utils/general_config.json Outdated Show resolved Hide resolved
@mozzy11
Copy link
Collaborator

mozzy11 commented Nov 10, 2020

@gitcliff can you also complete the Google's Contributor License Agreement (CLA) ??

utils/general_config.json Outdated Show resolved Hide resolved
Copy link
Collaborator

@bashir2 bashir2 left a comment

Choose a reason for hiding this comment

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

@gitcliff here is a suggestion: Please either create a new PR or copy the template here at the top of your PR description and make sure you have followed all steps. In particular, please add a TESTED field describing how you have e2e tested your change. I don't think your changes actually work.

@gitcliff
Copy link
Collaborator Author

@bashir2 @kimaina @mozzy11 kindly review

Copy link
Collaborator

@kimaina kimaina left a comment

Choose a reason for hiding this comment

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

Thank you @gitcliff for working on this? LGTM, just one question on how we can add the flexibility of adding more DBZ configs in the json without the need of extending and recompiling the config model

@gitcliff
Copy link
Collaborator Author

@kimaina thanks for the review ,,
not yet quite sure on how to implement this ,though still googling around to find something
cc @bashir2

@gitcliff gitcliff self-assigned this Jan 12, 2021
Copy link
Collaborator

@bashir2 bashir2 left a comment

Choose a reason for hiding this comment

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

Thanks @gitcliff for working on this. When you address the comments below, please also rerun your integration test. Also please update your TESTED field and describe how you make sure that new events are properly processed. You can either manually trigger Debezium events by adding new resources, e.g., patients/observations OR you can replay some past events.

Please also update this README section based on your changes.

private String getDebeziumConfig() throws IOException {
GeneralConfiguration generalConfiguration = loadDebeziumConfig();
DebeziumConfiguration debeziumConfigs = generalConfiguration.getDebeziumConfigurations();
return "debezium-mysql:" + debeziumConfigs.getDatabaseHostName() + "?" + "databaseHostname="
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the params in DebeziumArgs that are not used anymore; for example, databaseHostName, databasePort, etc.

@VisibleForTesting
GeneralConfiguration loadDebeziumConfig() throws IOException {
Gson gson = new Gson();
String pathToFile = this.getClass().getClassLoader().getResource("debezium_config.json").getPath();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please make a command line argument to pass the JSON config filename and set the default value properly. Also move the config from resources directory to utils/ similar to other configs.

If you merge the two JSON configs (which I prefer because you have already merged them in GeneralConfiguration) then that is already done in DebeziumArgs.fhirDebeziumEventConfigPath at the bottom of this file; we can rename that param to be more generic, e.g., fhirDebeziumConfigPath.

streaming-binlog/src/main/resources/debezium_config.json Outdated Show resolved Hide resolved
streaming-binlog/src/main/resources/debezium_config.json Outdated Show resolved Hide resolved
// TODO add Debezium config to the model + json
@Getter
@Setter
private DebeziumConfiguration debeziumConfigurations;
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about not having a separate JSON config file and merge the content of debezium_config.json into dbz_event_to_fhir_config.json?

Copy link
Collaborator Author

@gitcliff gitcliff Jan 20, 2021

Choose a reason for hiding this comment

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

@bashir2 thatnks for the review and feedback
The idea of merging the debezium config into dbz_event_to_fhir_config.json sounds good but it brings compilation incompatibilities when your fetching event configurations for debezium connection from the GeneralConfiguration with something like this EventConfiguration eventConfigs = generalConfiguration.getEventConfigurations(); .
Thats why i had separated them

Am seeing this is because the the event configurations in the general config class is a LinkedHashMap

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bashir2 kindly requesting for your feedback

"databaseOffsetStorage" : "data/offset.dat",
"databaseHistory" : "data/dbhistory.dat",
"snapshotMode" : "initial",
"fhirDebeziumEventConfigPath" : "./utils/dbz_event_to_fhir_config.json",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this path used? And why is it not in DebeziumConfiguration?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

going to remove it

}

@VisibleForTesting
GeneralConfiguration loadDebeziumConfig() throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this actually load a full GeneralConfiguration? It seems that this method only fills the debeziumConfiguration part right? (I understand it is enough for the use-case here but it is a little bit confusing.)

I have made some suggestions below to merge the two JSON files. Once you do that, please also move this function to be a static factory method inside GeneralConfiguration and use it everywhere that we need a GeneralConfiguration instance.

@bashir2
Copy link
Collaborator

bashir2 commented Jan 20, 2021

BTW, when you address the comments, please push a separate commit (and not amend the first one); that will make the review process easier.

@mozzy11
Copy link
Collaborator

mozzy11 commented Jan 20, 2021

oh ya , @gitcliff , even for the Updated PR conventions , we no longer squash commits after a review comment

@bashir2
Copy link
Collaborator

bashir2 commented Jan 27, 2021

@gitcliff please ping me when you are done with the changes we discussed today, in particular when Travis passes; thanks.

@gitcliff
Copy link
Collaborator Author

gitcliff commented Feb 1, 2021

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.

None yet

4 participants