Login

Username

Password





Register   Reset password

Get Cuyahoga at SourceForge.net. Fast, secure and Free Open Source software downloads

Forum

Welcome Guest Search | Active Topics | Members

How to integrate quartz.net to cuyahoga? Options
noah25
Posted: Tuesday, February 12, 2008 9:59:38 PM
Rank: Newbie
Groups: Member

Joined: 1/29/2008
Posts: 7
Points: 21
Has anyone expierement to use quartz.net or castle scheduler in cuyahoga?

-Noah
Efie
Posted: Wednesday, February 13, 2008 12:33:37 AM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
I've some experience with Quartz.Net, but I didn't use it together with Cuyahoga. I've used it with a home-made CMS. I think you have some different ways to integrate it in your application and the implementation depends on what you want to do. Maybe you can be somewhat more specific about how you want to integrate Quartz.net (or castle scheduler)
noah25
Posted: Wednesday, February 13, 2008 2:59:48 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2008
Posts: 7
Points: 21
Efie wrote:
I've some experience with Quartz.Net, but I didn't use it together with Cuyahoga. I've used it with a home-made CMS. I think you have some different ways to integrate it in your application and the implementation depends on what you want to do. Maybe you can be somewhat more specific about how you want to integrate Quartz.net (or castle scheduler)


I want to implement some scheduled task, like email and mobile appliction or others.

I have tried to integrete quartz.net stdscheduledfactory as a facility, and code a startable component. these job is very simple. For more flexibilty and simplicity , I want to USE quartz.properites as config file, use ramjobstore, and configure all job to a xml file, However I dont understand mechanism of searching properities in quartz.net, I Dont know how to locate and handle quartz.properties file.

Any Help?
Noah

Efie
Posted: Wednesday, February 13, 2008 3:37:06 AM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
Do you want to create a job that does something on a given time? When you want to do that, I think you have to built a Windows Service where you can store the jobs, otherwise you can't schedule anything on a given time/date or whatever. I've travelled the way of building a Windows service and add job from a web-interface.

In my case it was more like a R&D project, so I've didn't use the quarz.properties file, cause I couldn't get clear how it worked.
noah25
Posted: Wednesday, February 13, 2008 4:28:01 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2008
Posts: 7
Points: 21
Thanks, I will stick to it.




Efie
Posted: Wednesday, February 13, 2008 5:35:15 AM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
BTW, a Windows service isn't suitable for every environment, think about shared hosting or something like that. Although I liked the Quartz.net functionality, I didn't like the Java-style of the API, but that can be just a matter of taste happy.

Also, I didn't used the RAM-jobstore, but the SQLServer jobstore.
noah25
Posted: Friday, February 15, 2008 12:45:39 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2008
Posts: 7
Points: 21
Elie

I have integrated quartz.net to cuyahoga successfully.
Now, have following feature:
1.dont modify cuyahoga core, only add some config properties in web.config
add facility to config/facility.config and add component to config/service.config
2.ramstore or adojobstore can be configured in web.config.
3.job detail is put in quartz_job.xml or database
4.while application start, job scheduler run automaticly
5. developer only do new job implementation and configure it to quartz_job.xml

more to do list
1. web interface like window job scheduler service
2. jobstore for castle hibernate implementation, which have same Data access mechanism as cuyahoga.

According to Marko who is pm of quartz.net, quart.net will be improved for web application. now he provide a hack to resolve location of job.xml (only a line code in jobinitializeplugin.cs).

I can't post detail to forum, maybe it is to long.

-Noah
Efie
Posted: Friday, February 15, 2008 3:22:09 AM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
Sounds really great, that was just the stuff that I was working on in my other project, only at that time we didn't use any castle stuff, so we build a windows-service. But adding it to the application is so much better than a windows service. Later on the scheduling-stuff was pulled out of the project and I doubt whether or not it ever will be used again.

What are your experiences with the api?

Maybe it's a great feature to have the scheduler as a module in Cuyahoga. With the new moduleloader in version 1.5.1 all modules will be loaded when the application starts, so the scheduler can also be loaded. The really nice part of this is that you can built modules which depend on other ones.

When you provide something like a Cuyahoga.Module.Scheduler.IJob interface, every other module can implement this interface and with a nice admin-interface you can schedule all kinds of jobs from different modules.

Is there any chance that your code will be added to the contrib-project and become public, cause this sounds really really cool!

noah25
Posted: Friday, February 15, 2008 7:56:21 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2008
Posts: 7
Points: 21
Maybe sheduler should be a system level funtionality but module level, only job management should implement as a cuyahoga module or backend ui like category module

