static async Task Main(string[] args) { IEndpointInstance endpoint = await Endpoint.Start(EndpointStarter.CreateCommonConfiguration(EndpointNames.Sender)); Console.WriteLine("Started."); Console.WriteLine("Press [E], [C], [M], [S] or press Enter to exit."); ConsoleKeyInfo key; bool shouldFail = false; Randomizer.Seed = new Random(8675309); while ((key = Console.ReadKey()).Key != ConsoleKey.Enter) { if (key.Key == ConsoleKey.S) { shouldFail = !shouldFail; Console.WriteLine("Should fail is now: " + shouldFail); } if (key.Key == ConsoleKey.E) { await endpoint.Publish(new TestEvent { ID = Guid.NewGuid(), ShouldFail = shouldFail }); } if (key.Key == ConsoleKey.C) { await endpoint.Send( new TestCommand { ID = Guid.NewGuid(), ShouldFail = shouldFail, ExecutionData = new SagaExecutionData { Category = DataFaker.ExecutionDataFaker.Category, Color = DataFaker.ExecutionDataFaker.Color, ProductName = DataFaker.ExecutionDataFaker.ProductName, WaitForSeconds = DataFaker.ExecutionDataFaker.WaitForSeconds } }); } if (key.Key == ConsoleKey.M) { await endpoint.SendLocal(new TestMessage { ID = Guid.NewGuid(), ShouldFail = shouldFail }); } if (key.Key == ConsoleKey.Enter) { await endpoint.Stop(); break; } } }
static Task Start() { var connection = "Data Source=localhost;User Id=particular; Password=Welcome1; Enlist=false"; return(EndpointStarter.Start("SqlPersistence.Sample.Oracle", persistence => { persistence.SqlVariant(SqlVariant.Oracle); persistence.TablePrefix("Oracle"); persistence.ConnectionBuilder(() => new OracleConnection(connection)); })); }
static Task Start() { var connection = @"Data Source=.\SQLEXPRESS;Initial Catalog=sqlpersistencesample;Integrated Security=True"; return(EndpointStarter.Start("SqlPersistence.Sample.MsSqlServer", persistence => { persistence.SqlVariant(SqlVariant.MsSqlServer); persistence.TablePrefix("AcceptanceTests"); persistence.ConnectionBuilder(() => new SqlConnection(connection)); })); }
static Task Main() { var connection = "server=localhost;user=root;database=sqlpersistencesample;port=3306;password=Password1;Allow User Variables=True"; return(EndpointStarter.Start("SqlPersistence.Sample.MySql", persistence => { persistence.SqlDialect <SqlDialect.MySql>(); persistence.TablePrefix("MySql"); persistence.ConnectionBuilder(() => new MySqlConnection(connection)); })); }
static Task Main() { var connection = @"Data Source=.\SQLEXPRESS;Initial Catalog=sqlpersistencesample;Integrated Security=True"; SqlHelper.EnsureDatabaseExists(connection); return(EndpointStarter.Start("SqlPersistence.Sample.MsSqlServer", persistence => { persistence.SqlDialect <SqlDialect.MsSqlServer>(); persistence.TablePrefix("AcceptanceTests"); persistence.ConnectionBuilder(() => new SqlConnection(connection)); })); }
public static async Task Main(string[] args) { IEndpointInstance endpoint = null; try { endpoint = await Endpoint.Start(EndpointStarter.CreateCommonConfiguration(EndpointNames.SagaEndpoint)); Console.WriteLine("Started."); Console.ReadLine(); } finally { endpoint?.Stop(); } }
static Task Main() { return(EndpointStarter.Start("SqlPersistence.Sample.PostgreSql", persistence => { var sqlDialect = persistence.SqlDialect <SqlDialect.PostgreSql>(); sqlDialect.JsonBParameterModifier(parameter => { var npgsqlParameter = (NpgsqlParameter)parameter; npgsqlParameter.NpgsqlDbType = NpgsqlDbType.Jsonb; }); persistence.TablePrefix("PostgreSql"); var connection = Environment.GetEnvironmentVariable("PostgreSqlConnectionString"); if (string.IsNullOrWhiteSpace(connection)) { throw new Exception("PostgreSqlConnectionString environment variable is empty"); } persistence.ConnectionBuilder(() => new NpgsqlConnection(connection)); })); }