These are chat archives for petabridge/akka-bootcamp

21st
Feb 2017
babafemi
@webafriq_twitter
Feb 21 2017 12:00
It just takes a while.
Thats ok.
Please who can tell me what i am doing wrong here?
class UpdateMfbTransactionConfigurationActor : ReceiveActor, IWithUnboundedStash
{
    public ICommercialBankRepo<CommercialBank> commercialBankRepo = ServiceLocator.ServiceLocator.GetService<ICommercialBankRepo<CommercialBank>>("commercialBankRepo");
    private readonly ILoggingAdapter _log = Context.GetLogger();
    public IStash Stash { get; set; }
    public UpdateMfbTransactionConfigurationActor()
    {
        FinishedUpdatingMfbConfiguration();
    }

    private void UpdatingMfbConfiguration()
    {
        ReceiveAny(o => Stash.Stash());
        Stash.UnstashAll();
    }

    private void FinishedUpdatingMfbConfiguration()
    {
        Receive<UpdateMfbTransactionMessage>(message => StartUpdatingMfbConfiguration(message));
    }

    private void StartUpdatingMfbConfiguration(UpdateMfbTransactionMessage message)
    {
        CommBankCorrespondenceBankConfig model = new CommBankCorrespondenceBankConfig();
        model.Id = message.Id;
        model.NoOfFailedTransRetries = message.NoOfFailedTransRetries;
        model.NotifyOnEveryTrans = message.NotifyOnEveryTrans;
        model.ShouldBankApprove = message.ShouldBankApprove;
        model.ShouldSuperAgentApprove = message.ShouldSuperAgentApprove;
        model.SuperAgentId = message.SuperAgentId;
        model.TotalAmountOfTransPerDay = message.TotalAmountOfTransPerDay;
        model.CommBankContactPersonEmail = message.CommBankContactPersonEmail;
        model.CommercialBankId = message.CommercialBankId;
        model.AccToCredit = message.AccToCredit;
        model.AccToDebit = message.AccToDebit;
        model.TransactionLimit = message.TransactionLimit;
        var result = commercialBankRepo.UpdateMfbConfig(model);
        Sender.Tell(result);
        Become(UpdatingMfbConfiguration);
    }
Who can please tell me what i am doing wrong here. Its an update, when i perform the first update, it works, but when i perform another one immediately first update, it keeps rolling foreever.
@Aaronontheweb, can you please pls help or anyone else.
babafemi
@webafriq_twitter
Feb 21 2017 12:05
I have tried i am missing something and i dont know.
mwardm
@mwardm
Feb 21 2017 23:54
(Newbie here, so I could be missing many things but) It looks to me like when you Become
(UpdatingMfbConfiguration) you enter a state (with your ReceiveAny) where any type of message just gets stashed.
You never seem to Become anything else, so messages just get stashed forever, no?