Provide access to database transactions for CorDapp developers

Description

Currently CorDapp developers have access to Corda persistence via the flow framework and Corda services. However, it might be the case that some work needs to be performed on another thread. Trying to access `CordaPersistence` from another thread results in the following exception:

Caused by: java.lang.IllegalStateException: Was expecting to find CordaPersistence set on current thread: Thread[RxIoScheduler-2,5,main]

This is because there's no `ThreadLocal` instance of `CordaPersistence` available. It would be useful if there was an API for CorDapp developers to wrap vault calls etc. in a database transaction block. This would allow developers to perform tasks that require node database access in separate threads.

Status

Assignee

Michele Sollecito

Reporter

Roger Willis

Labels

Feature Team

Operational Experience

Story Points

None

Fix versions

Ported to...

None

Priority

Medium
Configure