$mdm-submit operation was only submitting 100 resources and then stopping.

It now correctly submits all requested resources.
This commit is contained in:
Michael Buckley 2021-06-30 14:47:58 -04:00
parent 795fb31a3a
commit fa750d209e
4 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 2768
title: "$mdm-submit operation was only submitting 100 resources and then stopping. It now correctly submits all
requested resources."

View File

@ -65,7 +65,9 @@ public class MdmSubmitSvcImpl implements IMdmSubmitSvc {
@Autowired
private IMdmSettings myMdmSettings;
private static final int BUFFER_SIZE = 100;
public static final int DEFAULT_BUFFER_SIZE = 100;
private int myBufferSize = DEFAULT_BUFFER_SIZE;
@Override
@Transactional
@ -88,7 +90,8 @@ public class MdmSubmitSvcImpl implements IMdmSubmitSvc {
validateSourceType(theSourceResourceType);
SearchParameterMap spMap = myMdmSearchParamSvc.getSearchParameterMapFromCriteria(theSourceResourceType, theCriteria);
spMap.setLoadSynchronousUpTo(BUFFER_SIZE);
spMap.setLoadSynchronous(true);
spMap.setCount(myBufferSize);
ISearchBuilder searchBuilder = myMdmSearchParamSvc.generateSearchBuilderForType(theSourceResourceType);
return submitAllMatchingResourcesToMdmChannel(spMap, searchBuilder);
}
@ -99,7 +102,7 @@ public class MdmSubmitSvcImpl implements IMdmSubmitSvc {
try (IResultIterator query = theSearchBuilder.createQuery(theSpMap, searchRuntimeDetails, null, RequestPartitionId.defaultPartition())) {
Collection<ResourcePersistentId> pidBatch;
do {
pidBatch = query.getNextResultBatch(BUFFER_SIZE);
pidBatch = query.getNextResultBatch(myBufferSize);
total += loadPidsAndSubmitToMdmChannel(theSearchBuilder, pidBatch);
} while (query.hasNext());
} catch (IOException theE) {
@ -159,4 +162,9 @@ public class MdmSubmitSvcImpl implements IMdmSubmitSvc {
throw new InvalidRequestException(ProviderConstants.OPERATION_MDM_SUBMIT + " does not support resource type: " + theResourceType);
}
}
@Override
public void setBufferSize(int myBufferSize) {
this.myBufferSize = myBufferSize;
}
}

View File

@ -32,6 +32,7 @@ class MdmBatchSvcImplIT extends BaseMdmR4Test {
public void after() throws IOException {
myInterceptorService.unregisterInterceptor(afterMdmLatch);
afterMdmLatch.clear();
myMdmSubmitSvc.setBufferSize(MdmSubmitSvcImpl.DEFAULT_BUFFER_SIZE);
super.after();
}
@ -69,6 +70,7 @@ class MdmBatchSvcImplIT extends BaseMdmR4Test {
assertLinkCount(0);
//SUT
myMdmSubmitSvc.setBufferSize(5);
afterMdmLatch.runWithExpectedCount(10, () -> myMdmSubmitSvc.submitSourceResourceTypeToMdm("Patient", null));
assertLinkCount(10);

View File

@ -78,4 +78,12 @@ public interface IMdmSubmitSvc {
* @param theMdmSettings Settings to set
*/
void setMdmSettings(IMdmSettings theMdmSettings);
/**
* Buffer size for fetching results to add to MDM queue.
*
* @param theBufferSize
*/
public void setBufferSize(int theBufferSize);
}