protected abstract void CheckRouting(StandardPayload payload, BasicDeliverEventArgs bdea);
public void CheckPayload(StandardPayload payload) { payload.SenderId = this.SenderId.ToString(); payload.SenderName = this.SenderName; payload.PayloadId = Guid.NewGuid().ToString(); }
/// <summary> /// IssueTemporaryUseToken - /// </summary> public Task IssueTemporaryUseToken(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT) { return(this.SendMessage("licensecoordinator.custom.ssiouser.issuetemporaryusetoken", payload, replyHandler, timeoutHandler, waitTimeout)); }
private void ConnectAndMonitor() { this.MonitorTask = new Task(() => { var count = 0; var subscription = new Subscription(RMQChannel, QueueName); BasicDeliverEventArgs bdea = default(BasicDeliverEventArgs); while (this.RMQChannel.IsOpen) { var gotMessage = subscription.Next(100, out bdea); if (gotMessage) { var payload = new StandardPayload(); try { var msgText = string.Format("{0}{1}. {2} => {3}{0}", Environment.NewLine, ++count, bdea.Exchange, bdea.RoutingKey); //var msgText = string.Format("{3}. {0}: {1} -> '{2}'", bdea.Exchange, bdea.RoutingKey, Encoding.UTF8.GetString(bdea.Body), ++count); if (SMQActorBase.IsDebugMode) { Console.WriteLine(msgText); } var body = Encoding.UTF8.GetString(bdea.Body); payload = JsonConvert.DeserializeObject <StandardPayload>(body, this.DefaultJsonSerializerSettings); if (ReferenceEquals(payload, null)) { payload = new StandardPayload() { ErrorMessage = "Payload missing." } } ; this.OnMessageReceived(payload, bdea); this.CheckRouting(payload, bdea); } catch (Exception ex) { payload.ErrorMessage = ex.Message; this.Reply(payload, bdea.BasicProperties); } this.OnAfterMessageReceived(payload, bdea); } } try { if (this.RMQChannel.IsOpen) { this.RMQChannel.Close(); } } catch { } // Ignore errors on closing the channel try { if (this.RMQConnection.IsOpen) { this.RMQConnection.Close(); } } catch { } // Ignore errrors on closing connection }); this.MonitorTask.Start(); }
/// <summary> /// GetProductLicenses - /// </summary> public Task GetProductLicenses(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT) { return(this.SendMessage("crudcoordinator.crud.ssiouser.getproductlicenses", payload, replyHandler, timeoutHandler, waitTimeout)); }
/// <summary> /// DeleteLicenseSKU - /// </summary> public Task DeleteLicenseSKU(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT) { return(this.SendMessage("crudcoordinator.crud.ssiouser.deletelicensesku", payload, replyHandler, timeoutHandler, waitTimeout)); }
/// <summary> /// UpdateBrandLicense - /// </summary> public Task UpdateBrandLicense(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT) { return(this.SendMessage("crudcoordinator.crud.ssiouser.updatebrandlicense", payload, replyHandler, timeoutHandler, waitTimeout)); }
/// <summary> /// AddLicenseMeter - /// </summary> public Task AddLicenseMeter(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT) { return(this.SendMessage("crudcoordinator.crud.ssiouser.addlicensemeter", payload, replyHandler, timeoutHandler, waitTimeout)); }
/// <summary> /// GetInvoiceLineItems - /// </summary> public Task GetInvoiceLineItems(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT) { return(this.SendMessage("crudcoordinator.crud.ssiouser.getinvoicelineitems", payload, replyHandler, timeoutHandler, waitTimeout)); }