Replies: 1 comment 1 reply
-
The I think you should try to come up with a unit test even smaller than that to possibly illustrate a faulty context passing, if any. The more atomic, the better. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to use Context passing to keep a transaction object across a Mutiny pipeline. It works great even across several
transformToMulti
calls and back toUni
etc.: the context is available. But when trying to use the context in anonCompletion
oronTermination
handler, I only get an empty context.onFailure
works forUni
, but notMulti
. I have not yet testedonCancellation
.I've tried to make some simple examples.
They're all the same except for how
commitTransaction
(orrollbackTransaction
(identical for sake of example)) is invoked.I would have hoped that in all examples, the same context (including the
"transaction"
object) is available inside thecommitTransaction
/rollbackTransaction
callback. However, onlyonItem
works in bothUni
andMulti
, andonFailure
works only inUni
.I'm guessing that
onCompletion
etc. make new internal pipelines with new subscribers where the context is not passed automatically.Would this be a valid bug or feature request or am I missing something?
Note regarding alternatives to Mutiny context passing: I cannot use
@RequestScoped
because my pipelines are triggered by something that creates no request scope and I cannot use@Transactional
because my database engine is not supported.This is the output:
I have had success with the following workaround. However, this requires "hiding" the choice of
onTermination
vsonFailure
inside thecommitTransactionCtx
helper function. I'd like to be able to explicitly choose in the top-level pipeline.Beta Was this translation helpful? Give feedback.
All reactions