Is it possible to run a quartz.net job on the UI thread? - watin

I'm using Watin for browser testing, which has to run on the UI thread.
I want to schedule a job using Quartz.NET but can't work out a way to run it on the UI thread (using a WPF application)
Any ideas?

I'm not sure how you're running watin but you could:
1. Start the scheduler from inside wherever you are running watin and then connect to it via remoting from the UI thread to schedule the job.
2. Start the scheduler as a windows service and then connect to it via remoting from the UI thread to schedule the job.
3. Write a simple console app that starts the scheduler and exposes it via remoting. Then connect to it from the UI thread to schedule your job.
Take a look at this answer I wrote up earlier with some code samples:
https://stackoverflow.com/questions/1356789/quartz-net-with-asp-net/. Hopefully it will be useful.

I am not familiar with Quartz.NET but the Java version gives ThreadPool interface which can be implemented to make custom threadpool implementations. I don't understand why you would want to run it in a UI thread which is already dedicated to another task.

Related

Is there a method in the Windows API for firing off code when a specific application is run?

I want to monitor the status of an application that runs in Windows. What is the best method (Win32 or newer API) that I can use to watch for when a specific application is run and execute another app of my choice thereafter?
You can use the WMI - see this SO question and answer How to monitor process/program execution in windows?.
Specifically the Win32_ProcessStartTrace class
There are some other options in that thread also.

How to start with Quartz scheduler in MVC3

I need to work with Quartz scheduler in my MVC3 project. The requirements are schedule the task based on my database values. Say like, Sending an email to the specific person when the time period reaches. Is there any good article or tutorial on how to start with Quartz scheduler in MVC3.
Thanks
Have you looked at the tutorial?
http://quartznet.sourceforge.net/tutorial/index.html
Make sure that you don't run Quartz inside IIS worker process - it's better to have a windows service as it won't be recycled at unexpected times like worker process.
I think the following may be of help to you
Using Quartz.NET, Spring.NET and NHibernate to run Scheduled Tasks in ASP.NET
Cron Maker
To fully get to understand the tutorial, I would recommend you download the source code and go through the test cases and after that the tutorials will make sense.

Simulating background task on AppHarbor

I'm using System.Runtime.Caching.MemoryCache to simulate a repeated task on a running .NET MVC application deployed on AppHarbor.
Entries in the cache are added using a CacheItemPolicy which contains an AbsoluteExpiration offset and a RemovedCallback that calls a method and retriggers the adding of the item in the cache (as described here)
MemoryCache is populated first time in Application_Start. It works fine locally, but doesn't seem to work once deployed on AppHarbor (tried also with HttpRuntime.Cache, same result).
My application is running under a CANOE (free) account on AppHarbor that only has one worker. Does this mean that I won't be able to simulate the background task until I upgrade to some paid plan?
Thanks!
Your application has to have visitors every once in a while for this to work. Other than StillAlive, Pingdom is also a good bet for generating requests to your app. You should also take a look at MomentApp. We expect to have background tasks ready shortly.
I don't think upgrading will help, they are working on adding background jobs to AppHarbor but to my knowledge they available yet.
What about using a service like https://stillalive.com/ to periodically hit a page on your site that then spins up a new thread and starts running your background task? Its available as a free add-on.
I was thinking of doing something like this while waiting for the background task functionality to be available.

Alternative GUI for Open Source Job Scheduler?

Are there some alternative open source GUI developed to improve the management of jobs and job chains in Open Source Job Scheduler?
In 3+ months I didn't receive any answer, so I guess is time to answer myself "No. Seems like there aren't any alternative open source GUI developed for Job Scheduler".
I know this is tooooo old to answer. But yes, a graphical XML editor for job configuration and a web GUI for job management are available. JobScheduler can be controlled by the built-in web server's graphical user interface. JobScheduler uses an XML file for the configuration of executable files or shell scripts and to set the timing and frequency of job starts.
JobScheduler has two web based GUIs:
• Operations GUI
To operate the operations GUI the no web server is needed, because JobScheduler has its own built-in web server.
• Managed Jobs GUI
To operate the Managed Jobs interface at least an Apache or IIS is required. In addition, the Managed Jobs web interface needs PHP.
Read more here
Update 2018
Chronos is a Job scheduler. It run on top of Apache Mesos, so it's a best to install if you are not running a data center, but it gets the job done. Comes with a GUI as well. Stores job state in Zookeeper.

How does a windows service set off an application at a standard interval?

A consultant setup a windows service to run a application. The application is supposed to run every 15 minutes. The application is not running at all and the service appears to be running fine.
I am not familiar with how an application will run at a standard interval when running as a service.
The service uses the SRVANY.EXE tool.
Any 'consultant' that sets up a service to run using SRVANY.EXE should be fired. SRVANY is an unfortunate hack that should have been retired a decade ago; it should never be used in a production environment.
If the only purpose for the service is to run the app on a schedule then it shouldn't exist at all. Run the app as a Scheduled Task. If it has other functionality then rewrite it as a real service. If it is reasonably well written it should be a fairly easy conversion.
There are many potential issues with your application.
SRVANY.EXE turns any application into a Windows Service. If that application ever asks for user input, it will hang. You will want to confirm that the application running as a service does nothing more than start the other application.
You should also be able to run the "starter" application manually, outside the Windows Service. If it still doesn't work as it should you know it's not related to being run as a service.
To add to the other answers: see KB137890 on what SRVANY.EXE actually does and how to find out what application it is running.
It seems to me that you would be better off (if you can) setting up a scheduled task that runs every the application every 15 minutes if you can.
I'm not sure if this is correct, but I believe one way of a serivce running an application is merely to have a thread within OnStart and set it to run the application on an invertal of 15 minutes.

Resources