I Created a saga application. in which i created three commands.
public class SagaHandler : Saga<GroupSagaData>, IAmStartedByMessages<DataCommand>,
IHandleMessages<SendDataCommand>
The GroupSagaData properties are.
public class GroupSagaData : IContainSagaData
{
public virtual Guid Id { get; set; }
public virtual string OriginalMessageId { get; set; }
public virtual string Originator { get; set; }
public virtual Guid GroupId { get; set; }
public virtual IList<SagaData> SagaDatas { get; set; }
}
the DataCommand properties are
public class DataCommand : IMessage
{
public Guid Id { get; set; }
public int NoOfElementsInGroup { get; set; }
public int TotalNoOfRecordsInFiles { get; set; }
public Guid GroupId { get; set; }
public string DataSource { get; set; }
public DateTime JobStartTime { get; set; }
}
and
public class SendDataCommand :IMessage
{
public Guid GroupId { get; set; }
public int NoOfElementsInGroup { get; set; }
public int TotalNoOfRecordsInFiles { get; set; }
}
I implemented like this.
protected override void ConfigureHowToFindSaga(SagaPropertyMapper<GroupSagaData> mapper)
{
mapper.ConfigureMapping<DataCommand>(message => message.GroupId).ToSaga(sagaData => sagaData.GroupId);
mapper.ConfigureMapping<SendDataCommand>(message => message.GroupId).ToSaga(sagaData => sagaData.GroupId);
}
public async Task Handle(DataCommand message, IMessageHandlerContext context)
{
//some function
}
when i am debugging,upto GroupSagaData is working fine. After it is not able to find IAmStartedByMessages and IHandleMessages.
In database tables are created GroupSagaData and DataCommand. but data is not moving from the tables. it is blocked in tables.
What I am doing wrong, please suggest