diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java index e5bc3f11542..719586745c9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java @@ -33,6 +33,7 @@ import ca.uhn.fhir.jpa.subscription.dbmatcher.CompositeInMemoryDaoSubscriptionMa import ca.uhn.fhir.jpa.subscription.dbmatcher.DaoSubscriptionMatcher; import ca.uhn.fhir.jpa.subscription.module.cache.LinkedBlockingQueueSubscribableChannelFactory; import ca.uhn.fhir.jpa.subscription.module.channel.ISubscribableChannelFactory; +import ca.uhn.fhir.jpa.subscription.module.channel.SubscriptionChannelFactory; import ca.uhn.fhir.jpa.subscription.module.matcher.ISubscriptionMatcher; import ca.uhn.fhir.jpa.subscription.module.matcher.InMemorySubscriptionMatcher; import ca.uhn.fhir.rest.server.interceptor.consent.IConsentContextServices; @@ -204,10 +205,15 @@ public abstract class BaseConfig { * Create a @Primary @Bean if you need a different implementation */ @Bean - public ISubscribableChannelFactory linkedBlockingQueueSubscribableChannelFactory() { + public ISubscribableChannelFactory subscribableChannelFactory() { return new LinkedBlockingQueueSubscribableChannelFactory(); } + @Bean + public SubscriptionChannelFactory subscriptionChannelFactory() { + return new SubscriptionChannelFactory(subscribableChannelFactory()); + } + @Bean @Primary public ISubscriptionMatcher subscriptionMatcherCompositeInMemoryDatabase() { @@ -280,6 +286,4 @@ public abstract class BaseConfig { private static HapiFhirHibernateJpaDialect hibernateJpaDialect(HapiLocalizer theLocalizer) { return new HapiFhirHibernateJpaDialect(theLocalizer); } - - } diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelFactory.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelFactory.java index 2be4dc4d6aa..c4b57de6f10 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelFactory.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelFactory.java @@ -22,16 +22,12 @@ package ca.uhn.fhir.jpa.subscription.module.channel; import ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage; import ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.SubscribableChannel; -import org.springframework.stereotype.Component; -@Component public class SubscriptionChannelFactory { private ISubscribableChannelFactory mySubscribableChannelFactory; - @Autowired public SubscriptionChannelFactory(ISubscribableChannelFactory theSubscribableChannelFactory) { mySubscribableChannelFactory = theSubscribableChannelFactory; } diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/config/BaseSubscriptionConfig.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/config/BaseSubscriptionConfig.java index 8da938d805e..59e22d2f788 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/config/BaseSubscriptionConfig.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/config/BaseSubscriptionConfig.java @@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.subscription.module.config; import ca.uhn.fhir.interceptor.executor.InterceptorService; import ca.uhn.fhir.jpa.subscription.module.cache.LinkedBlockingQueueSubscribableChannelFactory; import ca.uhn.fhir.jpa.subscription.module.channel.ISubscribableChannelFactory; +import ca.uhn.fhir.jpa.subscription.module.channel.SubscriptionChannelFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -33,7 +34,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @ComponentScan(basePackages = {"ca.uhn.fhir.jpa.subscription.module"}) public abstract class BaseSubscriptionConfig { @Bean - public ISubscribableChannelFactory blockingQueueSubscriptionDeliveryChannelFactory() { + public ISubscribableChannelFactory subscribableChannelFactory() { return new LinkedBlockingQueueSubscribableChannelFactory(); } @@ -41,4 +42,9 @@ public abstract class BaseSubscriptionConfig { public InterceptorService interceptorRegistry() { return new InterceptorService("hapi-fhir-jpa-subscription"); } + + @Bean + public SubscriptionChannelFactory subscriptionChannelFactory() { + return new SubscriptionChannelFactory(subscribableChannelFactory()); + } }