public class AsyncResponseTransaction extends Object implements KeycloakTransaction
AsyncResponse.resume(Object)
directly in the code, the response is returned before all changes
done withing this execution are committed. Therefore we need some mechanism that resumes the AsyncResponse after all
changes are successfully committed. This can be achieved by enlisting an instance of AsyncResponseTransaction into
the main transaction using KeycloakTransactionManager.enlistAfterCompletion(KeycloakTransaction)
.Modifier and Type | Method and Description |
---|---|
void |
begin() |
void |
commit() |
static void |
finishAsyncResponseInTransaction(KeycloakSession session,
javax.ws.rs.container.AsyncResponse responseToFinishInTransaction,
javax.ws.rs.core.Response responseToSend)
This method creates a new AsyncResponseTransaction instance that resumes provided AsyncResponse
responseToFinishInTransaction with given Response responseToSend . |
boolean |
getRollbackOnly() |
boolean |
isActive() |
void |
rollback() |
void |
setRollbackOnly() |
public static void finishAsyncResponseInTransaction(KeycloakSession session, javax.ws.rs.container.AsyncResponse responseToFinishInTransaction, javax.ws.rs.core.Response responseToSend)
responseToFinishInTransaction
with given Response responseToSend
. The transaction is enlisted
to KeycloakTransactionManager
.session
- Current KeycloakSessionresponseToFinishInTransaction
- AsyncResponse to be resumed on KeycloakTransactionManager
commit/rollback.responseToSend
- Response to be sentpublic void begin()
begin
in interface KeycloakTransaction
public void commit()
commit
in interface KeycloakTransaction
public void rollback()
rollback
in interface KeycloakTransaction
public void setRollbackOnly()
setRollbackOnly
in interface KeycloakTransaction
public boolean getRollbackOnly()
getRollbackOnly
in interface KeycloakTransaction
public boolean isActive()
isActive
in interface KeycloakTransaction
Copyright © 2021 JBoss by Red Hat. All rights reserved.