Skip to content

Commit

Permalink
migrate SampleCamundaWorker to netcoreapp3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnoBerry committed Mar 30, 2020
1 parent 24a2269 commit 047104b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 75 deletions.
28 changes: 14 additions & 14 deletions Camunda.Worker.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Camunda.Worker.Tests", "tes
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{D397D745-D633-4FE1-B707-697181EE3697}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCamundaWorker", "samples\SampleCamundaWorker\SampleCamundaWorker.csproj", "{47DC36B6-2542-4706-B96A-CDC56C28097C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCamundaWorker", "samples\SampleCamundaWorker\SampleCamundaWorker.csproj", "{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -52,22 +52,22 @@ Global
{8EFD4F82-2790-4423-986D-33A70049C0CA}.Release|x64.Build.0 = Release|Any CPU
{8EFD4F82-2790-4423-986D-33A70049C0CA}.Release|x86.ActiveCfg = Release|Any CPU
{8EFD4F82-2790-4423-986D-33A70049C0CA}.Release|x86.Build.0 = Release|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Debug|x64.ActiveCfg = Debug|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Debug|x64.Build.0 = Debug|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Debug|x86.ActiveCfg = Debug|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Debug|x86.Build.0 = Debug|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Release|Any CPU.Build.0 = Release|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Release|x64.ActiveCfg = Release|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Release|x64.Build.0 = Release|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Release|x86.ActiveCfg = Release|Any CPU
{47DC36B6-2542-4706-B96A-CDC56C28097C}.Release|x86.Build.0 = Release|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Debug|x64.ActiveCfg = Debug|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Debug|x64.Build.0 = Debug|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Debug|x86.ActiveCfg = Debug|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Debug|x86.Build.0 = Debug|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Release|Any CPU.Build.0 = Release|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Release|x64.ActiveCfg = Release|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Release|x64.Build.0 = Release|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Release|x86.ActiveCfg = Release|Any CPU
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{752742A0-922B-456E-9300-94E54210EFFF} = {0EE6B9DE-6282-47E3-B0AA-79C99861D230}
{8EFD4F82-2790-4423-986D-33A70049C0CA} = {10FC99E1-8C27-426E-8D4B-EE645ECEF426}
{47DC36B6-2542-4706-B96A-CDC56C28097C} = {D397D745-D633-4FE1-B707-697181EE3697}
{78C5DDE7-FE3C-4585-BE22-C8FC6E25B81B} = {D397D745-D633-4FE1-B707-697181EE3697}
EndGlobalSection
EndGlobal
21 changes: 5 additions & 16 deletions samples/SampleCamundaWorker/Program.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Serilog;
using Microsoft.Extensions.Hosting;

namespace SampleCamundaWorker
{
public class Program
{
private const string LogTemplate = "{Timestamp:dd-MM-yyyy HH:mm:ss} [{Level:u4}] ({SourceContext}) " +
"{Message:lj}{NewLine}{Exception}";

public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
CreateHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseSerilog((hostBuilder, logger) =>
{
logger
.ReadFrom.Configuration(hostBuilder.Configuration)
.WriteTo.Console(outputTemplate: LogTemplate)
.Enrich.FromLogContext();
});
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
}
15 changes: 0 additions & 15 deletions samples/SampleCamundaWorker/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:12095",
"sslPort": 44316
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"SampleCamundaWorker": {
"commandName": "Project",
"launchBrowser": false,
Expand Down
15 changes: 2 additions & 13 deletions samples/SampleCamundaWorker/SampleCamundaWorker.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Camunda.Worker\Camunda.Worker.csproj" />
</ItemGroup>

</Project>
11 changes: 7 additions & 4 deletions samples/SampleCamundaWorker/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System;
using Camunda.Worker;
using Camunda.Worker.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SampleCamundaWorker.Handlers;

Expand All @@ -19,7 +20,6 @@ public Startup(IConfiguration configuration)

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddCamundaWorker(options =>
Expand All @@ -40,15 +40,18 @@ public void ConfigureServices(IServiceCollection services)
logger.LogInformation("Finished processing of task {Id}", context.Task.Id);
});
});

services.AddHealthChecks();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseHealthChecks("/health");
}
}
}
12 changes: 5 additions & 7 deletions samples/SampleCamundaWorker/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
10 changes: 4 additions & 6 deletions samples/SampleCamundaWorker/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"Serilog": {
"MinimumLevel": {
"Logging": {
"LogLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
Expand Down

0 comments on commit 047104b

Please sign in to comment.