Add config

This commit is contained in:
jamesagnew 2018-02-18 11:11:35 -05:00
parent 2f4ac42edb
commit a60e5cab2a
1 changed files with 19 additions and 12 deletions

View File

@ -31,6 +31,7 @@ import org.springframework.messaging.MessagingException;
public abstract class BaseSubscriptionDeliverySubscriber extends BaseSubscriptionSubscriber {
private static final Logger ourLog = LoggerFactory.getLogger(BaseSubscriptionDeliverySubscriber.class);
private boolean myReloadResourceBeforeDelivery = true;
public BaseSubscriptionDeliverySubscriber(IFhirResourceDao<?> theSubscriptionDao, Subscription.SubscriptionChannelType theChannelType, BaseSubscriptionInterceptor theSubscriptionInterceptor) {
super(theSubscriptionDao, theChannelType, theSubscriptionInterceptor);
@ -53,6 +54,7 @@ public abstract class BaseSubscriptionDeliverySubscriber extends BaseSubscriptio
msg.setSubscription(updatedSubscription);
}
if (myReloadResourceBeforeDelivery) {
// Reload the payload just in case any interceptors modified
// it before it was saved to the database. This is also
// useful for resources created in a transaction, since they
@ -62,6 +64,7 @@ public abstract class BaseSubscriptionDeliverySubscriber extends BaseSubscriptio
IFhirResourceDao dao = getSubscriptionDao().getDao(type);
IBaseResource loadedPayload = dao.read(payloadId);
msg.setPayload(getContext(), loadedPayload);
}
handleMessage(msg);
} catch (Exception e) {
@ -72,4 +75,8 @@ public abstract class BaseSubscriptionDeliverySubscriber extends BaseSubscriptio
public abstract void handleMessage(ResourceDeliveryMessage theMessage) throws Exception;
public void setReloadResourceBeforeDelivery(boolean theReloadResourceBeforeDelivery) {
myReloadResourceBeforeDelivery = theReloadResourceBeforeDelivery;
}
}