Skip to content

Exception when using @RequestScope and async CompletableFuture #30

@mattes3

Description

@mattes3

Hello,

when I use an asynchronous batch data loader together with a request-scoped DataLoader, the thing crashes when the batch data loader calls a backend service that needs a request-scoped JPA EntityManager.

This is because the asynchronous batch data loader starts a new thread, and the dependency injection framework (Ratpack/Guice in this case) does not find the request scope threadlocal any more.

How is this supposed to work?

Best...
Matthias

P.S. As a work-around, I removed the asynchronous stuff and used CompletableFuture.completedFuture() in the Batch Loader, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions