Request id property in state machine instance is set to zero guid

20 views
Skip to first unread message

Alexey Zimarev

unread,
Nov 23, 2016, 4:15:32 PM11/23/16
to masstransit-discuss
We have had several situations when using Request-Response in state machine sagas and in saga instance that is being persisted, the corresponding request id is set to zero guid.

The request configuration looks like this:
            Request(() => IdentifyCustomer, saga => saga.CustomerIdentificationRequestId, c =>
            {
                c.ServiceAddress = _financeAddress;
                c.SchedulingServiceAddress = _schedulerAddress;
                c.Timeout = TimeSpan.Zero;
            });


The call looks like this:
                When(OrderCreated, c => c.Instance.CustomerId == 0)
                    .Then(c => Log.Debug("Mapping for subscriber for Navision customer id {navisionId} not found", c.Data.NavisionCustomerId))
                    .Request(IdentifyCustomer, c => new Commands.IdentifyCustomerCmd(c.Instance.NavisionCustomerId))
                    .TransitionTo(WaitingForSubscriber)


Then in the logs I see the message is being sent with the header value: 
RequestId: "1b340000-da2d-1866-07f4-08d413e4b8a4"

I added logging to the saga repository and this is what is being saved (and what I also see in the storage):

{CorrelationId: "b89c3502-9032-49d0-b43b-44147847b181", 
CurrentState: "WaitingForSubscriber", 
CustomerId: 0, 
CustomerIdentificationRequestId: "00000000-0000-0000-0000-000000000000", 
Id: "b89c3502-9032-49d0-b43b-44147847b181",

When the response comes, the repository is trying to find saga instance but apparently fails.

We have observed it twice and one time it just went away after we did completely unrelated changes to the code but now we are there and it seems that nothing helps.

Alexey Zimarev

unread,
Nov 24, 2016, 5:18:31 AM11/24/16
to masstransit-discuss
I am debugging now and I see that the request pipe constructor generates wrong request id:

Alexey Zimarev

unread,
Nov 24, 2016, 5:21:37 AM11/24/16
to masstransit-discuss
OK, this is how it suppose to work, the constructor does not set the id. The request id is set in pipe.Send, which is called later, after the property on the instance has already been incorrectly set.

Alexey Zimarev

unread,
Nov 24, 2016, 5:43:13 AM11/24/16
to masstransit-discuss
Okay, continued on github
Reply all
Reply to author
Forward
0 new messages