The current transaction context
Sets the transaction context using the registered transaction context propagator. Runs the callback function, in which the transactionContext will be available by calling this#getTransactionContext.
The TransactionContextPropagator must persist the transactionContext and make it available to callback via this#getTransactionContext.
The precedence of merging context can be seen in the specification.
Example:
app.use((req: Request, res: Response, next: NextFunction) => {
const ip = res.headers.get("X-Forwarded-For")
OpenFeature.setTransactionContext({ targetingKey: req.user.id, ipAddress: ip }, () => {
// The transaction context is used in any flag evaluation throughout the whole call chain of next
next();
});
})
Returns the currently defined transaction context using the registered transaction context propagator.