spring-projects / spring-projects/spring-data-commons
Why RepositoryMethodInvoker.doInvokeReactiveToSuspended strips coroutine continuation?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 838
- Forks
- 730
- PR merge metrics
- No merged PRs in 30d
Description
[Version: spring-data-commons-2.4.13]
Hi, I have quesiton during digging the behavior of r2dbc, CoroutineCrudRepository.
First of all, What I want to do is logging query with some metadata that only can be retrieved from outer reactor or coroutine context (ex> ipath, eventId, spanId ..).
What I try first is
- Register ProxyConnectionFactory and register listener to log query.
- I wrote the code inside proxy listener that obtain "currentCoroutineContext[ReactorContext]" and use them when logging
But I found that "currentCoroutineContext[ReactorContext]" returns empty.
And I digging the repository behavior and I encounter below code.

Does the code in L168 means that all methods that are invoked in repository interface loose outer ractor or coroutine context?
Is there any way that can pass the outer coroutine or reactor context into repository method invokation?
Thank you.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The entry point is RepositoryMethodInvoker.doInvokeReactiveToSuspended, with the report pointing to line 168; review it alongside CoroutineCrudRepository and the ProxyConnectionFactory listener scenario. Reproduce the missing currentCoroutineContext[ReactorContext] behavior and establish whether repository invocation preserves the outer context; done means a confirmed explanation or a narrowly defined change with a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100