相同的响应类型在 MassTransit Saga 中的两个请求中。

huangapple go评论60阅读模式
英文:

The same response type in two requests in MassTransit Saga

问题

I'm trying to create a state machine and I'd like to send multiple requests from this state machine. The requests are defined as follows:

public Request<StageState, ICloseStage, ICloseStageRequestSuccess, IRequestFailed> CloseStageRequest { get; private set; }

public Request<StageState, IPublishStage, IPublishStageRequestSuccess, IRequestFailed> PublishStageRequest { get; private set; }

Both requests might get the same response in Response2. However, when I'm running the state machine I'm getting the following error:

System.ArgumentException: An item with the same key has already been added. Key: IRequestFailed

So, I suppose this is happening because I'm using IRequestFailed in both requests. Is it a by-design behavior or is there a workaround so I can use this response type in both requests? I really need to use it in this way because IRequestFailed is processed in a unified way for all the requests in the state machine, and I'm planning to add more requests.

Thanks in advance.

英文:

I'm trying to create a state machine and I'd like to send multiple requests from this state machine. The requests are defined as follows:

public Request&lt;StageState, ICloseStage, ICloseStageRequestSuccess, IRequestFailed&gt; CloseStageRequest { get; private set; }

public Request&lt;StageState, IPublishStage, IPublishStageRequestSuccess, IRequestFailed&gt; PublishStageRequest { get; private set; }

Both requests might get the same response in Response2. However, when I'm running the state machine I'm getting the following error:

System.ArgumentException : An item with the same key has already been added. Key: IRequestFailed

So, I suppose this is happening because I'm using IRequestFailed in both requests. Is it a by-design behavior or is there a workaround so I can use this response type in both requests? I really need to use it in this way because IRequestFailed is processed in a unified way for all the requests in the state machine, and I'm planning to add more requests.

Thanks in advance.

答案1

得分: 0

MassTransit状态机不支持具有相同响应类型的两个请求。

英文:

The MassTransit state machine does not support two requests with the same response type.

huangapple
  • 本文由 发表于 2023年3月9日 16:45:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/75682210.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定