Skip to content

Commit bdfe7c1

Browse files
committed
Merge branch 'develop' of https://github.com/ethanhann/InEngine.NET into develop
2 parents 376a197 + c8dfa70 commit bdfe7c1

File tree

13 files changed

+68
-38
lines changed

13 files changed

+68
-38
lines changed

IntegrationEngine.Client/IntegrationEngine.Client.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -8,6 +8,8 @@
88
<RootNamespace>IntegrationEngine.Client</RootNamespace>
99
<AssemblyName>IntegrationEngine.Client</AssemblyName>
1010
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
12+
<RestorePackages>true</RestorePackages>
1113
</PropertyGroup>
1214
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1315
<DebugSymbols>true</DebugSymbols>
@@ -22,7 +24,7 @@
2224
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2325
<DebugType>full</DebugType>
2426
<Optimize>true</Optimize>
25-
<OutputPath>bin\Release</OutputPath>
27+
<OutputPath>lib\net45\</OutputPath>
2628
<ErrorReport>prompt</ErrorReport>
2729
<WarningLevel>4</WarningLevel>
2830
<ConsolePause>false</ConsolePause>
@@ -34,6 +36,9 @@
3436
</Reference>
3537
</ItemGroup>
3638
<ItemGroup>
39+
<Compile Include="..\configuration\SharedAssemblyInfo.cs">
40+
<Link>Properties\SharedAssemblyInfo.cs</Link>
41+
</Compile>
3742
<Compile Include="Properties\AssemblyInfo.cs" />
3843
<Compile Include="Client.cs" />
3944
<Compile Include="EndpointName.cs" />
@@ -51,4 +56,5 @@
5156
<SubType>Designer</SubType>
5257
</None>
5358
</ItemGroup>
59+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
5460
</Project>
Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
11
using System.Reflection;
22
using System.Runtime.CompilerServices;
33

4-
// Information about this assembly is defined by the following attributes.
5-
// Change them to the values specific to your project.
6-
74
[assembly: AssemblyTitle("IntegrationEngine.Client")]
8-
[assembly: AssemblyDescription("")]
9-
[assembly: AssemblyConfiguration("")]
10-
[assembly: AssemblyCompany("")]
11-
[assembly: AssemblyProduct("")]
12-
[assembly: AssemblyCopyright("ethanhann")]
13-
[assembly: AssemblyTrademark("")]
14-
[assembly: AssemblyCulture("")]
15-
16-
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17-
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18-
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19-
20-
[assembly: AssemblyVersion("1.0.*")]
21-
22-
// The following attributes are used to specify the signing key for the assembly,
23-
// if desired. See the Mono documentation for more information about signing.
24-
25-
//[assembly: AssemblyDelaySign(false)]
26-
//[assembly: AssemblyKeyFile("")]
27-

IntegrationEngine.ConsoleHost/IntegrationEngine.ConsoleHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>
3333
<Externalconsole>true</Externalconsole>
34-
<PlatformTarget>x86</PlatformTarget>
34+
<PlatformTarget>AnyCPU</PlatformTarget>
3535
</PropertyGroup>
3636
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
3737
<DebugSymbols>true</DebugSymbols>

IntegrationEngine/Api/Controllers/CronTriggerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public IHttpActionResult PutCronTrigger(string id, CronTrigger trigger)
4949
BadRequest(ModelState);
5050
Repository.Update(trigger);
5151
EngineScheduler.ScheduleJobWithCronTrigger(trigger);
52-
return StatusCode(HttpStatusCode.NoContent);
52+
return Ok(Repository.SelectById(trigger.Id));
5353
}
5454

5555
// POST api/CronTrigger

IntegrationEngine/Api/Controllers/SimpleTriggerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public IHttpActionResult PutSimpleTrigger(string id, SimpleTrigger trigger)
5353
BadRequest(ModelState);
5454
Repository.Update(trigger);
5555
EngineScheduler.ScheduleJobWithSimpleTrigger(trigger);
56-
return StatusCode(HttpStatusCode.NoContent);
56+
return Ok(Repository.SelectById(trigger.Id));
5757
}
5858

5959
// POST api/SimpleTrigger

IntegrationEngine/EngineHostConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ public void SetupElasticClient()
165165

