Merge branch 'rel_6_4' into nd-4123-bulk-export-stuck-in-finalize-state
This commit is contained in:
commit
b2e2f165d8
|
@ -0,0 +1,4 @@
|
|||
type: fix
|
||||
issue: 3482
|
||||
jira: SMILE-5076
|
||||
title: "Previously, persistence modules were attempting to activate subscriptions that used channel types they did not support. This has been changed, and those subscriptions will not be activated if the given channel type is not supported"
|
|
@ -32,6 +32,7 @@ import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
|
|||
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import ca.uhn.fhir.util.SubscriptionUtil;
|
||||
import org.hl7.fhir.dstu2.model.Subscription;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -144,4 +145,9 @@ public class SubscriptionActivatingSubscriber extends BaseSubscriberForSubscript
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isChannelTypeSupported(IBaseResource theSubscription) {
|
||||
Subscription.SubscriptionChannelType channelType = mySubscriptionCanonicalizer.getChannelType(theSubscription).toCanonical();
|
||||
return myDaoConfig.getSupportedSubscriptionTypes().contains(channelType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -228,14 +228,24 @@ public class SubscriptionLoader implements IResourceChangeListener {
|
|||
* @return true if activated
|
||||
*/
|
||||
private boolean activateSubscriptionIfRequested(IBaseResource theSubscription) {
|
||||
boolean successfullyActivated = false;
|
||||
|
||||
if (SubscriptionConstants.REQUESTED_STATUS.equals(mySubscriptionCanonicalizer.getSubscriptionStatus(theSubscription))) {
|
||||
// internally, subscriptions that cannot activate will be set to error
|
||||
if (mySubscriptionActivatingInterceptor.activateSubscriptionIfRequired(theSubscription)) {
|
||||
return true;
|
||||
if (mySubscriptionActivatingInterceptor.isChannelTypeSupported(theSubscription)) {
|
||||
// internally, subscriptions that cannot activate will be set to error
|
||||
if (mySubscriptionActivatingInterceptor.activateSubscriptionIfRequired(theSubscription)) {
|
||||
successfullyActivated = true;
|
||||
} else {
|
||||
logSubscriptionNotActivatedPlusErrorIfPossible(theSubscription);
|
||||
}
|
||||
} else {
|
||||
ourLog.debug("Could not activate subscription {} because channel type {} is not supported.",
|
||||
theSubscription.getIdElement(),
|
||||
mySubscriptionCanonicalizer.getChannelType(theSubscription));
|
||||
}
|
||||
logSubscriptionNotActivatedPlusErrorIfPossible(theSubscription);
|
||||
}
|
||||
return false;
|
||||
|
||||
return successfullyActivated;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -134,6 +134,9 @@ public class SubscriptionLoaderTest {
|
|||
when(mySubscriptionActivatingInterceptor.activateSubscriptionIfRequired(any(IBaseResource.class)))
|
||||
.thenReturn(false);
|
||||
|
||||
when(mySubscriptionActivatingInterceptor.isChannelTypeSupported(any(IBaseResource.class)))
|
||||
.thenReturn(true);
|
||||
|
||||
when(mySubscriptionCanonicalizer.getSubscriptionStatus(any())).thenReturn(SubscriptionConstants.REQUESTED_STATUS);
|
||||
|
||||
// test
|
||||
|
|
Loading…
Reference in New Issue