This commit is contained in:
Tadgh
2021-08-27 16:29:06 -04:00
parent 5038b5bd2c
commit 6e876c1502
5 changed files with 53 additions and 16 deletions

View File

@@ -83,6 +83,12 @@
<artifactId>hapi-fhir-base</artifactId>
<version>${project.version}</version>
</dependency>
<!-- This dependency includes the EmailSenderImpl we will be using instead of standard javamail.-->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-subscription</artifactId>
<version>${project.version}</version>
</dependency>
<!-- This dependency includes the JPA server itself, which is packaged separately from the rest of HAPI FHIR -->
<dependency>

View File

@@ -74,6 +74,9 @@ public class AppProperties {
private Boolean use_apache_address_strategy = false;
private Boolean use_apache_address_strategy_https = false;
private Integer bundle_batch_pool_size = 20;
private Integer bundle_batch_pool_max_size = 100;
public Boolean getUse_apache_address_strategy() {
return use_apache_address_strategy;
}
@@ -471,6 +474,22 @@ public class AppProperties {
this.install_transitive_ig_dependencies = install_transitive_ig_dependencies;
}
public Integer getBundle_batch_pool_size() {
return this.bundle_batch_pool_size;
}
public void setBundle_batch_pool_size(Integer bundle_batch_pool_size) {
this.bundle_batch_pool_size = bundle_batch_pool_size;
}
public Integer getBundle_batch_pool_max_size() {
return bundle_batch_pool_max_size;
}
public void setBundle_batch_pool_max_size(Integer bundle_batch_pool_max_size) {
this.bundle_batch_pool_max_size = bundle_batch_pool_max_size;
}
public static class Cors {
private Boolean allow_Credentials = true;
private List<String> allowed_origin = ImmutableList.of("*");

View File

@@ -373,6 +373,11 @@ public class BaseJpaRestfulServer extends RestfulServer {
daoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID);
daoConfig.setResourceClientIdStrategy(appProperties.getClient_id_strategy());
}
//Parallel Batch GET execution settings
daoConfig.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
daoConfig.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size());
System.out.println("BATCH SIZE IS " + appProperties.getBundle_batch_pool_size());
System.out.println("BATCH MAX SIZE IS " + appProperties.getBundle_batch_pool_max_size());
if (appProperties.getImplementationGuides() != null) {
Map<String, AppProperties.ImplementationGuide> guides = appProperties.getImplementationGuides();

View File

@@ -8,10 +8,16 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.JavaMailEmailSender;
import ca.uhn.fhir.rest.server.mail.MailConfig;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.dstu2.model.Subscription;
import org.simplejavamail.api.email.Email;
import org.simplejavamail.api.mailer.Mailer;
import org.simplejavamail.api.mailer.config.TransportStrategy;
import org.simplejavamail.mailer.MailerBuilder;
import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -205,22 +211,19 @@ public class FhirServerConfigCommon {
@Bean()
public IEmailSender emailSender(AppProperties appProperties, Optional<SubscriptionDeliveryHandlerFactory> subscriptionDeliveryHandlerFactory) {
if (appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null) {
JavaMailEmailSender retVal = new JavaMailEmailSender();
AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail();
retVal.setSmtpServerHostname(email.getHost());
retVal.setSmtpServerPort(email.getPort());
retVal.setSmtpServerUsername(email.getUsername());
retVal.setSmtpServerPassword(email.getPassword());
retVal.setAuth(email.getAuth());
retVal.setStartTlsEnable(email.getStartTlsEnable());
retVal.setStartTlsRequired(email.getStartTlsRequired());
retVal.setQuitWait(email.getQuitWait());
MailConfig mailConfig = new MailConfig();
mailConfig.setSmtpHostname(email.getHost());
mailConfig.setSmtpUseStartTLS(email.getStartTlsRequired());
mailConfig.setSmtpPort(email.getPort());
mailConfig.setSmtpUsername(email.getUsername());
mailConfig.setSmtpPassword(email.getPassword());
EmailSenderImpl emailSender = new EmailSenderImpl(mailConfig);
if(subscriptionDeliveryHandlerFactory.isPresent())
subscriptionDeliveryHandlerFactory.get().setEmailSender(retVal);
if(subscriptionDeliveryHandlerFactory.isPresent()) {
subscriptionDeliveryHandlerFactory.get().setEmailSender(emailSender);
}
return retVal;
}
return null;

View File

@@ -99,6 +99,10 @@ hapi:
search-coord-max-pool-size: 100
search-coord-queue-capacity: 200
# Threadpool size for BATCH'ed GETs in a bundle.
# bundle_batch_pool_size: 10
# bundle_batch_pool_max_size: 50
# logger:
# error_format: 'ERROR - ${requestVerb} ${requestUrl}'
# format: >-