Skip to content

Commit

Permalink
Upgrading to Quartz 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Aug 13, 2012
1 parent 49f8514 commit a833409
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 136 deletions.
5 changes: 1 addition & 4 deletions QuartzNServiceBusSample/App.config
Expand Up @@ -13,12 +13,9 @@
</UnicastBusConfig>
<quartz>
<add key="quartz.scheduler.instanceName" value="DefaultQuartzScheduler" />
<add key="quartz.scheduler.rmi.export" value="false" />
<add key="quartz.scheduler.rmi.proxy" value="false" />
<add key="quartz.scheduler.wrapJobExecutionInUserTransaction" value="true" />
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="1" />
<add key="quartz.threadPool.threadPriority" value="2" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz" />
Expand Down
9 changes: 5 additions & 4 deletions QuartzNServiceBusSample/DoSomethingSchedule.cs
@@ -1,27 +1,28 @@
using System;
using NServiceBus;
using NServiceBus.Installation;
using Quartz;
using QuartzNServiceBusSample.Messages;

namespace QuartzNServiceBusSample
{
public class DoSomethingSchedule : ScheduleSetup<DoSomethingJob>
public class DoSomethingSchedule : ScheduleSetup<DoSomethingJob>
{
public DoSomethingSchedule(IScheduler scheduler) : base(scheduler)
{
}

protected override Trigger CreateTrigger()
protected override TriggerBuilder CreateTrigger()
{
return TriggerUtils.MakeSecondlyTrigger(TriggerName, 5, Int32.MaxValue);
return TriggerBuilder.Create().WithCalendarIntervalSchedule(b => b.WithIntervalInSeconds(5));
}
}

public class DoSomethingJob : IJob
{
public IBus Bus { get; set; }

public void Execute(JobExecutionContext context)
public void Execute(IJobExecutionContext context)
{
Bus.Send(new DoSomething());
}
Expand Down
2 changes: 2 additions & 0 deletions QuartzNServiceBusSample/EndpointConfig.cs
Expand Up @@ -32,6 +32,8 @@ public void Init()
configurer.ConfigureComponent<IScheduler>(() =>
{
var factoryx = new StdSchedulerFactory();
factoryx.Initialize();
var scheduler = factoryx.GetScheduler();
scheduler.JobFactory = Configure.Instance.Builder.Build<IJobFactory>();
return scheduler;
Expand Down
2 changes: 1 addition & 1 deletion QuartzNServiceBusSample/QuartzJobFactory.cs
Expand Up @@ -14,7 +14,7 @@ public QuartzJobFactory(IBuilder container)
_container = container;
}

public IJob NewJob(TriggerFiredBundle bundle)
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
return _container.Build(bundle.JobDetail.JobType) as IJob;
}
Expand Down
15 changes: 10 additions & 5 deletions QuartzNServiceBusSample/QuartzNServiceBusSample.Scheduler.csproj
Expand Up @@ -31,8 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=1.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<HintPath>..\packages\Common.Logging.1.2.0\lib\1.0\Common.Logging.dll</HintPath>
<Reference Include="C5">
<HintPath>..\packages\Quartz.2.0.1\lib\net40\C5.dll</HintPath>
</Reference>
<Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
Expand All @@ -47,8 +51,9 @@
<ExecutableExtension>.exe</ExecutableExtension>
<HintPath>..\packages\NServiceBus.Host.3.2.6\lib\net40\NServiceBus.Host.exe</HintPath>
</Reference>
<Reference Include="Quartz, Version=1.0.3.3, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.1.0.3\lib\3.5\Quartz.dll</HintPath>
<Reference Include="Quartz, Version=2.0.1.100, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Quartz.2.0.1\lib\net40\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand All @@ -74,7 +79,7 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="QuartzTables.sql" />
<None Include="QuartzTables.sql" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QuartzNServiceBusSample.Messages\QuartzNServiceBusSample.Messages.csproj">
Expand Down

0 comments on commit a833409

Please sign in to comment.