-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeleteMessage Sink shuts down after one command #10
Comments
Can you show me you command object? Most likely the issues lie in there somewhere. I've been dealing with this myself recently for a retry flow. From my testing, the cause is normally a As for if there is a better way to do this, have you looked at the Going to leave this open until I either find a solution to this problem, and know the root cause for why it happens and what can be done to avoid it. |
I updated the original post with the full actor. The relevant command factories are: def charCmdFactory(sayAsActor: ActorRef): ParsedCmdFactory[F, SayAsCmd.CharacterArgs, NotUsed] =
ParsedCmdFactory[F, SayAsCmd.CharacterArgs, NotUsed](
refiner = CmdInfo[F](
prefix = Categories.adminCommands,
aliases = Seq("char"),
filters = Seq(ByUser(UserId(Main.adminId)))),
sink = _ => Sink.actorRefWithAck(
ref = sayAsActor,
onInitMessage = SayAsCmd.InitAck,
ackMessage = SayAsCmd.Ack,
onCompleteMessage = PoisonPill),
description = Some(CmdDescription(
name = "Character Registry",
description = "Add/Remove/List Characters",
usage = "register <name> [<avatar url>]|unregister <name>|list")));
def sayasCmdFactory(sayAsActor: ActorRef): ParsedCmdFactory[F, SayAsCmd.SayArgs, NotUsed] =
ParsedCmdFactory[F, SayAsCmd.SayArgs, NotUsed](
refiner = CmdInfo[F](
prefix = Categories.generalCommands,
aliases = Seq("sayas")),
sink = _ => Sink.actorRefWithAck(
ref = sayAsActor,
onInitMessage = SayAsCmd.InitAck,
ackMessage = SayAsCmd.Ack,
onCompleteMessage = PoisonPill),
description = Some(CmdDescription(
name = "SayAs",
description = "Speak as a registered character",
usage = "<name> <text>"))); I'm not using Source.single anywhere, I think, unless there is somehow one hidden in I was originally planning to use |
I also find it curious, that it's always the delete flow that fails, even if I switch the positions in the Edit: I tried |
My only guess would be that mapConcat has some of the same logic to cause the same error. As for what I said above, when Is aid being lazy I meant more not worry about doing things properly. As for keeping the required state around, that's what withContext is for. As for the types being different. Yep, that's the only difference. On master it's just the same flow/sink casted to different types. |
Is there a common supertype I could use for a sink that would make it possible to use a single flow for both |
|
Ok, I made a single flow now for both message types like this: private val msgQueue = Source.queue[(ActorRef, SayAsMessage, ChannelId, MessageId)](32, OverflowStrategy.backpressure)
.mapAsyncUnordered(parallelism = 1000)((t: (ActorRef, SayAsMessage, ChannelId, MessageId)) =>
(t._1 ? t._2).mapTo[List[CreateMessageData]].map(l => (DeleteMessage(t._3, t._4) :: l.map(CreateMessage(t._3, _)))))
.mapConcat(identity)
.to(requests.sinkIgnore[Any, NotUsed]).run(); But once again only the first exchange works, and then the flow simply stops executing any requests (i.e. neither |
Retry requests fixes on master. Not sure how much it was ever related to this bug, but that should be the last "Stream stopped for some reason" kind of bug. |
This is more a request for help, than a bug (I think...you tell me).
I'm trying to also delete the original command message when it has been processed successfully and a response has been generated.
To that end I adapted the code from the core example in the following way:
This approach works for the first command after I start the bot, and afterwards the delete path seems to shut down and only the reply path works. (I added the
log
elements to the flow graph and the last message from the delete flow is[DELETE MSG] Downstream finished.
)a) Is this intended behaviour?
b) How do I work around it?
c) Is there a better way to sink both
CreateMessage
andDeleteMessage
events into therequests
queue, without splitting the stream like this?The text was updated successfully, but these errors were encountered: