placidenduwayo 2 роки тому
джерело
коміт
2146d89a17

+ 21
- 18
src/main/scala/fr/natan/akkastreamfileprocessingapi/service/AkkaStreamFileProcessingImpl.scala Переглянути файл

@@ -128,24 +128,27 @@ class AkkaStreamFileProcessingImpl extends AkkaStreamFileProcessing {
128 128
       case Success(value: Option[String]) =>
129 129
         logger.info(s"TvSerie ID: $value")
130 130
         logger.info("END STEP 1/3")
131
-    })
132
-    logger.info("STEP 2/3")
133
-    val listPersonIDs: Future[IndexedSeq[Option[String]]] = getListOfPersonsIDByTvSerieID(tvSerieID = tvSerieID)
134
-    listPersonIDs.andThen({
135
-      case Failure(exception) => logger.error(s"!!!!!!!!!!!!!!!!!!!!!2$exception")
136
-      case Success(value) =>
137
-        value.foreach((personID:Option[String])=>logger.info(s"Person ID:$personID"))
138
-        logger.info("END STEP 2/3")
139
-    })
140
-
141
-    logger.info("STEP 3/3")
142
-    val personsTeam: Future[IndexedSeq[Person]] = getListOfPersonsForTvSerie(listPersonsIDs = listPersonIDs)
143
-    personsTeam.andThen({
144
-      case Failure(exception) => logger.error(s"!!!!!!!!!!!!!!!!!!!!!!!3$exception")
145
-      case Success(value) =>
146
-        logger.info(s"$value")
147
-        value.foreach((person:Person)=>logger.info(s"${person.toString}"))
148
-        logger.info("END STEP 3/3")
131
+    }).flatMap({
132
+      future =>
133
+        logger.info("STEP 2/3")
134
+        val listPersonIDs: Future[IndexedSeq[Option[String]]] = getListOfPersonsIDByTvSerieID(tvSerieID = tvSerieID)
135
+        listPersonIDs.andThen({
136
+          case Failure(exception) => logger.error(s"!!!!!!!!!!!!!!!!!!!!!2$exception")
137
+          case Success(value) =>
138
+            value.foreach((personID: Option[String]) => logger.info(s"Person ID:$personID"))
139
+            logger.info("END STEP 2/3")
140
+        }).flatMap({
141
+          future =>
142
+            logger.info("STEP 3/3")
143
+            val personsTeam: Future[IndexedSeq[Person]] = getListOfPersonsForTvSerie(listPersonsIDs = listPersonIDs)
144
+            personsTeam.andThen({
145
+              case Failure(exception) => logger.error(s"!!!!!!!!!!!!!!!!!!!!!!!3$exception")
146
+              case Success(value) =>
147
+                logger.info(s"$value")
148
+                value.foreach((person: Person) => logger.info(s"${person.toString}"))
149
+                logger.info("END STEP 3/3")
150
+            })
151
+        })
149 152
     })
150 153
 
151 154
    null

Powered by TurnKey Linux.