# Need a handle of dropped messages in akka streams

**URL:** <https://discuss.akka.io/t/need-a-handle-of-dropped-messages-in-akka-streams/2699>\
**Category:** Akka Libraries\
**Tags:** streams\
**Created:** [November 13, 2018, 2:37pm UTC](https://discuss.akka.io/t/need-a-handle-of-dropped-messages-in-akka-streams/2699 "2018-11-13T14:37:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skvithalani](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/skvithalani/32/423_2.png) [@skvithalani](https://discuss.akka.io/u/skvithalani)\
**Post date:** [November 13, 2018, 2:37pm UTC](https://discuss.akka.io/t/need-a-handle-of-dropped-messages-in-akka-streams/2699/1 "2018-11-13T14:37:09Z")

</div>

We have following stream source:

```auto
val (actorRef, stream) = Source.actorRef[(Event, Promise[Done])](1024, OverflowStrategy.dropHead).preMaterialize()

```

As you can notice above the actor message queue size is 1024 and overflow strategy is DropHead.

So, in the scenario when 1025th `Event` is inserted in actor message queue it gets dropped, but the promise associated with that Event is left orphaned in whole stream processing. This promise is never completed and the associated future never completes. We need a way to get the handle of dropped promises so that we can complete them with appropriate failure.

A Potential solution is to introduce a method in `Source` similar to `preMaterialize()` , for e.g. `droppedMessages()` which return a tuple of original stream `Source[(Event, Promise[Done]), NotUsed]` and a new stream, again of same type `Source[(Event, Promise[Done]), NotUsed]` . For e.g.

```auto
val (stream, droppedEvents) = Source.actorRef[(Event, Promise[Done])](1024, OverflowStrategy.dropHead).droppedMessages()

```

Please note that our usecase is to perform an action (i.e. completion on `Promise` ), on a message just before it gets dropped and we are totally fine to discard them after action.