It is enough to Implement a quartz.net ijob interface in cuyahoga.moudule, however if Job in module need operate cuyahoga db, it has to use IOC to get hibernate sessionfactory like remote module, this is a trouble.

At present, I only use Example quartz.net provided , no more experiences.

following is quartzstartable.cs which is all source code, then other job is to configure properties in related file. configuration will be provided in next a post

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;

using Castle.Core;
using Quartz.Impl;
using Quartz;
using Quartz.Xml;
using log4net;
using System.Threading;

namespace Cuyahoga.Core.Extension.Quartz
{
[Transient]
public class QuartzStartable:IStartable
{
private ISchedulerFactory _schedFactory;

private static ILog log = LogManager.GetLogger(typeof(QuartzStartable));

public QuartzStartable(ISchedulerFactory schedFactory)
{
_schedFactory = schedFactory;

}

public void Start()
{
log.Info("Starting Sheduler service"wink;
IScheduler sched = _schedFactory.GetScheduler();

sched.Start();
try
{
// wait one minutes to show jobs, which
Thread.Sleep(1 * 1000);

}
catch (ThreadInterruptedException ex)
{
log.Error("Cannot start scheduler.", ex);
}


}
public void Stop()
{
log.Info("Stopping Scheduler service"wink;
try
{
IScheduler scheduler = _schedFactory.GetScheduler();
scheduler.Shutdown(true);
}
catch (SchedulerException ex)
{
log.Error("Cannot shutdown scheduler.", ex);
}
}
}
}
noah25
Posted: Friday, February 15, 2008 8:13:43 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2008
Posts: 7
Points: 21
Hack Quartz.net
Change fName =Path.Combine....." to following code in src/quartz/plugin/xml/jobinitialztionplugin.c#, for location of job.xml

fName = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,fName);

then rebuild quartz, get quartz.dll

web.config


&gt section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt
sectionGroup name="common"&gt
&gt section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" / &gt
&gt/sectionGroup&gt

&gt common&gt
&gt logging&gt
&gt factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging"&gt&gt!-- this need be adjust --&gt
&gt arg key="showLogName" value="true" /&gt
&gt arg key="showDataTime" value="true" /&gt
&gt arg key="level" value="DEBUG" /&gt
&gt arg key="dateTimeFormat" value="HH:mmconfuseds:fff" /&gt
&gt/factoryAdapter&gt
&gt/logging&gt
&gt/common&gt

&gt quartz&gt
&gt add key="quartz.scheduler.instanceName" value="CuyahogaDefaultQuartzScheduler" /&gt

&gt add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" /&gt
&gt add key="quartz.threadPool.threadCount" value="10" /&gt
&gt add key="quartz.threadPool.threadPriority" value="2" /&gt

&gt add key="quartz.jobStore.misfireThreshold" value="60000" /&gt
&gt add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz" /&gt
&gtadd key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.JobInitializationPlugin, Quartz" /&gt
&gtadd key="quartz.plugin.xml.fileNames" value="~/Config/quartz_job.xml" /&gt

&gt/quartz&gt

facility.config

&gt!-- quartz --&gt
&gt facility id="StartableFacility" type="Castle.Facilities.Startable.StartableFacility, Castle.MicroKernel" /&gt

sevices.config

&gt!-- Quartz Component --&gt
&gt component id="Scheduler"
service="Quartz.ISchedulerFactory, Quartz"
type="Quartz.Impl.StdSchedulerFactory, Quartz" /&gt

&gtcomponent
id="QuartzStartable"
type="Cuyahoga.Core.Extension.Quartz.QuartzStartable, Cuyahoga.Core.Extension" /&gt

Copy a quartz_job.xml to config dir.

It is all jobs
Efie
Posted: Friday, February 15, 2008 10:44:56 AM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
I'll take a look at your post and the code next week (or maybe this weekend), and give you an answer then.
Efie
Posted: Monday, February 18, 2008 3:29:31 AM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
It would be a nice feature of the core, but with the new moduleloader stuff, I think implementing it as a module, doesn't require upgrades for Cuyahoga and it will work exactly the same way, you can provide the same functionalities. Don't know how others (Martijn happy ) think about this?

I think you should create a Cuyahoga.Sceduler.IJob (or ITask, whatever you like best) and implement that one. Otherwise you're forced to have references to Quartz.net in every module where you want to schedule jobs and you'll need a Quartz.Net context to run the task in and that's all stuff where you don't want to deal with. When Quartz.net doesn't fit the requirements later on and you want to integrate the Castle scheduler (for example), you have to go through every module where you added scheduler-functionality, in my opinion there should be a Cuyahoga-scheduler interface where every module can 'talk' to..
webolize
Posted: Monday, February 18, 2008 1:02:50 PM
Rank: Advanced Member
Groups: Member

Joined: 7/3/2007
Posts: 44
Points: 132
I saw this post on a smart pinger, which helps keep the app in memory and thought it might
be useful for the Quarz scheduler.
http://www.smartertools.com/forums/p/14404/33844.aspx#33844

Eli
Efie
Posted: Tuesday, February 19, 2008 6:22:56 AM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
I'm currently working with the Quartz.net scheduler (starting it in the application_start event brought me to an idea), because we had a process that should run in the background and we decided to pick it up with the scheduler. But I'm wondering why you want to create your own jobstore with nHibernate dataaccess etc.? I think the SQLJobstore from Quartz is working fine, and I can't figure out why you should use your own DataAccess mechanism, you don't have anything to do with it when you're creating a job, just add it to the jobstore, I don't care that it does his dataaccess with storedprocs. But maybe you have some good and valid reasons to build it?

A nice admin-interface should be nice though.
noah25
Posted: Tuesday, February 19, 2008 8:30:39 AM
Rank: Newbie
Groups: Member

Joined: 1/29/2008
Posts: 7
Points: 21
I only don't like to have two way of data access in a application, which always give me a unconfortable feeling, no other idea. happy

I don't know why you use quartz.net scheduler in application start event? I prefer to start scheduler in a automatical model.
Efie
Posted: Tuesday, February 19, 2008 3:00:26 PM
Rank: Advanced Member
Groups: Member

Joined: 12/28/2006
Posts: 127
Points: 381
Location: Almen, Netherlands
noah25 wrote:
I only don't like to have two way of data access in a application, which always give me a unconfortable feeling, no other idea. happy


happy I get the feeling, but you're making it hard for yourself. E.g. Yet Another Forum uses it's own dataaccess layer in Cuyahoga. I think it doesn't matter when I don't have to deal with it.

When you use Castle with the facilities etc. it is nice to add it as a facility, but in my daytime project we only use some of the Windsor stuff and in a somewhat other way as in Cuyahoga.

How would you start you're scheduler when you don't have it as a facility, is there any other way to start it besides using it as a Windows Service, which gives a lot of issues with shared hosting, different versions of assemblies and last but not least, remoting, which is not really my cup of tea happy
gedw99
Posted: Saturday, March 22, 2008 5:30:35 AM
Rank: Advanced Member
Groups: Member

Joined: 4/3/2006
Posts: 243
Points: 450
Location: the moon :)
I agree with effie.

