Skip to content

Commit

Permalink
it's not mandatory in EventProducerPushDestination, but fail for exac…
Browse files Browse the repository at this point in the history
…tly empty

* default is identity
  • Loading branch information
patriknw committed Aug 30, 2023
1 parent 5920a9a commit c796961
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,8 @@ object EventProducerPushDestination {
* Starting point for building `Transformation`. Registrations of actual transformations must
* be added. Use [[Transformation.identity]] to pass through each event as is.
*/
val empty: Transformation = new Transformation(
typedMappers = Map.empty,
untypedMappers = envelope =>
throw new IllegalArgumentException(
s"Missing transformation for event [${envelope.eventOption.map(_.getClass).getOrElse("")}]. " +
"Use Transformation.identity to pass through each event as is."))
val empty: Transformation =
new Transformation(Map.empty, Predef.identity)

/**
* No transformation. Pass through each event as is.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ private[akka] final class EventPusherConsumerServiceImpl(
}
val transformer =
destination.eventProducerPushDestination.transformationForOrigin(init.originId, metadata)
if (transformer eq EventProducerPushDestination.Transformation.empty)
throw new IllegalArgumentException(
s"Transformation must not be empty. Use Transformation.identity to pass through each event as is.")

// allow interceptor to block request based on metadata
val interceptedTail = destination.eventProducerPushDestination.interceptor match {
Expand Down

0 comments on commit c796961

Please sign in to comment.