@@ -96,20 +96,31 @@ public void execute(SendEhrExtractCoreTaskDefinition sendEhrExtractCoreTaskDefin
9696 private String compressEhrExtractAndReplacePayloadWithSkeleton (
9797 SendEhrExtractCoreTaskDefinition sendEhrExtractCoreTaskDefinition ,
9898 OutboundMessage outboundMessage ) throws JsonProcessingException {
99+
100+ LOGGER .info ("Starting compression and skeleton replacement for outbound message" );
101+
99102 String documentId = randomIdGeneratorService .createNewId ();
100103 String messageId = randomIdGeneratorService .createNewId ();
101104 String taskId = randomIdGeneratorService .createNewId ();
105+
106+ LOGGER .debug ("Generated IDs - Document ID: {}, Message ID: {}, Task ID: {}" , documentId , messageId , taskId );
107+
102108 String fileName = GpcFilenameUtils .generateLargeExrExtractFilename (documentId );
103- final var compressedEhrExtract = Base64Utils .toBase64String (Gzip .compress (outboundMessage .getPayload ()));
109+ String originalPayload = outboundMessage .getPayload ();
110+ final var compressedEhrExtract = Base64Utils .toBase64String (Gzip .compress (originalPayload ));
111+ LOGGER .info ("Compressed EHR extract: original size = {}, compressed size = {}" ,
112+ originalPayload .length (), compressedEhrExtract .length ());
113+
104114 storeCompressedEhrExtractAsDocument (sendEhrExtractCoreTaskDefinition , documentId , messageId , fileName , taskId );
105115
106116 uploadCompressedEhrExtractToStorageWrapper (
107117 sendEhrExtractCoreTaskDefinition , messageId , documentId , compressedEhrExtract , taskId , fileName );
108118
109- outboundMessage .setPayload (structuredRecordMappingService .buildSkeletonEhrExtractXml (outboundMessage . getPayload () , documentId ));
119+ outboundMessage .setPayload (structuredRecordMappingService .buildSkeletonEhrExtractXml (originalPayload , documentId ));
110120 referenceCompressedEhrExtractDocumentAsAttachmentInOutboundMessage (
111121 outboundMessage , documentId , messageId , fileName , compressedEhrExtract .length ());
112122
123+ LOGGER .info ("Successfully completed compression and skeleton replacement for outbound message with document ID: {}" , documentId );
113124 return objectMapper .writeValueAsString (outboundMessage );
114125 }
115126
@@ -146,31 +157,33 @@ private void uploadCompressedEhrExtractToStorageWrapper(
146157 String taskId ,
147158 String fileName ) throws JsonProcessingException {
148159
160+ LOGGER .info ("Preparing to upload compressed EHR extract. File name: {}, Message ID: {}" , fileName , messageId );
161+
149162 String data = objectMapper .writeValueAsString (
150- OutboundMessage .builder ()
151- .payload (
152- ehrDocumentMapper .generateMhsPayload (
153- sendEhrExtractCoreTaskDefinition ,
154- messageId ,
155- documentId ,
156- "application/xml"
157- )
158- ).attachments (
159- List .of (
160- OutboundMessage .Attachment .builder ()
161- .contentType (TEXT_XML_CONTENT_TYPE )
162- .isBase64 (true )
163- .description (documentId )
164- .payload (compressedEhrExtract )
165- .build ()
166- )
167- ).build ()
168- );
163+ OutboundMessage .builder ()
164+ .payload (
165+ ehrDocumentMapper .generateMhsPayload (
166+ sendEhrExtractCoreTaskDefinition ,
167+ messageId ,
168+ documentId ,
169+ "application/xml"
170+ )
171+ ).attachments (
172+ List .of (
173+ OutboundMessage .Attachment .builder ()
174+ .contentType (TEXT_XML_CONTENT_TYPE )
175+ .isBase64 (true )
176+ .description (documentId )
177+ .payload (compressedEhrExtract )
178+ .build ()
179+ )).build ());
169180
170181 storageConnectorService .uploadFile (
171182 StorageDataWrapperProvider .buildStorageDataWrapper (sendEhrExtractCoreTaskDefinition , data , taskId ),
172183 fileName
173184 );
185+
186+ LOGGER .info ("Upload completed for file: {}" , fileName );
174187 }
175188
176189 private void storeCompressedEhrExtractAsDocument (
0 commit comments