public void Run() { Started.Set(); EventStarted?.Invoke(this); Finished.Set(); ContiniousBlockCompleted.Set(); EventFinished?.Invoke(this); }
private void OnStartedHdl(int nid) { //RTActionLeakManager.Instance.ActionExecuted(nid); if (nid != CommandId) { return; } Started.Set(); Logger.Instance.Debug(this, "start", nid.ToString()); EventStarted?.Invoke(this); }
public void Run() { Started.Set(); EventStarted?.Invoke(this); if (manager != null) { manager.SyncCoordinates(globalPosition); } Finished.Set(); ContiniousBlockCompleted.Set(); EventFinished?.Invoke(this); }
public void Run() { Started.Set(); EventStarted?.Invoke(this); foreach (var reg in toolCommand.Registers) { sender.WriteRegister(reg.DeviceId, reg.RegisterId, reg.RegisterValue); } if (toolCommand.Delay > 0) { Thread.Sleep(toolCommand.Delay); } Finished.Set(); ContiniousBlockCompleted.Set(); EventFinished?.Invoke(this); }
static async Task Main(string[] args) { Console.Title = "Distributed Saga Controller"; var endpointConfiguration = new EndpointConfiguration(ConstantString.SagaEndpoint); endpointConfiguration.SendFailedMessagesTo(ConstantString.ErrorTableName); endpointConfiguration.AuditProcessedMessagesTo(ConstantString.AuditTableName); endpointConfiguration.EnableInstallers(); var transport = endpointConfiguration.UseTransport <SqlServerTransport>(); transport.ConnectionString(ConstantString.ConnectionString); transport.DefaultSchema(ConstantString.SchemaName); transport.UseSchemaForQueue(ConstantString.ErrorTableName, ConstantString.SchemaName); transport.UseSchemaForQueue(ConstantString.AuditTableName, ConstantString.SchemaName); transport.UseSchemaForEndpoint(ConstantString.LoanWorkerEndpoint, ConstantString.SchemaName); //transport.CreateMessageBodyComputedColumn(); var routing = transport.Routing(); // routing.RegisterPublisher(typeof(LoanEndpointAccepted).Assembly, ConstantString.LoanWorkerEndpoint); // routing.RouteToEndpoint(typeof(LoanEndpointAccepted), ConstantString.SagaEndpoint); routing.RegisterPublisher(typeof(LoanEndpointJobDone).Assembly, ConstantString.LoanWorkerEndpoint); routing.RegisterPublisher(typeof(LoanEndpointAccepted).Assembly, ConstantString.LoanWorkerEndpoint); var persistence = endpointConfiguration.UsePersistence <SqlPersistence>(); var dialect = persistence.SqlDialect <SqlDialect.MsSqlServer>(); dialect.Schema(ConstantString.SchemaName); persistence.ConnectionBuilder(() => new SqlConnection(ConstantString.ConnectionString)); persistence.TablePrefix(ConstantString.PersistenceSagaPrefix); var subscriptions = persistence.SubscriptionSettings(); subscriptions.CacheFor(TimeSpan.FromMinutes(1)); // endpointConfiguration.EnableOutbox(); var endpointInstance = await Endpoint.Start(endpointConfiguration).ConfigureAwait(false); Console.WriteLine("Press any key to send a message"); Console.WriteLine("Press Esc to exit"); while (true) { var key = Console.ReadKey(); Console.WriteLine(); if (key.Key == ConsoleKey.Escape) { break; } var loanEventTriggered = new EventStarted { EventId = Guid.NewGuid(), LoanId = new Guid("ec9bdd39-15d0-4d54-af1b-d7a39fb35579") }; var ownEvent = new OwnEventStarted(loanEventTriggered); await endpointInstance.SendLocal(ownEvent).ConfigureAwait(false); Console.WriteLine("Done EndpointInstance.SendLocal(ownEvent).ConfigureAwait(false);"); await endpointInstance.Publish(loanEventTriggered).ConfigureAwait(false); Console.WriteLine("await endpointInstance.Publish(loanEventTriggered).ConfigureAwait(false);"); Console.WriteLine("Published LoanEventTriggered event: " + JsonConvert.SerializeObject(loanEventTriggered)); } await endpointInstance.Stop().ConfigureAwait(false); }
public OwnEventStarted(EventStarted anEvent) { EventId = anEvent.EventId; LoanId = anEvent.LoanId; }