public TransformData(ILogger <TransformData> logger, AsyncActionSubscriptionFactory subscriptionFactory, PublisherFactory publisherFactory) { if (logger is null) { throw new ArgumentNullException(nameof(logger)); } if (subscriptionFactory is null) { throw new ArgumentNullException(nameof(subscriptionFactory)); } if (publisherFactory is null) { throw new ArgumentNullException(nameof(publisherFactory)); } var pattern = new PatternBuilder("playground") .With("data") .With("rng") .Build(); this.subscription = subscriptionFactory.Create(pattern, this.TransformAsync); this.publisher = publisherFactory.Create(); this.logger = logger; }
/// <summary> /// 订单流水数据+1 /// </summary> public void NextNumber() { IncreasingNumber++; var publisher = PublisherFactory.Create(); publisher.PublishAsync(string.Format("Qct.LocalPos.NextIncreasingNumber.{0}.{1}.{2}", CompanyId, StoreId, MachineSn), IncreasingNumber, true); }
/// <summary> /// 提交订单 /// </summary> /// <returns></returns> public Order SubmitOrder(IEnumerable <IOrderMarketingResult> marketingResults) { var order = new Order(this, marketingResults); var publisher = PublisherFactory.Create(); publisher.PublishAsync(string.Format("PharosRetailing.POSOrderCommited.{0}.{1}.{2}", Cashier.CompanyId, Cashier.StoreId, Cashier.MachineSn), order, true); return(order); }
/// <summary> /// 设置订单完成 /// </summary> public void SetOrderComplete() { //必须先锁定流水号 OrderId.SetLockIncreasingNumber(); var publisher = PublisherFactory.Create(); publisher.PublishAsync(string.Format("Qct.LocalPos.OrderCompleted.{0}.{1}.{2}", Cashier.CompanyId, Cashier.StoreId, Cashier.MachineSn), this, true); }
/// <summary> /// 设置支付完成 /// </summary> /// <param name="orderPays"></param> public void SetOrderPayComplete(IEnumerable <OrderPay> orderPays) { if (orderPays == null) { throw new OrderException("支付信息为空,设置失败!"); } OrderPays = orderPays; OrderState = OrderState.Paid; var publisher = PublisherFactory.Create(); publisher.PublishAsync(string.Format("Qct.LocalPos.OrderPaid.{0}.{1}.{2}", Cashier.CompanyId, Cashier.StoreId, Cashier.MachineSn), this, true); }
public void RemoteCallback(SocketClient client, SockectPackageMessage package) { EventJsonWrapper eventJson; if (package.TryReadFromJsonStream(out eventJson)) { var publisher = PublisherFactory.Create(); if (publisher.PublisherId != eventJson.PublisherId) { publisher.PublishAsync(eventJson); } } }
public GenerateData(ILogger <GenerateData> logger, PublisherFactory publisherFactory) { if (logger is null) { throw new ArgumentNullException(nameof(logger)); } if (publisherFactory is null) { throw new ArgumentNullException(nameof(publisherFactory)); } this.timer.Elapsed += this.Timer_Elapsed; this.logger = logger; this.publisher = publisherFactory.Create(); }