Class ResourceModifiedSubmitterSvc
java.lang.Object
ca.uhn.fhir.jpa.subscription.submit.svc.ResourceModifiedSubmitterSvc
- All Implemented Interfaces:
IResourceModifiedConsumer
,IResourceModifiedConsumerWithRetries
public class ResourceModifiedSubmitterSvc
extends Object
implements IResourceModifiedConsumer, IResourceModifiedConsumerWithRetries
This service provides two distinct contexts in which it submits messages to the subscription pipeline.
It implements
IResourceModifiedConsumer
for synchronous submissions where retry upon failures is not required.
It implements IResourceModifiedConsumerWithRetries
for synchronous submissions performed as part of processing
an operation on a resource (see SubscriptionMatcherInterceptor
). Submissions in such context require retries
upon submission failure.-
Constructor Summary
ConstructorDescriptionResourceModifiedSubmitterSvc
(SubscriptionSettings theSubscriptionSettings, SubscriptionChannelFactory theSubscriptionChannelFactory, IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc, IHapiTransactionService theHapiTransactionService) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.transaction.support.TransactionCallback
<Boolean> doProcessResourceModifiedInTransaction
(IPersistedResourceModifiedMessage thePersistedResourceModifiedMessage) This method is the cornerstone in the submit and retry upon failure mechanism for messages needing submission to the subscription processing pipeline.void
boolean
submitPersisedResourceModifiedMessage
(IPersistedResourceModifiedMessage thePersistedResourceModifiedMessage) This method will inflate the ResourceModifiedMessage represented by the IPersistedResourceModifiedMessage and attempts to submit it to the subscription processing pipeline.void
-
Constructor Details
-
ResourceModifiedSubmitterSvc
public ResourceModifiedSubmitterSvc(SubscriptionSettings theSubscriptionSettings, SubscriptionChannelFactory theSubscriptionChannelFactory, IResourceModifiedMessagePersistenceSvc resourceModifiedMessagePersistenceSvc, IHapiTransactionService theHapiTransactionService)
-
-
Method Details
-
startIfNeeded
@EventListener(classes=org.springframework.context.event.ContextRefreshedEvent.class) public void startIfNeeded() -
submitResourceModified
- Specified by:
submitResourceModified
in interfaceIResourceModifiedConsumer
-
submitPersisedResourceModifiedMessage
public boolean submitPersisedResourceModifiedMessage(IPersistedResourceModifiedMessage thePersistedResourceModifiedMessage) This method will inflate the ResourceModifiedMessage represented by the IPersistedResourceModifiedMessage and attempts to submit it to the subscription processing pipeline. If submission succeeds, the IPersistedResourceModifiedMessage is deleted and true is returned. In the event where submission fails, we return false and the IPersistedResourceModifiedMessage is rollback for later re-submission.- Specified by:
submitPersisedResourceModifiedMessage
in interfaceIResourceModifiedConsumerWithRetries
- Parameters:
thePersistedResourceModifiedMessage
- A ResourceModifiedMessage in it's IPersistedResourceModifiedMessage that requires submission.- Returns:
- Whether the message was successfully submitted to the broker.
-
doProcessResourceModifiedInTransaction
protected org.springframework.transaction.support.TransactionCallback<Boolean> doProcessResourceModifiedInTransaction(IPersistedResourceModifiedMessage thePersistedResourceModifiedMessage) This method is the cornerstone in the submit and retry upon failure mechanism for messages needing submission to the subscription processing pipeline. It requires execution in a transaction for rollback of deleting the persistedResourceModifiedMessage pointed to bythePersistedResourceModifiedMessage
in the event where submission would fail.
- Parameters:
thePersistedResourceModifiedMessage
- the primary key pointing to the persisted version (IPersistedResourceModifiedMessage) of a ResourceModifiedMessage needing submission- Returns:
- true upon successful submission, false otherwise.
-
getProcessingChannelForUnitTest
-