this is why facilities are so awesome.
A micro kernel as part of your web app gives you control over the lifetimes of running instances

G

if your doing it hard your probably doing it the wrong way....
kmoo01
Posted: Sunday, June 20, 2010 12:18:31 PM
Rank: Newbie
Groups: Member

Joined: 4/8/2010
Posts: 7
Points: 21
Id be very interested if anyone has been able to integrate castle scheduler successfully (either into the core or as a module). I have been struggling all weekend to get it running in the 2 alpha but not really got very far.

If I try and implement any type of IJob that attempts to resolve a service to execute business logic I get issues with the castle PerWebRequestLifestyleModule not being in a asp.net application (as the thread doesn't have a httpcontext).

As I said, i would been very interested if anyone has any views or suggestions round this?

thanks in advance guys!!
kmoo01
kmoo01
Posted: Tuesday, August 3, 2010 4:28:29 AM
Rank: Newbie
Groups: Member

Joined: 4/8/2010
Posts: 7
Points: 21
Just a little update, I implemented a version of castle scheduler - but the only way I could get tasks to work was getting the scheduler to execute .ashx pages - (without setting the IsWeb to false in nhibernate)

Again, I would be very interested if anyone has managed to implement something like this nicely....
mausch
Posted: Monday, October 25, 2010 2:54:24 PM
Rank: Newbie
Groups: Member

Joined: 10/25/2010
Posts: 1
Points: 3
To integrate Quartz.NET to Windsor, take a look at http://github.com/castleprojectcontrib/QuartzNetIntegration . If you need more features from that integration, please contribute to that project so we can concentrate our efforts.
I'll gladly answer any questions about it on the Castle mailing list or Stackoverflow.

Cheers
Mauricio
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Yet Another Forum.net version 1.9.0 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.