From b33ad73d46b10b84c101e440b0ad4c7d3d6eef86 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Mon, 24 Feb 2020 14:28:14 -0500 Subject: [PATCH] switch subscriptionchannelfactory to autowire --- .../src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java | 2 +- .../module/channel/SubscriptionChannelFactory.java | 6 ++---- .../subscription/module/config/BaseSubscriptionConfig.java | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) 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 719586745c9..46be7d7b1e2 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 @@ -211,7 +211,7 @@ public abstract class BaseConfig { @Bean public SubscriptionChannelFactory subscriptionChannelFactory() { - return new SubscriptionChannelFactory(subscribableChannelFactory()); + return new SubscriptionChannelFactory(); } @Bean 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 c4b57de6f10..c2a2eca6589 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,14 @@ 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; public class SubscriptionChannelFactory { + @Autowired private ISubscribableChannelFactory mySubscribableChannelFactory; - public SubscriptionChannelFactory(ISubscribableChannelFactory theSubscribableChannelFactory) { - mySubscribableChannelFactory = theSubscribableChannelFactory; - } - public SubscribableChannel newDeliveryChannel(String theChannelName) { return mySubscribableChannelFactory.createSubscribableChannel(theChannelName, ResourceDeliveryMessage.class, mySubscribableChannelFactory.getDeliveryChannelConcurrentConsumers()); } 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 59e22d2f788..2a45b7a99f5 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 @@ -45,6 +45,6 @@ public abstract class BaseSubscriptionConfig { @Bean public SubscriptionChannelFactory subscriptionChannelFactory() { - return new SubscriptionChannelFactory(subscribableChannelFactory()); + return new SubscriptionChannelFactory(); } }