First version of Quartz.NET integration example

This commit is contained in:
lahma
2008-06-18 10:57:48 +00:00
parent 15c508a50a
commit fa1a9a235b
9 changed files with 446 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz.2003", "..\..\..\src\Spring\Spring.Scheduling.Quartz\Spring.Scheduling.Quartz.2003.csproj", "{0C0D8C65-90DE-4914-9940-4C684C54971B}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz.Example.2003", "src\Spring.Scheduling.Quartz.Example.2003.csproj", "{0C0D8C65-90DE-4914-9940-4C684C54971B}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Debug.ActiveCfg = Debug|.NET
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Debug.Build.0 = Debug|.NET
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Release.ActiveCfg = Release|.NET
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Release.Build.0 = Release|.NET
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Debug.ActiveCfg = Debug|.NET
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Debug.Build.0 = Debug|.NET
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Release.ActiveCfg = Release|.NET
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz.2005", "..\..\..\src\Spring\Spring.Scheduling.Quartz\Spring.Scheduling.Quartz.2005.csproj", "{E823D54C-CE82-4868-929F-5F95A999F61E}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz.Example.2005", "src\Spring.Scheduling.Quartz.Example.2005.csproj", "{0C0D8C65-90DE-4914-9940-4C684C54971B}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E823D54C-CE82-4868-929F-5F95A999F61E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E823D54C-CE82-4868-929F-5F95A999F61E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E823D54C-CE82-4868-929F-5F95A999F61E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E823D54C-CE82-4868-929F-5F95A999F61E}.Release|Any CPU.Build.0 = Release|Any CPU
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C0D8C65-90DE-4914-9940-4C684C54971B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<project name="Spring.Scheduling.Quartz.Example" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<target name="build">
</target>
</project>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="AF08829B84F0328E" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,41 @@
using System;
using Quartz;
using Spring.Scheduling.Quartz;
namespace Spring.Scheduling.Quartz.Example
{
/// <summary>
/// Example job.
/// </summary>
public class ExampleJob : QuartzJobObject
{
private int timeout;
/// <summary>
/// Simple property that can be injected.
/// </summary>
public int Timeout
{
set { timeout = value; }
}
/// <summary>
/// Execute.
/// </summary>
/// <param name="context"></param>
protected override void ExecuteInternal(JobExecutionContext context)
{
Console.WriteLine("{0}: ExecuteInternal called, timeout: {1}", DateTime.Now, timeout);
}
/// <summary>
/// Custom job execution method.
/// </summary>
public void DoIt()
{
Console.WriteLine("{0}: DoIt called, timeout: {1}", DateTime.Now, timeout);
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using Spring.Context.Support;
namespace Spring.Scheduling.Quartz.Example
{
class Program
{
static void Main()
{
try
{
XmlApplicationContext ctx = new XmlApplicationContext("spring-objects.xml");
Console.WriteLine("Spring configuration succeeded.");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
Console.ReadLine();
}
}
}

View File

@@ -0,0 +1,123 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.6030"
SchemaVersion = "2.0"
ProjectGuid = "{0C0D8C65-90DE-4914-9940-4C684C54971B}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Spring.Scheduling.Quartz.Example"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
PreBuildEvent = ""
PostBuildEvent = "cmd /c copy $(ProjectDir)spring-objects.xml $(OutDir)&#xd;&#xa;cmd /c copy $(ProjectDir)App.config $(OutDir)Spring.Scheduling.Quartz.Example.exe.config"
RootNamespace = "Spring"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = "Spring.Scheduling.Quartz.Example.xml"
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "..\..\..\..\build\VS.NET.2003\Spring.Scheduling.Quartz.Example\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "..\..\..\..\build\VS.NET.2003\Spring.Scheduling.Quartz.Example\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "Spring.Core"
AssemblyName = "Spring.Core"
HintPath = "..\..\..\..\lib\net\1.1\Spring.Core.dll"
/>
<Reference
Name = "Common.Logging"
AssemblyName = "Common.Logging"
HintPath = "..\..\..\..\lib\net\1.1\Common.Logging.dll"
/>
<Reference
Name = "Quartz"
AssemblyName = "Quartz"
HintPath = "..\..\..\..\lib\net\1.1\Quartz.dll"
/>
<Reference
Name = "Nullables"
AssemblyName = "Nullables"
HintPath = "..\..\..\..\lib\net\1.1\Nullables.dll"
/>
<Reference
Name = "Spring.Scheduling.Quartz.2003"
Project = "{0C0D8C65-90DE-4914-9940-4C684C54971B}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.config"
BuildAction = "Content"
/>
<File
RelPath = "ExampleJob.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Program.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "spring-objects.xml"
BuildAction = "Content"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,115 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0C0D8C65-90DE-4914-9940-4C684C54971B}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>Spring.Scheduling.Quartz.Example</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Exe</OutputType>
<RootNamespace>Spring</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\..\..\build\VS.NET.2005\Spring.Scheduling.Quartz.Example\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>Spring.Scheduling.Quartz.Example.xml</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\..\..\build\VS.NET.2005\Spring.Scheduling.Quartz.Example\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging">
<Name>Common.Logging</Name>
<HintPath>..\..\..\..\lib\net\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Quartz">
<Name>Quartz</Name>
<HintPath>..\..\..\..\lib\net\2.0\Quartz.dll</HintPath>
</Reference>
<Reference Include="Spring.Core">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="App.config" />
<Content Include="spring-objects.xml" />
<Compile Include="ExampleJob.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Program.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Spring\Spring.Scheduling.Quartz\Spring.Scheduling.Quartz.2005.csproj">
<Project>{E823D54C-CE82-4868-929F-5F95A999F61E}</Project>
<Name>Spring.Scheduling.Quartz.2005</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>cmd /c copy $(ProjectDir)spring-objects.xml $(OutDir)
cmd /c copy $(ProjectDir)App.config $(OutDir)Spring.Scheduling.Quartz.Example.exe.config</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<object name="exampleJob" type="Spring.Scheduling.Quartz.JobDetailObject, Spring.Scheduling.Quartz">
<property name="JobType" value="Spring.Scheduling.Quartz.Example.ExampleJob, Spring.Scheduling.Quartz.Example" />
<!-- We can inject values throgh JobDataMap -->
<property name="JobDataAsMap">
<dictionary>
<entry key="timeout" value="5" />
</dictionary>
</property>
</object>
<object id="invokableJob" type="Spring.Scheduling.Quartz.Example.ExampleJob, Spring.Scheduling.Quartz.Example">
<!-- we inject straight to target object -->
<property name="timeout" value="10" />
</object>
<object id="jobDetail" type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz">
<!-- We don't actually need to implement IJob as we can use delegation -->
<property name="TargetObject" ref="invokableJob" />
<property name="TargetMethod" value="DoIt" />
</object>
<object id="jobDetailNonConcurrent" type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz">
<property name="targetObject" ref="invokableJob" />
<property name="targetMethod" value="DoIt" />
<!-- Automatic IStatefulJob wrapping -->
<property name="concurrent" value="false" />
</object>
<object id="simpleTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz">
<!-- see the example of method invoking job above -->
<property name="jobDetail" ref="jobDetail" />
<!-- 5 seconds -->
<property name="startDelay" value="5000" />
<!-- repeat every 5 seconds -->
<property name="repeatInterval" value="5000" />
</object>
<object id="cronTrigger" type="Spring.Scheduling.Quartz.CronTriggerObject, Spring.Scheduling.Quartz">
<property name="jobDetail" ref="exampleJob" />
<!-- run every 20 second of minute -->
<property name="cronExpressionString" value="0/20 * * * * ?" />
</object>
<object type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz">
<property name="triggers">
<list>
<ref object="cronTrigger" />
<ref object="simpleTrigger" />
</list>
</property>
<property name="autoStartup" value="true" />
</object>
</objects>