Cast response message

27 views
Skip to first unread message

Yura Lebedev

unread,
Jul 10, 2017, 4:10:13 PM7/10/17
to masstransit-discuss
We want to use MassTransit in our new project.

Before, we used RabbitMQ and MongoDB BsonSerializer to transfer the data.
For transmission, we used interfaces. After getting data we cast them into the correct type. In MassTransit, when we receive a response from the Request in CreateRequestClient, we get a specific type and can not cast it into the passed type. For example:

IResponseMessage message = await client.Request(new TestRequestMessage()
    {
        Value = 3
    });
var someMessage = message as SomeResponseMessage;
if (someMessage != null){
    ....
}
var anotherMessage = message as AnotherResponseMessage;
if (anotherMessage != null){
    ....
}

Does it possible to receive different types in MassTransit?
Reply all
Reply to author
Forward
0 new messages