166166
public void Shutdown()
167167
{
168-
var scheduler = Container.Resolve<IScheduler>();
169-
scheduler.Shutdown();
168+
var engineScheduler = Container.Resolve<IEngineScheduler>();
169+
engineScheduler.Shutdown();
170170
}
171171
}
172172
}

IntegrationEngine/IntegrationEngine.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<ErrorReport>prompt</ErrorReport>
3131
<WarningLevel>4</WarningLevel>
3232
<Externalconsole>true</Externalconsole>
33-
<PlatformTarget>x86</PlatformTarget>
33+
<PlatformTarget>AnyCPU</PlatformTarget>
3434
</PropertyGroup>
3535
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
3636
<DebugSymbols>true</DebugSymbols>
@@ -147,6 +147,7 @@
147147
<Compile Include="Configuration\NLogAdapterConfiguration.cs" />
148148
<Compile Include="Configuration\MessageQueueConfiguration.cs" />
149149
<Compile Include="Configuration\WebApiConfiguration.cs" />
150+
<Compile Include="Scheduler\TriggerListener.cs" />
150151
<Compile Include="Properties\AssemblyInfo.cs" />
151152
<Compile Include="MessageQueue\IMessageQueueClient.cs" />
152153
<Compile Include="MessageQueue\RabbitMQClient.cs" />
@@ -204,7 +205,5 @@
204205
</ItemGroup>
205206
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
206207
<ItemGroup />
207-
<ItemGroup>
208-
<Folder Include="DataAnnotations\" />
209-
</ItemGroup>
208+
<ItemGroup />
210209
</Project>

IntegrationEngine/Scheduler/CronTrigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class CronTrigger : ICronTrigger, ICronTriggerReadOnly, IHasStateDescript
2424
[ElasticProperty(OptOut = true)]
2525
public string CronExpressionDescription { get { return ExpressionDescriptor.GetDescription(CronExpressionString); } }
2626
[ElasticProperty(OptOut = true)]
27-
public TimeZoneInfo TimeZoneInfo { get { return TimeZoneInfo.FindSystemTimeZoneById(TimeZoneId); } }
27+
public TimeZoneInfo TimeZoneInfo { get { return TimeZoneId.GetTimeZoneInfo(); } }
2828
[ElasticProperty(OptOut = true)]
2929
public string StateDescription { get { return StateId.GetStateDescription(); } }
3030
}

IntegrationEngine/Scheduler/EngineScheduler.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using IntegrationEngine.Model;
66
using Quartz;
77
using IntegrationEngine.MessageQueue;
8+
using Quartz.Impl.Matchers;
89

910
namespace IntegrationEngine.Scheduler
1011
{
@@ -15,13 +16,23 @@ public class EngineScheduler : IEngineScheduler
1516
public IMessageQueueClient MessageQueueClient { get; set; }
1617

1718
public EngineScheduler()
18-
{}
19+
{
20+
}
1921

2022
public void Start()
2123
{
24+
var triggerListener = new TriggerListener();
25+
var mgr = Scheduler.ListenerManager;
26+
mgr.AddTriggerListener(triggerListener, GroupMatcher<TriggerKey>.AnyGroup());
2227
Scheduler.Start();
2328
}
2429

30+
public void Shutdown()
31+
{
32+
// Scheduler.ListenerManager.RemoveTriggerListener();
33+
Scheduler.Shutdown();
34+
}
35+
2536
public Type GetRegisteredJobTypeByName(string jobTypeName)
2637
{
2738
var jobTypes = IntegrationJobTypes.Where(x => x.FullName == jobTypeName);
@@ -41,6 +52,7 @@ public IJobDetail JobDetailFactory(Type jobType)
4152
jobDetailsDataMap.Put("IntegrationJob", integrationJob);
4253
return JobBuilder.Create<IntegrationJobDispatcherJob>()
4354
.SetJobData(jobDetailsDataMap)
55+
.StoreDurably(true)
4456
.WithIdentity(jobType.Name, jobType.Namespace)
4557
.Build();
4658
}

IntegrationEngine/Scheduler/IEngineScheduler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ public interface IEngineScheduler
1212
void ScheduleJobWithSimpleTrigger(SimpleTrigger triggerDefinition);
1313
bool IsJobTypeRegistered(string jobTypeName);
1414
Type GetRegisteredJobTypeByName(string jobTypeName);
15+
void Shutdown();
1516
}
1617
}

0 commit comments

Comments
 (0)