-
Notifications
You must be signed in to change notification settings - Fork 78
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
Conversation
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 What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@gitcliff can you also complete the Google's Contributor License Agreement (CLA) ?? |
streaming-binlog/src/main/java/org/openmrs/analytics/DebeziumListener.java
Outdated
Show resolved
Hide resolved
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.
streaming-binlog/src/main/java/org/openmrs/analytics/DebeziumListener.java
Outdated
Show resolved
Hide resolved
streaming-binlog/src/main/java/org/openmrs/analytics/DebeziumListener.java
Outdated
Show resolved
Hide resolved
streaming-binlog/src/main/java/org/openmrs/analytics/model/DebeziumConfiguration.java
Outdated
Show resolved
Hide resolved
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.
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
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.
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=" |
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.
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(); |
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.
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
.
// TODO add Debezium config to the model + json | ||
@Getter | ||
@Setter | ||
private DebeziumConfiguration debeziumConfigurations; |
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.
How about not having a separate JSON config file and merge the content of debezium_config.json
into dbz_event_to_fhir_config.json
?
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.
@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
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.
@bashir2 kindly requesting for your feedback
"databaseOffsetStorage" : "data/offset.dat", | ||
"databaseHistory" : "data/dbhistory.dat", | ||
"snapshotMode" : "initial", | ||
"fhirDebeziumEventConfigPath" : "./utils/dbz_event_to_fhir_config.json", |
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.
Where is this path used? And why is it not in DebeziumConfiguration
?
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.
going to remove it
} | ||
|
||
@VisibleForTesting | ||
GeneralConfiguration loadDebeziumConfig() throws IOException { |
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.
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.
streaming-binlog/src/main/java/org/openmrs/analytics/model/DebeziumConfiguration.java
Outdated
Show resolved
Hide resolved
BTW, when you address the comments, please push a separate commit (and not amend the first one); that will make the review process easier. |
oh ya , @gitcliff , even for the Updated PR conventions , we no longer squash commits after a review comment |
@gitcliff please ping me when you are done with the changes we discussed today, in particular when Travis passes; thanks. |
created a new pr here https://github.com/GoogleCloudPlatform/openmrs-fhir-analytics/pull/103 |
link:#51
e2e test
TESTED: