diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
index 98f3a72..c71d143 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
@@ -28,6 +28,8 @@
 
 import org.onap.dcaegen2.collectors.datafile.exceptions.DmaapEmptyResponseException;
 import org.onap.dcaegen2.collectors.datafile.exceptions.DmaapNotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.util.StringUtils;
 
 import reactor.core.publisher.Mono;
@@ -40,12 +42,17 @@
  */
 public class DmaapConsumerJsonParser {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(DmaapConsumerJsonParser.class);
+
     private static final String EVENT = "event";
     private static final String NOTIFICATION_FIELDS = "notificationFields";
     private static final String CHANGE_IDENTIFIER = "changeIdentifier";
     private static final String CHANGE_TYPE = "changeType";
     private static final String NOTIFICATION_FIELDS_VERSION = "notificationFieldsVersion";
 
+    private static final String ARRAY_OF_NAMED_HASH_MAP = "arrayOfNamedHashMap";
+    private static final String NAME = "name";
+    private static final String HASH_MAP = "hashMap";
     private static final String LOCATION = "location";
     private static final String COMPRESSION = "compression";
     private static final String FILE_FORMAT_TYPE = "fileFormatType";
@@ -93,21 +100,20 @@
             String changeIdentifier = getValueFromJson(notificationFields, CHANGE_IDENTIFIER);
             String changeType = getValueFromJson(notificationFields, CHANGE_TYPE);
             String notificationFieldsVersion = getValueFromJson(notificationFields, NOTIFICATION_FIELDS_VERSION);
-            JsonArray arrayOfAdditionalFields = notificationFields.getAsJsonArray("arrayOfAdditionalFields");
+            JsonArray arrayOfNamedHashMap = notificationFields.getAsJsonArray(ARRAY_OF_NAMED_HASH_MAP);
 
             if (isNotificationFieldsHeaderNotEmpty(changeIdentifier, changeType, notificationFieldsVersion)
-                    && arrayOfAdditionalFields != null) {
-                Mono<List<FileData>> res =
-                        getFileDataFromJson(changeIdentifier, changeType, arrayOfAdditionalFields);
+                    && arrayOfNamedHashMap != null) {
+                Mono<List<FileData>> res = getAllFileDataFromJson(changeIdentifier, changeType, arrayOfNamedHashMap);
                 return res;
             }
 
             if (!isNotificationFieldsHeaderNotEmpty(changeIdentifier, changeType, notificationFieldsVersion)) {
                 return Mono.error(
                         new DmaapNotFoundException("FileReady event header is missing information. " + jsonObject));
-            } else if (arrayOfAdditionalFields != null) {
-                return Mono.error(new DmaapNotFoundException(
-                        "FileReady event arrayOfAdditionalFields is missing. " + jsonObject));
+            } else if (arrayOfNamedHashMap != null) {
+                return Mono.error(
+                        new DmaapNotFoundException("FileReady event arrayOfNamedHashMap is missing. " + jsonObject));
             }
             return Mono.error(
                     new DmaapNotFoundException("FileReady event does not contain correct information. " + jsonObject));
@@ -117,30 +123,43 @@
 
     }
 
-    private Mono<List<FileData>> getFileDataFromJson(String changeIdentifier, String changeType,
+    private Mono<List<FileData>> getAllFileDataFromJson(String changeIdentifier, String changeType,
             JsonArray arrayOfAdditionalFields) {
         List<FileData> res = new ArrayList<>();
         for (int i = 0; i < arrayOfAdditionalFields.size(); i++) {
             if (arrayOfAdditionalFields.get(i) != null) {
                 JsonObject fileInfo = (JsonObject) arrayOfAdditionalFields.get(i);
-                String fileFormatType = getValueFromJson(fileInfo, FILE_FORMAT_TYPE);
-                String fileFormatVersion = getValueFromJson(fileInfo, FILE_FORMAT_VERSION);
-                String location = getValueFromJson(fileInfo, LOCATION);
-                String compression = getValueFromJson(fileInfo, COMPRESSION);
-                if (isFileFormatFieldsNotEmpty(fileFormatVersion, fileFormatType)
-                        && isLocationAndCompressionNotEmpty(location, compression)) {
-                    res.add(ImmutableFileData.builder().changeIdentifier(changeIdentifier).changeType(changeType)
-                            .location(location).compression(compression).fileFormatType(fileFormatType)
-                            .fileFormatVersion(fileFormatVersion).build());
+                FileData fileData = getFileDataFromJson(fileInfo, changeIdentifier, changeType);
+
+                if (fileData != null) {
+                    res.add(fileData);
                 } else {
-                    return Mono.error(new DmaapNotFoundException(
-                            "FileReady event does not contain correct file format information. " + fileInfo));
+                    LOGGER.error("Unable to collect file from xNF. File information wrong. " + fileInfo);
                 }
             }
         }
         return Mono.just(res);
     }
 
+    private FileData getFileDataFromJson(JsonObject fileInfo, String changeIdentifier, String changeType) {
+        FileData fileData = null;
+
+        String name = getValueFromJson(fileInfo, NAME);
+        JsonObject data = fileInfo.getAsJsonObject(HASH_MAP);
+        String fileFormatType = getValueFromJson(data, FILE_FORMAT_TYPE);
+        String fileFormatVersion = getValueFromJson(data, FILE_FORMAT_VERSION);
+        String location = getValueFromJson(data, LOCATION);
+        String compression = getValueFromJson(data, COMPRESSION);
+
+        if (isFileFormatFieldsNotEmpty(fileFormatVersion, fileFormatType)
+                && isNameAndLocationAndCompressionNotEmpty(name, location, compression)) {
+            fileData = ImmutableFileData.builder().changeIdentifier(changeIdentifier).changeType(changeType)
+                    .location(location).compression(compression).fileFormatType(fileFormatType)
+                    .fileFormatVersion(fileFormatVersion).build();
+        }
+        return fileData;
+    }
+
     private String getValueFromJson(JsonObject jsonObject, String jsonKey) {
         return jsonObject.has(jsonKey) ? jsonObject.get(jsonKey).getAsString() : "";
     }
@@ -157,8 +176,9 @@
                 && (fileFormatType != null && !fileFormatType.isEmpty()));
     }
 
-    private boolean isLocationAndCompressionNotEmpty(String location, String compression) {
-        return (location != null && !location.isEmpty()) && (compression != null && !compression.isEmpty());
+    private boolean isNameAndLocationAndCompressionNotEmpty(String name, String location, String compression) {
+        return (name != null && !name.isEmpty()) && (location != null && !location.isEmpty())
+                && (compression != null && !compression.isEmpty());
     }
 
     private boolean containsHeader(JsonObject jsonObject) {
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParserTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParserTest.java
index dc51343..4aad5f4 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParserTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParserTest.java
@@ -16,21 +16,22 @@
 
 package org.onap.dcaegen2.collectors.datafile.service;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.spy;
 
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
 import java.util.List;
 import java.util.Optional;
 
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 import org.onap.dcaegen2.collectors.datafile.exceptions.DmaapNotFoundException;
 import org.onap.dcaegen2.collectors.datafile.utils.JsonMessage;
 import org.onap.dcaegen2.collectors.datafile.utils.JsonMessage.AdditionalField;
 
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
 import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
@@ -42,7 +43,31 @@
 
     @Test
     void whenPassingCorrectJson_validationNotThrowingAnException() throws DmaapNotFoundException {
-        // given
+        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
+                .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
+                .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
+        JsonMessage message = new JsonMessage.JsonMessageBuilder().changeIdentifier("PM_MEAS_FILES")
+                .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalField).build();
+
+        FileData expectedFileData = ImmutableFileData.builder().changeIdentifier("PM_MEAS_FILES")
+                .changeType("FileReady").location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz")
+                .compression("gzip").fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
+
+        String messageString = message.toString();
+        String parsedString = message.getParsed();
+        DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
+        JsonElement jsonElement = new JsonParser().parse(parsedString);
+        Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
+                .getJsonObjectFromAnArray(jsonElement);
+
+        List<FileData> fileDataResult = dmaapConsumerJsonParser.getJsonObject(Mono.just((messageString))).block();
+
+        assertNotNull(fileDataResult);
+        assertEquals(expectedFileData, fileDataResult.get(0));
+    }
+
+    @Test
+    void whenPassingCorrectJsonWihoutName_noFileData() {
         AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder()
                 .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
                 .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
@@ -50,114 +75,118 @@
                 .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalField).build();
 
         String messageString = message.toString();
-
         String parsedString = message.getParsed();
-
-        FileData expectedFileData = ImmutableFileData.builder().changeIdentifier("PM_MEAS_FILES")
-                .changeType("FileReady").location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz")
-                .compression("gzip").fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
-        // when
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsedString);
         Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
                 .getJsonObjectFromAnArray(jsonElement);
-        List<FileData> listOfFileData = dmaapConsumerJsonParser.getJsonObject(Mono.just((messageString))).block();
-        // then
-        Assertions.assertNotNull(listOfFileData);
-        Assertions.assertEquals(expectedFileData, listOfFileData.get(0));
+
+        List<FileData> fileDataResult = dmaapConsumerJsonParser.getJsonObject(Mono.just((messageString))).block();
+
+        assertNotNull(fileDataResult);
+        assertEquals(0, fileDataResult.size());
     }
 
     @Test
-    void whenPassingCorrectJsonWihoutLocation_validationThrowingAnException() {
-        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder().compression("gzip")
-                .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
+    void whenPassingCorrectJsonWihoutLocation_noFileData() {
+        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
+                .compression("gzip").fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
         JsonMessage message = new JsonMessage.JsonMessageBuilder().changeIdentifier("PM_MEAS_FILES")
                 .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalField).build();
 
         String messageString = message.toString();
-
         String parsedString = message.getParsed();
-
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsedString);
         Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
                 .getJsonObjectFromAnArray(jsonElement);
-        StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(messageString))).expectSubscription()
-                .expectError(DmaapNotFoundException.class).verify();
+
+        List<FileData> fileDataResult = dmaapConsumerJsonParser.getJsonObject(Mono.just((messageString))).block();
+
+        assertNotNull(fileDataResult);
+        assertEquals(0, fileDataResult.size());
     }
 
     @Test
-    void whenPassingCorrectJsonWihoutCompression_validationThrowingAnException() {
-        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder()
+    void whenPassingCorrectJsonWihoutCompression_noFileData() {
+        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
                 .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz")
                 .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
         JsonMessage message = new JsonMessage.JsonMessageBuilder().changeIdentifier("PM_MEAS_FILES")
                 .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalField).build();
 
         String messageString = message.toString();
-
         String parsedString = message.getParsed();
-
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsedString);
         Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
                 .getJsonObjectFromAnArray(jsonElement);
-        StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(messageString))).expectSubscription()
-                .expectError(DmaapNotFoundException.class).verify();
+
+        List<FileData> fileDataResult = dmaapConsumerJsonParser.getJsonObject(Mono.just((messageString))).block();
+
+        assertNotNull(fileDataResult);
+        assertEquals(0, fileDataResult.size());
     }
 
     @Test
-    void whenPassingCorrectJsonWihoutFileFormatType_validationThrowingAnException() {
-        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder()
+    void whenPassingCorrectJsonWihoutFileFormatType_noFileData() {
+        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
                 .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
                 .fileFormatVersion("V10").build();
         JsonMessage message = new JsonMessage.JsonMessageBuilder().changeIdentifier("PM_MEAS_FILES")
                 .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalField).build();
 
         String messageString = message.toString();
-
         String parsedString = message.getParsed();
-
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsedString);
         Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
                 .getJsonObjectFromAnArray(jsonElement);
-        StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(messageString))).expectSubscription()
-                .expectError(DmaapNotFoundException.class).verify();
+
+        List<FileData> fileDataResult = dmaapConsumerJsonParser.getJsonObject(Mono.just((messageString))).block();
+
+        assertNotNull(fileDataResult);
+        assertEquals(0, fileDataResult.size());
     }
 
     @Test
-    void whenPassingCorrectJsonWihoutFileFormatVersion_validationThrowingAnException() {
-        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder()
+    void whenPassingOneCorrectJsonWihoutFileFormatVersionAndOneCorrect_oneFileData() {
+        AdditionalField additionalFaultyField =
+                new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
+                        .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
+                        .fileFormatType("org.3GPP.32.435#measCollec").build();
+        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
                 .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
-                .fileFormatType("org.3GPP.32.435#measCollec").build();
+                .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
         JsonMessage message = new JsonMessage.JsonMessageBuilder().changeIdentifier("PM_MEAS_FILES")
-                .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalField).build();
+                .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalFaultyField)
+                .addAdditionalField(additionalField).build();
 
         String messageString = message.toString();
-
         String parsedString = message.getParsed();
-
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsedString);
         Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
                 .getJsonObjectFromAnArray(jsonElement);
-        StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(messageString))).expectSubscription()
-                .expectError(DmaapNotFoundException.class).verify();
+
+        List<FileData> fileDataResult = dmaapConsumerJsonParser.getJsonObject(Mono.just((messageString))).block();
+
+        assertNotNull(fileDataResult);
+        assertEquals(1, fileDataResult.size());
     }
 
-    // Fixed temprarily
     @Test
     void whenPassingJsonWithoutMandatoryHeaderInformation_validationThrowingAnException() {
         JsonMessage message = new JsonMessage.JsonMessageBuilder().changeIdentifier("PM_MEAS_FILES_INVALID")
                 .changeType("FileReady_INVALID").notificationFieldsVersion("1.0_INVALID").build();
-        String incorrectMessageString = message.toString();
 
+        String incorrectMessageString = message.toString();
         String parsedString = message.getParsed();
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsedString);
         Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
                 .getJsonObjectFromAnArray(jsonElement);
+
         StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(incorrectMessageString)))
                 .expectSubscription().expectError(DmaapNotFoundException.class).verify();
     }
@@ -165,15 +194,15 @@
     @Test
     void whenPassingJsonWithNullJsonElement_validationThrowingAnException() {
         JsonMessage message = new JsonMessage.JsonMessageBuilder().build();
+
         String incorrectMessageString = message.toString();
-
         String parsedString = message.getParsed();
-
         DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
         JsonElement jsonElement = new JsonParser().parse(parsedString);
 
         Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(dmaapConsumerJsonParser)
                 .getJsonObjectFromAnArray(jsonElement);
+
         StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(incorrectMessageString)))
                 .expectSubscription().expectError(DmaapNotFoundException.class).verify();
     }
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/utils/JsonMessage.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/utils/JsonMessage.java
index 264a994..1425140 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/utils/JsonMessage.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/utils/JsonMessage.java
@@ -2,17 +2,15 @@
  * ============LICENSE_START======================================================================
  * Copyright (C) 2018 Nordix Foundation. All rights reserved.
  * ===============================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
  * ============LICENSE_END========================================================================
  */
 
@@ -42,12 +40,13 @@
 
     /**
      * Gets the message in parsed format.
+     *
      * @return the massage in parsed format.
      */
     public String getParsed() {
         StringBuffer additionalFieldsString = new StringBuffer();
         if (arrayOfAdditionalFields.size() > 0) {
-            additionalFieldsString.append("\"arrayOfAdditionalFields\": [");
+            additionalFieldsString.append("\"arrayOfNamedHashMap\": [");
             for (Iterator<AdditionalField> iterator = arrayOfAdditionalFields.iterator(); iterator.hasNext();) {
                 AdditionalField additionalField = iterator.next();
                 additionalFieldsString.append(additionalField.toString());
@@ -82,6 +81,7 @@
     }
 
     public static class AdditionalField {
+        private String name;
         private String location;
         private String compression;
         private String fileFormatType;
@@ -89,17 +89,19 @@
 
         @Override
         public String toString() {
-            return "{"
+            return "{" + getAsStringIfParameterIsSet("name", name, true)
+                    + "\"hashMap\":{"
                     + getAsStringIfParameterIsSet("location", location,
                             compression != null || fileFormatType != null || fileFormatVersion != null)
                     + getAsStringIfParameterIsSet("compression", compression,
                             fileFormatType != null || fileFormatVersion != null)
                     + getAsStringIfParameterIsSet("fileFormatType", fileFormatType, fileFormatVersion != null)
-                    + getAsStringIfParameterIsSet("fileFormatVersion", fileFormatVersion, false) + "}";
+                    + getAsStringIfParameterIsSet("fileFormatVersion", fileFormatVersion, false) + "}}";
         }
 
 
         private AdditionalField(AdditionalFieldBuilder builder) {
+            this.name = builder.name;
             this.location = builder.location;
             this.compression = builder.compression;
             this.fileFormatType = builder.fileFormatType;
@@ -109,11 +111,17 @@
     }
 
     public static class AdditionalFieldBuilder {
+        private String name;
         private String location;
         private String compression;
         private String fileFormatType;
         private String fileFormatVersion;
 
+        public AdditionalFieldBuilder name(String name) {
+            this.name = name;
+            return this;
+        }
+
         public AdditionalFieldBuilder location(String location) {
             this.location = location;
             return this;
@@ -190,14 +198,15 @@
      * @param args Not used
      */
     public static void main(String[] args) {
-        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder()
+        AdditionalField additionalField = new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
                 .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
                 .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
-        AdditionalField secondAdditionalField = new JsonMessage.AdditionalFieldBuilder()
-                .location("sftp://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
-                .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
+        AdditionalField secondAdditionalField =
+                new JsonMessage.AdditionalFieldBuilder().name("A20161224.1030-1045.bin.gz")
+                        .location("sftp://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz").compression("gzip")
+                        .fileFormatType("org.3GPP.32.435#measCollec").fileFormatVersion("V10").build();
         JsonMessage message = new JsonMessage.JsonMessageBuilder().changeIdentifier("PM_MEAS_FILES")
-                .changeType("FileReady").notificationFieldsVersion("1.0").addAdditionalField(additionalField)
+                .changeType("FileReady").notificationFieldsVersion("2.0").addAdditionalField(additionalField)
                 .addAdditionalField(secondAdditionalField).build();
         System.out.println(message.toString());
     }
diff --git a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java
index 8010bdc..fd3c0c8 100644
--- a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java
+++ b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java
@@ -109,6 +109,7 @@
             responseSpec.onStatus(HttpStatus::is5xxServerError,
                     clientResponse -> handlePostErrors(model, clientResponse));
             String bodyToMono = responseSpec.bodyToMono(String.class).block();
+            logger.debug("File info sent to DR with response: " + bodyToMono);
         }
     }
 
diff --git a/pom.xml b/pom.xml
index 42448f4..189e392 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,9 @@
   ~ limitations under the License.
   ~ ============LICENSE_END=======================================================================
   -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -332,3 +334,4 @@
     </dependencies>
   </dependencyManagement>
 </project>
+
