mirror of https://github.com/abpframework/abp.git
45 changed files with 695 additions and 741 deletions
@ -1,24 +1,23 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.HangFire |
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.HangFire; |
|||
|
|||
class Program |
|||
{ |
|||
class Program |
|||
static void Main(string[] args) |
|||
{ |
|||
static void Main(string[] args) |
|||
using (var application = AbpApplicationFactory.Create<DemoAppHangfireModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
using (var application = AbpApplicationFactory.Create<DemoAppHangfireModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
application.Initialize(); |
|||
application.Initialize(); |
|||
|
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
|
|||
application.Shutdown(); |
|||
} |
|||
application.Shutdown(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,24 +1,23 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.Quartz |
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.Quartz; |
|||
|
|||
class Program |
|||
{ |
|||
class Program |
|||
static void Main(string[] args) |
|||
{ |
|||
static void Main(string[] args) |
|||
using (var application = AbpApplicationFactory.Create<DemoAppQuartzModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
using (var application = AbpApplicationFactory.Create<DemoAppQuartzModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
application.Initialize(); |
|||
application.Initialize(); |
|||
|
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
|
|||
application.Shutdown(); |
|||
} |
|||
application.Shutdown(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,24 +1,23 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.RabbitMq |
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.RabbitMq; |
|||
|
|||
class Program |
|||
{ |
|||
class Program |
|||
static void Main(string[] args) |
|||
{ |
|||
static void Main(string[] args) |
|||
using (var application = AbpApplicationFactory.Create<DemoAppRabbitMqModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
using (var application = AbpApplicationFactory.Create<DemoAppRabbitMqModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
application.Initialize(); |
|||
application.Initialize(); |
|||
|
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
|
|||
application.Shutdown(); |
|||
} |
|||
application.Shutdown(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,43 +1,41 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.Migrations |
|||
namespace Volo.Abp.BackgroundJobs.DemoApp.Migrations; |
|||
|
|||
public partial class Initial : Migration |
|||
{ |
|||
public partial class Initial : Migration |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AbpBackgroundJobs", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true), |
|||
JobName = table.Column<string>(maxLength: 128, nullable: false), |
|||
JobArgs = table.Column<string>(maxLength: 1048576, nullable: false), |
|||
TryCount = table.Column<short>(nullable: false, defaultValue: (short)0), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
NextTryTime = table.Column<DateTime>(nullable: false), |
|||
LastTryTime = table.Column<DateTime>(nullable: true), |
|||
IsAbandoned = table.Column<bool>(nullable: false, defaultValue: false), |
|||
Priority = table.Column<byte>(nullable: false, defaultValue: (byte)15) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); |
|||
}); |
|||
migrationBuilder.CreateTable( |
|||
name: "AbpBackgroundJobs", |
|||
columns: table => new { |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true), |
|||
JobName = table.Column<string>(maxLength: 128, nullable: false), |
|||
JobArgs = table.Column<string>(maxLength: 1048576, nullable: false), |
|||
TryCount = table.Column<short>(nullable: false, defaultValue: (short)0), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
NextTryTime = table.Column<DateTime>(nullable: false), |
|||
LastTryTime = table.Column<DateTime>(nullable: true), |
|||
IsAbandoned = table.Column<bool>(nullable: false, defaultValue: false), |
|||
Priority = table.Column<byte>(nullable: false, defaultValue: (byte)15) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", |
|||
table: "AbpBackgroundJobs", |
|||
columns: new[] { "IsAbandoned", "NextTryTime" }); |
|||
} |
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", |
|||
table: "AbpBackgroundJobs", |
|||
columns: new[] { "IsAbandoned", "NextTryTime" }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpBackgroundJobs"); |
|||
} |
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpBackgroundJobs"); |
|||
} |
|||
} |
|||
|
|||
@ -1,24 +1,23 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.DemoApp |
|||
namespace Volo.Abp.BackgroundJobs.DemoApp; |
|||
|
|||
class Program |
|||
{ |
|||
class Program |
|||
static void Main(string[] args) |
|||
{ |
|||
static void Main(string[] args) |
|||
using (var application = AbpApplicationFactory.Create<DemoAppModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
using (var application = AbpApplicationFactory.Create<DemoAppModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
})) |
|||
{ |
|||
application.Initialize(); |
|||
application.Initialize(); |
|||
|
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
Console.WriteLine("Started: " + typeof(Program).Namespace); |
|||
Console.WriteLine("Press ENTER to stop the application..!"); |
|||
Console.ReadLine(); |
|||
|
|||
application.Shutdown(); |
|||
} |
|||
application.Shutdown(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,9 +1,8 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public class AbpBackgroundJobsDomainSharedModule : AbpModule |
|||
{ |
|||
public class AbpBackgroundJobsDomainSharedModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
@ -1,15 +1,14 @@ |
|||
namespace Volo.Abp.BackgroundJobs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public static class BackgroundJobRecordConsts |
|||
{ |
|||
public static class BackgroundJobRecordConsts |
|||
{ |
|||
/// <summary>
|
|||
/// Default value: 128
|
|||
/// </summary>
|
|||
public static int MaxJobNameLength { get; set; } = 128; |
|||
/// <summary>
|
|||
/// Default value: 128
|
|||
/// </summary>
|
|||
public static int MaxJobNameLength { get; set; } = 128; |
|||
|
|||
/// <summary>
|
|||
/// Default value: 1024 * 1024
|
|||
/// </summary>
|
|||
public static int MaxJobArgsLength { get; set; } = 1024 * 1024; |
|||
} |
|||
/// <summary>
|
|||
/// Default value: 1024 * 1024
|
|||
/// </summary>
|
|||
public static int MaxJobArgsLength { get; set; } = 1024 * 1024; |
|||
} |
|||
|
|||
@ -1,13 +1,12 @@ |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public static class BackgroundJobsDbProperties |
|||
{ |
|||
public static class BackgroundJobsDbProperties |
|||
{ |
|||
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; |
|||
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; |
|||
|
|||
public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; |
|||
public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; |
|||
|
|||
public const string ConnectionStringName = "AbpBackgroundJobs"; |
|||
} |
|||
public const string ConnectionStringName = "AbpBackgroundJobs"; |
|||
} |
|||
|
|||
@ -1,18 +1,17 @@ |
|||
using AutoMapper; |
|||
using Volo.Abp.AutoMapper; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public class BackgroundJobsDomainAutoMapperProfile : Profile |
|||
{ |
|||
public class BackgroundJobsDomainAutoMapperProfile : Profile |
|||
public BackgroundJobsDomainAutoMapperProfile() |
|||
{ |
|||
public BackgroundJobsDomainAutoMapperProfile() |
|||
{ |
|||
CreateMap<BackgroundJobInfo, BackgroundJobRecord>() |
|||
.ConstructUsing(x => new BackgroundJobRecord(x.Id)) |
|||
.Ignore(record => record.ConcurrencyStamp) |
|||
.Ignore(record => record.ExtraProperties); |
|||
CreateMap<BackgroundJobInfo, BackgroundJobRecord>() |
|||
.ConstructUsing(x => new BackgroundJobRecord(x.Id)) |
|||
.Ignore(record => record.ConcurrencyStamp) |
|||
.Ignore(record => record.ExtraProperties); |
|||
|
|||
CreateMap<BackgroundJobRecord, BackgroundJobInfo>(); |
|||
} |
|||
CreateMap<BackgroundJobRecord, BackgroundJobInfo>(); |
|||
} |
|||
} |
|||
|
|||
@ -1,18 +1,17 @@ |
|||
using Volo.Abp.MongoDB; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.MongoDB |
|||
namespace Volo.Abp.BackgroundJobs.MongoDB; |
|||
|
|||
public static class BackgroundJobsMongoDbContextExtensions |
|||
{ |
|||
public static class BackgroundJobsMongoDbContextExtensions |
|||
public static void ConfigureBackgroundJobs( |
|||
this IMongoModelBuilder builder) |
|||
{ |
|||
public static void ConfigureBackgroundJobs( |
|||
this IMongoModelBuilder builder) |
|||
{ |
|||
Check.NotNull(builder, nameof(builder)); |
|||
Check.NotNull(builder, nameof(builder)); |
|||
|
|||
builder.Entity<BackgroundJobRecord>(b => |
|||
{ |
|||
b.CollectionName = BackgroundJobsDbProperties.DbTablePrefix + "BackgroundJobs"; |
|||
}); |
|||
} |
|||
builder.Entity<BackgroundJobRecord>(b => |
|||
{ |
|||
b.CollectionName = BackgroundJobsDbProperties.DbTablePrefix + "BackgroundJobs"; |
|||
}); |
|||
} |
|||
} |
|||
|
|||
@ -1,13 +1,12 @@ |
|||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpBackgroundJobsEntityFrameworkCoreTestModule) |
|||
)] |
|||
public class AbpBackgroundJobsDomainTestModule : AbpModule |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpBackgroundJobsEntityFrameworkCoreTestModule) |
|||
)] |
|||
public class AbpBackgroundJobsDomainTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
@ -1,7 +1,6 @@ |
|||
namespace Volo.Abp.BackgroundJobs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public abstract class BackgroundJobsDomainTestBase : BackgroundJobsTestBase<AbpBackgroundJobsDomainTestModule> |
|||
{ |
|||
public abstract class BackgroundJobsDomainTestBase : BackgroundJobsTestBase<AbpBackgroundJobsDomainTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,7 +1,6 @@ |
|||
namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore |
|||
namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
|||
|
|||
public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests<AbpBackgroundJobsEntityFrameworkCoreTestModule> |
|||
{ |
|||
public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests<AbpBackgroundJobsEntityFrameworkCoreTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,9 @@ |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.MongoDB |
|||
namespace Volo.Abp.BackgroundJobs.MongoDB; |
|||
|
|||
[Collection((MongoTestCollection.Name))] |
|||
public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests<AbpBackgroundJobsMongoDbTestModule> |
|||
{ |
|||
[Collection((MongoTestCollection.Name))] |
|||
public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests<AbpBackgroundJobsMongoDbTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -1,22 +1,21 @@ |
|||
using System; |
|||
using Mongo2Go; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.MongoDB |
|||
namespace Volo.Abp.BackgroundJobs.MongoDB; |
|||
|
|||
public class MongoDbFixture : IDisposable |
|||
{ |
|||
public class MongoDbFixture : IDisposable |
|||
{ |
|||
private static readonly MongoDbRunner MongoDbRunner; |
|||
public static readonly string ConnectionString; |
|||
private static readonly MongoDbRunner MongoDbRunner; |
|||
public static readonly string ConnectionString; |
|||
|
|||
static MongoDbFixture() |
|||
{ |
|||
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20); |
|||
ConnectionString = MongoDbRunner.ConnectionString; |
|||
} |
|||
static MongoDbFixture() |
|||
{ |
|||
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20); |
|||
ConnectionString = MongoDbRunner.ConnectionString; |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
MongoDbRunner?.Dispose(); |
|||
} |
|||
public void Dispose() |
|||
{ |
|||
MongoDbRunner?.Dispose(); |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,9 @@ |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs.MongoDB |
|||
namespace Volo.Abp.BackgroundJobs.MongoDB; |
|||
|
|||
[CollectionDefinition(Name)] |
|||
public class MongoTestCollection : ICollectionFixture<MongoDbFixture> |
|||
{ |
|||
[CollectionDefinition(Name)] |
|||
public class MongoTestCollection : ICollectionFixture<MongoDbFixture> |
|||
{ |
|||
public const string Name = "MongoDB Collection"; |
|||
} |
|||
} |
|||
public const string Name = "MongoDB Collection"; |
|||
} |
|||
|
|||
@ -1,12 +1,11 @@ |
|||
using System; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public class BackgroundJobsTestData : ISingletonDependency |
|||
{ |
|||
public class BackgroundJobsTestData : ISingletonDependency |
|||
{ |
|||
public Guid JobId1 { get; } = Guid.NewGuid(); |
|||
public Guid JobId2 { get; } = Guid.NewGuid(); |
|||
public Guid JobId3 { get; } = Guid.NewGuid(); |
|||
} |
|||
public Guid JobId1 { get; } = Guid.NewGuid(); |
|||
public Guid JobId2 { get; } = Guid.NewGuid(); |
|||
public Guid JobId3 { get; } = Guid.NewGuid(); |
|||
} |
|||
|
|||
Loading…
Reference in new issue