/// <summary>
        /// Either adds a new payload, or updates an existing payload
        /// </summary>
        /// <param name="addFactory">The payload factory called if the payload is not present</param>
        /// <param name="updateFactory">The payload factory called if the payload already exists</param>
        /// <typeparam name="T">The payload type</typeparam>
        /// <returns></returns>
        public override T AddOrUpdatePayload <T>(PayloadFactory <T> addFactory, UpdatePayloadFactory <T> updateFactory)
        {
            if (this is T context)
            {
                return(context);
            }

            return(_context.AddOrUpdatePayload(addFactory, updateFactory));
        }
Esempio n. 2
0
        public InMemoryOutboxConsumeContext(ConsumeContext context)
            : base(context)
        {
            ReceiveContext = new InMemoryOutboxReceiveContext(this, context.ReceiveContext);

            _pendingActions = new List <Func <Task> >();
            _clearToSend    = TaskUtil.GetTask <InMemoryOutboxConsumeContext>();

            if (context.TryGetPayload(out MessageSchedulerContext schedulerContext))
            {
                _outboxSchedulerContext = new InMemoryOutboxMessageSchedulerContext(schedulerContext);
                context.AddOrUpdatePayload(() => _outboxSchedulerContext, _ => _outboxSchedulerContext);
            }
        }
Esempio n. 3
0
 T PipeContext.AddOrUpdatePayload <T>(PayloadFactory <T> addFactory, UpdatePayloadFactory <T> updateFactory)
 {
     return(_context.AddOrUpdatePayload(addFactory, updateFactory));
 }