views:

124

answers:

1

Hi,

What's the best way for me to call a WCF Service from within a Quartz .Net job?

Is the easiest way to write a separate exe that spins up a WCF proxy and have that exe called from within the job? This seems like it would work but is a bit convoluted. It'd be nicer if I could somehow have the Job have the proxy injected in someway.

Thanks, Matt

A: 

A separate exe sounds a bit like over complicating things. A job should be quite able to call the service by itself also unless there's some dependency graph that needs to be accounted for. Are you using some IoC framework?

If you look things from unit testing perspective wouldn't it be just sufficient to have satisfactory interface for the proxy and and then allow setting of different version of it (mock) to the job via setter property?

Marko Lahma
I'm very new to Quartz, so the question was based in the context of running Quartz in its Windows Service and loading jobs from the xml config file. I was imagining having a job that could read a db table and make calls to a WCF service based on this information. So in this context I don't think I can use an my IoC container to setup my WCF proxy. I'm now considering hosting Quartz in its own WCF service which would mean I could have a custom JobFactory which made use of IoC. If there was a way of doing it inside a custom job I'd still be interested to hear about it.
mattcole
You could investigate Spring.NET and its Quartz.NET integration: http://www.springframework.net/doc-latest/reference/html/scheduling.html
Marko Lahma