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();
});
})
Sets a transaction context propagator on this receiver. The transaction context propagator is responsible for persisting context for the duration of a single transaction.
The context propagator to be used
The receiver (this object)
Returns the currently defined transaction context using the registered transaction context propagator.