Skip to content

Commit ec6b12e

Browse files
authored
Externalizes more subscription parameters (hapifhir#783)
* Externalizes more subscription parameters Allows : - to parametrize the polling interval of subscription - to enable the setting to queue the subscription jobs immediately. Following the change in hapifhir/hapi-fhir/pull/6395 * Fix formatting
1 parent b283c37 commit ec6b12e

File tree

3 files changed

+57
-11
lines changed

3 files changed

+57
-11
lines changed

src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,31 +683,41 @@ public void setResource_dbhistory_enabled(Boolean resource_dbhistory_enabled) {
683683
this.resource_dbhistory_enabled = resource_dbhistory_enabled;
684684
}
685685

686-
public Boolean getPre_expand_value_sets() { return this.pre_expand_value_sets; }
686+
public Boolean getPre_expand_value_sets() {
687+
return this.pre_expand_value_sets;
688+
}
687689

688690
public void setPre_expand_value_sets(Boolean pre_expand_value_sets) {
689691
this.pre_expand_value_sets = pre_expand_value_sets;
690692
}
691693

692-
public Boolean getEnable_task_pre_expand_value_sets() { return this.enable_task_pre_expand_value_sets; }
694+
public Boolean getEnable_task_pre_expand_value_sets() {
695+
return this.enable_task_pre_expand_value_sets;
696+
}
693697

694698
public void setEnable_task_pre_expand_value_setss(Boolean enable_task_pre_expand_value_sets) {
695699
this.enable_task_pre_expand_value_sets = enable_task_pre_expand_value_sets;
696700
}
697701

698-
public Integer getPre_expand_value_sets_default_count() {return pre_expand_value_sets_default_count; }
702+
public Integer getPre_expand_value_sets_default_count() {
703+
return pre_expand_value_sets_default_count;
704+
}
699705

700706
public void setPre_expand_value_sets_default_count(Integer pre_expand_value_sets_default_count) {
701707
this.pre_expand_value_sets_default_count = pre_expand_value_sets_default_count;
702708
}
703709

704-
public Integer getPre_expand_value_sets_max_count() { return pre_expand_value_sets_max_count; }
710+
public Integer getPre_expand_value_sets_max_count() {
711+
return pre_expand_value_sets_max_count;
712+
}
705713

706714
public void setPre_expand_value_sets_max_count(Integer pre_expand_value_sets_max_count) {
707715
this.pre_expand_value_sets_max_count = pre_expand_value_sets_max_count;
708716
}
709717

710-
public Integer getMaximum_expansion_size() { return maximum_expansion_size; }
718+
public Integer getMaximum_expansion_size() {
719+
return maximum_expansion_size;
720+
}
711721

712722
public void setMaximum_expansion_size(Integer maximum_expansion_size) {
713723
this.maximum_expansion_size = maximum_expansion_size;
@@ -914,6 +924,8 @@ public static class Subscription {
914924
private Boolean resthook_enabled = false;
915925
private Boolean websocket_enabled = false;
916926
private Email email = null;
927+
private Integer polling_interval_ms = null;
928+
private Boolean immediately_queued = false;
917929

918930
public Boolean getResthook_enabled() {
919931
return resthook_enabled;
@@ -939,6 +951,22 @@ public void setEmail(Email email) {
939951
this.email = email;
940952
}
941953

954+
public Integer getPolling_interval_ms() {
955+
return polling_interval_ms;
956+
}
957+
958+
public void setPolling_interval_ms(Integer polling_interval_ms) {
959+
this.polling_interval_ms = polling_interval_ms;
960+
}
961+
962+
public Boolean getImmediately_queued() {
963+
return immediately_queued;
964+
}
965+
966+
public void setImmediately_queued(Boolean immediately_queued) {
967+
this.immediately_queued = immediately_queued;
968+
}
969+
942970
public static class Email {
943971
private String from;
944972
private String host;

src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,16 @@ public FhirServerConfigCommon(AppProperties appProperties) {
9090
}
9191

9292
ourLog.info("Server configured to " + (appProperties.getPre_expand_value_sets() ? "enable" : "disable")
93-
+ " value set pre-expansion");
94-
ourLog.info("Server configured to " + (appProperties.getEnable_task_pre_expand_value_sets() ? "enable" : "disable")
95-
+ " value set pre-expansion task");
96-
ourLog.info("Server configured for pre-expand value set default count of " + (appProperties.getPre_expand_value_sets_default_count().toString()));
97-
ourLog.info("Server configured for pre-expand value set max count of " + (appProperties.getPre_expand_value_sets_default_count().toString()));
98-
ourLog.info("Server configured for maximum expansion size of " + (appProperties.getPre_expand_value_sets_default_count().toString()));
93+
+ " value set pre-expansion");
94+
ourLog.info(
95+
"Server configured to " + (appProperties.getEnable_task_pre_expand_value_sets() ? "enable" : "disable")
96+
+ " value set pre-expansion task");
97+
ourLog.info("Server configured for pre-expand value set default count of "
98+
+ (appProperties.getPre_expand_value_sets_default_count().toString()));
99+
ourLog.info("Server configured for pre-expand value set max count of "
100+
+ (appProperties.getPre_expand_value_sets_default_count().toString()));
101+
ourLog.info("Server configured for maximum expansion size of "
102+
+ (appProperties.getPre_expand_value_sets_default_count().toString()));
99103
}
100104

101105
@Bean
@@ -122,6 +126,18 @@ public SubscriptionSettings subscriptionSettings(AppProperties appProperties) {
122126
subscriptionSettings.addSupportedSubscriptionType(
123127
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
124128
}
129+
if (appProperties.getSubscription().getPolling_interval_ms() != null) {
130+
ourLog.info(
131+
"Setting subscription polling interval to {} ms",
132+
appProperties.getSubscription().getPolling_interval_ms());
133+
subscriptionSettings.setSubscriptionIntervalInMs(
134+
appProperties.getSubscription().getPolling_interval_ms());
135+
}
136+
if (appProperties.getSubscription().getImmediately_queued()) {
137+
ourLog.info("Subscription update will be queued immediately");
138+
subscriptionSettings.setSubscriptionChangeQueuedImmediately(
139+
appProperties.getSubscription().getImmediately_queued());
140+
}
125141
}
126142
if (appProperties.getMdm_enabled()) {
127143
// MDM requires the subscription of type message

src/main/resources/application.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ hapi:
309309
# subscription:
310310
# resthook_enabled: true
311311
# websocket_enabled: false
312+
# polling_interval_ms: 5000
313+
# immediately_queued: false
312314
# email:
313315
314316
# host: google.com

0 commit comments

Comments
 (0)