Skip to content
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

ContextNotActiveException for request scoped bean in Kotlin Flow #18993

Closed
a-frank opened this issue Jul 26, 2021 · 1 comment · Fixed by #19010
Closed

ContextNotActiveException for request scoped bean in Kotlin Flow #18993

a-frank opened this issue Jul 26, 2021 · 1 comment · Fixed by #19010
Assignees
Labels
Milestone

Comments

@a-frank
Copy link

a-frank commented Jul 26, 2021

Describe the bug

Hi Quarkus Team,

first of all thanks for adding Flow as an option for SSE endpoints.

But currently when using Flow this leads to a ContextNotActiveException, when combining it with the access to a request scoped bean

Kind regards

Expected behavior

The value of the request scoped bean can be accessed within the context of a Flow

Actual behavior

When trying to access a property of the request scoped bean a javax.enterprise.context.ContextNotActiveException is thrown

How to Reproduce?

Request scoped bean
@RequestScoped class RequestScopedBean( var user: String? = null )

Endpoint

@Path("/hello")
class ReactiveGreetingResource(private val requestScopedBean: RequestScopedBean) {

	@GET
	@RestSseElementType(MediaType.TEXT_PLAIN)
	fun hello(): Flow<String> = flow {
		emit("Hello RESTEasy Reactive")
		delay(1_000)
		emit("Hello again from ${requestScopedBean.user}")
	}
}
@a-frank a-frank added the kind/bug Something isn't working label Jul 26, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 26, 2021

/cc @evanchooly

@geoand geoand self-assigned this Jul 27, 2021
geoand added a commit that referenced this issue Jul 27, 2021
Ensure Flow return type works with Request Scope in RESTEasy Reactive
@quarkus-bot quarkus-bot bot added this to the 2.2 - main milestone Jul 27, 2021
@gsmet gsmet modified the milestones: 2.2 - main, 2.1.1.Final Aug 3, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants