Skip to content

Commit

Permalink
temporarily support old style of adding metadata (logic to be removed…
Browse files Browse the repository at this point in the history
… in the next release)
  • Loading branch information
bekiroguz committed Jan 9, 2025
1 parent 19f185f commit 861f0ba
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class AkkaBaker private[runtime](config: AkkaBakerConfig) extends scaladsl.Baker
* @return
*/
override def bake(recipeId: String, recipeInstanceId: String, metadata: Map[String, String]): Future[Unit] = {
processIndexActor.ask(CreateProcess(recipeId, recipeInstanceId, metadata))(config.timeouts.defaultBakeTimeout).javaTimeoutToBakerTimeout("bake").flatMap {
val eventualBake = processIndexActor.ask(CreateProcess(recipeId, recipeInstanceId, metadata))(config.timeouts.defaultBakeTimeout).javaTimeoutToBakerTimeout("bake").flatMap {
case _: Initialized =>
Future.successful(())
case ProcessDeleted =>
Expand All @@ -238,6 +238,13 @@ class AkkaBaker private[runtime](config: AkkaBakerConfig) extends scaladsl.Baker
case RecipeManagerProtocol.NoRecipeFound(_) =>
Future.failed(NoSuchRecipeException(recipeId))
}

// TODO This is a temporary backwards compatibility logic to support the old way of adding metadata during rollout, to be removed in the future release
if (metadata.nonEmpty) {
eventualBake.map(_ => addMetaData(recipeInstanceId, metadata))
} else {
eventualBake
}
}

override def fireEventAndResolveWhenReceived(recipeInstanceId: String, event: EventInstance, correlationId: Option[String]): Future[SensoryEventStatus] =
Expand Down

0 comments on commit 861f0ba

Please sign in to comment.