public override void Consume(TMessage message)
        {
            base.Consume(message);

            var reply = FastActivator <TReplyMessage> .Create(message.CorrelationId);

            ContextStorage.Context().Respond(reply);
        }
Beispiel #2
0
 public static DataEventAction <T, TData> RespondWith <T, TData, TMessage>(this DataEventAction <T, TData> eventAction, Func <T, TData, TMessage> action)
     where T : SagaStateMachine <T>, ISaga
     where TData : class
     where TMessage : class
 {
     eventAction.Call((saga, message) => ContextStorage.Context().Respond(action(saga, message)));
     return(eventAction);
 }
Beispiel #3
0
        public void Consume(TResponse message)
        {
            CommandInstance instance;

            lock (_commands)
                if (!_commands.TryGetValue(message.CorrelationId, out instance))
                {
                    Interlocked.Increment(ref _unknownCommands);
                    return;
                }

            instance.ResponseCreatedAt  = message.CreatedAt;
            instance.ResponseReceivedAt = SystemUtil.UtcNow;
            instance.Worker             = ContextStorage.Context().SourceAddress;
            Interlocked.Increment(ref _responseCount);

            _received.Set();
        }
Beispiel #4
0
 public static TResult Context <TResult>(this IServiceBus bus, Func <IConsumeContext, TResult> contextCallback)
 {
     return(ContextStorage.Context(contextCallback));
 }
Beispiel #5
0
 public static void Context(this IServiceBus bus, Action <IConsumeContext> contextCallback)
 {
     ContextStorage.Context(contextCallback);
 }
Beispiel #6
0
 public static IConsumeContext Context(this IServiceBus bus)
 {
     return(ContextStorage.Context());
 }
Beispiel #7
0
 public static IConsumeContext Context(this IConsumer instance)
 {
     return(ContextStorage.Context());
 }
 public void Consume(SimpleRequestMessage message)
 {
     ContextStorage.Context().Respond(new SimpleResponseMessage(message.CorrelationId));
 }