diff --git a/samples/Sample.Kafka/Program.cs b/samples/Sample.Kafka/Program.cs new file mode 100644 index 0000000..fc06e25 --- /dev/null +++ b/samples/Sample.Kafka/Program.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; + +namespace Sample.Kafka +{ + public class Program + { + public static void Main(string[] args) + { + var host = new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .UseApplicationInsights() + .Build(); + + host.Run(); + } + } +} diff --git a/samples/Sample.Kafka/Properties/launchSettings.json b/samples/Sample.Kafka/Properties/launchSettings.json new file mode 100644 index 0000000..a057a71 --- /dev/null +++ b/samples/Sample.Kafka/Properties/launchSettings.json @@ -0,0 +1,29 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:49909/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Sample.Kafka": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:49910" + } + } +} diff --git a/samples/Sample.Kafka/Sample.Kafka.csproj b/samples/Sample.Kafka/Sample.Kafka.csproj new file mode 100644 index 0000000..5e32ee8 --- /dev/null +++ b/samples/Sample.Kafka/Sample.Kafka.csproj @@ -0,0 +1,23 @@ + + + + netcoreapp1.1 + + + + + + + + + + + + + + + + + + + diff --git a/samples/Sample.Kafka/Startup.cs b/samples/Sample.Kafka/Startup.cs new file mode 100644 index 0000000..9a142b5 --- /dev/null +++ b/samples/Sample.Kafka/Startup.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Cap.Consistency.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Sample.Kafka.Entity; + +namespace Sample.Kafka +{ + public class Startup + { + public Startup(IHostingEnvironment env) { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) { + // Add framework services. + services.AddMvc(); + + services.AddConsistency(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { + loggerFactory.AddConsole(Configuration.GetSection("Logging")); + loggerFactory.AddDebug(); + + app.UseMvc(); + + app.UseConsistency(); + } + } +} diff --git a/samples/Sample.Kafka/appsettings.Development.json b/samples/Sample.Kafka/appsettings.Development.json new file mode 100644 index 0000000..fa8ce71 --- /dev/null +++ b/samples/Sample.Kafka/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/samples/Sample.Kafka/appsettings.json b/samples/Sample.Kafka/appsettings.json new file mode 100644 index 0000000..5fff67b --- /dev/null +++ b/samples/Sample.Kafka/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning" + } + } +}