Update quartz quickstart
Write docs for quartz quickstart
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
<!ENTITY web-quickstart SYSTEM "web-quickstart.xml">
|
||||
<!ENTITY data-quickstart SYSTEM "data-quickstart.xml">
|
||||
<!ENTITY tx-quickstart SYSTEM "tx-quickstart.xml">
|
||||
<!ENTITY quartz-quickstart SYSTEM "quartz-quickstart.xml">
|
||||
<!ENTITY javadevelopers SYSTEM "javadevelopers.xml">
|
||||
<!ENTITY misc SYSTEM "misc.xml">
|
||||
<!ENTITY pooling-example SYSTEM "pooling-example.xml">
|
||||
@@ -362,6 +363,9 @@
|
||||
<listitem>
|
||||
<xref linkend="tx-quickstart" />
|
||||
</listitem>
|
||||
<listitem>
|
||||
<xref linkend="quartz-quickstart" />
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</partintro>
|
||||
&quickstarts;
|
||||
@@ -371,6 +375,7 @@
|
||||
&springair;
|
||||
&data-quickstart;
|
||||
&tx-quickstart;
|
||||
&quartz-quickstart;
|
||||
</part>
|
||||
<part id="index-javadevelopers">
|
||||
<title>Spring.NET for Java developers</title>
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
|
||||
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"
|
||||
@@ -19,10 +13,6 @@ Global
|
||||
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
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Spring.Scheduling.Quartz.Example
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A 'plain' object (no inheritance of any infrastructure base class) whose method will
|
||||
/// be invoked by Quartz.
|
||||
/// </summary>
|
||||
public class AdminService
|
||||
{
|
||||
private string userName;
|
||||
|
||||
public string UserName
|
||||
{
|
||||
set { userName = value; }
|
||||
}
|
||||
|
||||
public void DoAdminWork()
|
||||
{
|
||||
Console.WriteLine("{0}: DoAdminWork called, user name: {1}", DateTime.Now, userName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
|
||||
</configSections>
|
||||
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="showLogName" value="true" />
|
||||
<arg key="showDataTime" value="true" />
|
||||
<arg key="level" value="INFO" />
|
||||
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
|
||||
@@ -11,14 +11,15 @@ namespace Spring.Scheduling.Quartz.Example
|
||||
/// </summary>
|
||||
public class ExampleJob : QuartzJobObject
|
||||
{
|
||||
private int timeout;
|
||||
|
||||
private string userName;
|
||||
|
||||
/// <summary>
|
||||
/// Simple property that can be injected.
|
||||
/// </summary>
|
||||
public int Timeout
|
||||
public string UserName
|
||||
{
|
||||
set { timeout = value; }
|
||||
set { userName = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -27,15 +28,9 @@ namespace Spring.Scheduling.Quartz.Example
|
||||
/// <param name="context"></param>
|
||||
protected override void ExecuteInternal(JobExecutionContext context)
|
||||
{
|
||||
Console.WriteLine("{0}: ExecuteInternal called, timeout: {1}", DateTime.Now, timeout);
|
||||
Console.WriteLine("{0}: ExecuteInternal called, user name: {1}, next fire time {2}",
|
||||
DateTime.Now, userName, context.NextFireTimeUtc.Value.ToLocalTime());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Custom job execution method.
|
||||
/// </summary>
|
||||
public void DoIt()
|
||||
{
|
||||
Console.WriteLine("{0}: DoIt called, timeout: {1}", DateTime.Now, timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,15 @@ namespace Spring.Scheduling.Quartz.Example
|
||||
try
|
||||
{
|
||||
XmlApplicationContext ctx = new XmlApplicationContext("spring-objects.xml");
|
||||
Console.WriteLine("Spring configuration succeeded.");
|
||||
Console.WriteLine("Spring configuration succeeded, quartz jobs running.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Console.Out.WriteLine("--- Press <return> to quit ---");
|
||||
Console.ReadLine();
|
||||
}
|
||||
Console.Out.WriteLine("--- Press <return> to quit ---");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Spring.Scheduling.Quartz, Version=1.1.2.20220, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\bin\net\2.0\debug\Spring.Scheduling.Quartz.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
@@ -92,6 +96,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="App.config" />
|
||||
<Content Include="spring-objects.xml" />
|
||||
<Compile Include="AdminService.cs" />
|
||||
<Compile Include="ExampleJob.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -99,12 +104,6 @@
|
||||
<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>
|
||||
|
||||
@@ -7,26 +7,25 @@
|
||||
<!-- We can inject values throgh JobDataMap -->
|
||||
<property name="JobDataAsMap">
|
||||
<dictionary>
|
||||
<entry key="timeout" value="5" />
|
||||
<entry key="UserName" value="Alexandre" />
|
||||
</dictionary>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id="invokableJob" type="Spring.Scheduling.Quartz.Example.ExampleJob, Spring.Scheduling.Quartz.Example">
|
||||
<object id="adminService" type="Spring.Scheduling.Quartz.Example.AdminService, Spring.Scheduling.Quartz.Example">
|
||||
<!-- we inject straight to target object -->
|
||||
<property name="timeout" value="10" />
|
||||
<property name="UserName" value="Gabriel" />
|
||||
</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" />
|
||||
<property name="TargetObject" ref="adminService" />
|
||||
<property name="TargetMethod" value="DoAdminWork" />
|
||||
</object>
|
||||
|
||||
|
||||
<object id="jobDetailNonConcurrent" type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz">
|
||||
<property name="targetObject" ref="invokableJob" />
|
||||
<property name="targetMethod" value="DoIt" />
|
||||
<property name="targetObject" ref="adminService" />
|
||||
<property name="targetMethod" value="DoAdminWork" />
|
||||
<!-- Automatic IStatefulJob wrapping -->
|
||||
<property name="concurrent" value="false" />
|
||||
</object>
|
||||
@@ -35,9 +34,9 @@
|
||||
<!-- see the example of method invoking job above -->
|
||||
<property name="jobDetail" ref="jobDetail" />
|
||||
<!-- 5 seconds -->
|
||||
<property name="startDelay" value="5000" />
|
||||
<property name="startDelay" value="5s" />
|
||||
<!-- repeat every 5 seconds -->
|
||||
<property name="repeatInterval" value="5000" />
|
||||
<property name="repeatInterval" value="5s" />
|
||||
</object>
|
||||
|
||||
|
||||
@@ -54,7 +53,6 @@
|
||||
<ref object="simpleTrigger" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="autoStartup" value="true" />
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
Reference in New Issue
Block a user