Is it possible to send message from Saga that declared as interface?

37 views
Skip to first unread message

Alex Wheat

unread,
Sep 24, 2017, 10:15:11 AM9/24/17
to masstransit-discuss
Is it possible to do similar to 

            DuringAny(
               
When(Finished)
                   
.Publish(context => new TurnoutJobCompleted
                   
{
                       
EndTime = context.Instance.EndTime,
                       
Id = context.Instance.Id,
                       
JobId = context.Instance.CorrelationId,
                       
StartTime = context.Instance.StartTime
                   
}));


but when the message declared as an interface?

Chris Patterson

unread,
Sep 25, 2017, 6:54:00 AM9/25/17
to masstrans...@googlegroups.com
Yeah, you just have to cast it to the interface type, or you can use the type cache, I think it's:

TypeMetadataCache<T>.InitializeFromObject(new { ... })

to create your interface implementation.


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/1e11ffcd-95f9-4ecd-81ec-1252dcdf50be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexey Zimarev

unread,
Oct 9, 2017, 2:13:06 PM10/9/17
to masstransit-discuss
I personally prefer to have private classes that implement public interfaces.
Reply all
Reply to author
Forward
0 new messages