Unexpected Some(ByteString()) instead of String

Hi there,

when developing an Akka Streams Application, I constructed my Stream step by step and have a Sink with println at the End. This approach worked well, as it showed me the content of the items arriving at the end of the stream. Now suddenly the println doesn’t print the passed Strings, instead it prints the following structure: Some(ByteString())
e.g.:
Some(ByteString(57, 55, 99, 56, 98, 55, 102, 55, 45, 97, 98, 49, 100, 45, 52, 53, 101, 51, 45, 97, 100, 53, 51, 45, 53, 51, 55, 97, 53, 102, 97, 97, 51, 100, 53, 100))

I suspect Akka Streams converted my Strings into Option[ByteString], but in the Signatures it is not visible.

Before the following code, It worked perfectly.

    .splitWhen(_.window_changed)
    .fold(CampaignWindowTimeCount(0L, Map(): Campaign2CountMap))((accu, campaignAndWindowChange) =>
      CampaignWindowTimeCount(campaignAndWindowChange.key.window_time, count(accu.campaign_2_count_map, campaignAndWindowChange.key.campaign_id)))
    .mergeSubstreams

It may have something to do with the created Subflow.

What do you guys think?

Thanks a lot!

Nevermind, I solved the problem. The Bytestring came from Redis, where I got some data from before that.

Good that you figured it out and thanks for sharing what was wrong in your code! (you get a forum behavior gold star for that :star2:)

1 Like