Beispiel #1
0
 public static DataEventAction <T, TData> RetryLater <T, TData>(this DataEventAction <T, TData> eventAction)
     where T : SagaStateMachine <T>, ISaga
     where TData : class
 {
     eventAction.Call((saga, message) => ContextStorage.MessageContext <TData>().RetryLater());
     return(eventAction);
 }
Beispiel #2
0
        static void RewriteResponseAddress(Uri responseAddress)
        {
            var context = ContextStorage.MessageContext <Distributed <TMessage> >() as ConsumeContext <Distributed <TMessage> >;

            if (context != null)
            {
                context.SetResponseAddress(responseAddress);
            }
        }
Beispiel #3
0
        public void Execute(Composer composer, TInstance instance, TData value)
        {
            composer.Execute(() =>
            {
                IConsumeContext <TData> context = ContextStorage.MessageContext <TData>();

                context.RetryLater();
            });
        }
Beispiel #4
0
        public void Execute(Composer composer, TInstance instance, TData value)
        {
            composer.Execute(() =>
            {
                IConsumeContext <TData> context = ContextStorage.MessageContext <TData>();

                TMessage message = _messageFactory(instance, context);

                instance.Bus.PublishRequest(message, configurator => _configurator(instance, context, configurator));
            });
        }
        public void Execute(Composer composer, TInstance instance, TData value)
        {
            composer.Execute(() =>
            {
                IConsumeContext <TData> context = ContextStorage.MessageContext <TData>();

                TMessage message = _messageFactory(instance, context);

                context.Respond(message, _contextCallback);
            });
        }
Beispiel #6
0
        public static EventActivityBinder <TInstance, TData> Publish <TInstance, TData, TMessage>(
            this EventActivityBinder <TInstance, TData> source,
            Func <TInstance, IConsumeContext <TData>, TData, TMessage> messageFactory)
            where TInstance : class, SagaStateMachineInstance
            where TData : class
            where TMessage : class
        {
            Func <TInstance, TData, TMessage> factory =
                (i, d) => messageFactory(i, ContextStorage.MessageContext <TData>(), d);

            return(source.Add(new PublishActivity <TInstance, TData, TMessage>(factory, x => { })));
        }
        public void Consume(IGetMessageTraceList message)
        {
            IConsumeContext <IGetMessageTraceList> context = ContextStorage.MessageContext <IGetMessageTraceList>();

            Uri responseAddress = context.ResponseAddress;

            if (responseAddress == null)
            {
                return;
            }

            int count = message.Count;

            IEndpoint responseEndpoint = context.Bus.GetEndpoint(responseAddress);

            _fiber.Add(() => SendLastTraceMessagesTo(responseEndpoint, count));
        }
Beispiel #8
0
 public static IConsumeContext <T> MessageContext <T>(this IServiceBus bus)
     where T : class
 {
     return(ContextStorage.MessageContext <T>());
 }
Beispiel #9
0
 public static IConsumeContext <T> MessageContext <T>(this Consumes <T> .All instance)
     where T : class
 {
     return(ContextStorage.MessageContext <T>());
 }