Deffering messages with nservicebus

本秂侑毒 提交于 2019-12-02 06:06:35

In your code

if (scheduleRecheck && result.ErrorMessage.Equals("Bad Request"))
            {
                Logger.Error("Stock query for stock code '{0}' returned a 'Product Not Found' status",
                    stockcode);

                _bus.SendLocal<ScheduleCheckStockAvailabilityCommand>(cmd =>
                {
                    cmd.StockCode = stockcode;
                });
            }
        }

you are sending a message ScheduleCheckStockAvailabilityCommand. Now in your other function yoe are deferring this message i.e. ScheduleCheckStockAvailabilityCommand (which i think is called only when there is some error with CheckCurrentProductAvailabilityCommand ). So according to what I gather you want to defer CheckCurrentProductAvailabilityCommand rather than ScheduleCheckStockAvailabilityCommand so I think your code should be:

if (scheduleRecheck && result.ErrorMessage.Equals("Bad Request"))
            {
                Logger.Error("Stock query for stock code '{0}' returned a 'Product Not               Found' status",stockcode);
              _bus.Defer(_checkStockCodeAvailability.TimeOutTime, CheckCurrentProductAvailabilityCommand);

            }
        }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!