Urgent & Important: Do Both

WhatsApp Image 2018-12-17 at 11.10.40 AM

You are doing an important thing and all of the sudden some other urgent situation appears. You must definitely address the urgent issue first. Then what about the important thing? Let’s look at the two situations below:

Situation 1: You were working on some important long-term strategy that requires you to define the right processes, people, technologies, tools, and products. While doing that you are getting urgent requests from your clients, internal teams and externals. You must address those requests first. However, to grow business in a robust manner you must not ignore the important initiatives. Do both.

Situation 2: You committed yourself for a 30 min daily workout routine. It is highly important for you to keep up with good health. You were highly motivated. You successfully accomplished the routine on day 1. On day 2, you got some urgent situation at the time of your routine, that caused an interruption. You had no choice but to address that urgent issue. You could not accomplish the workout routine. Sad. The same thing happened on day 3. And now, everyday something urgent comes up. Ultimately, you have made a habit to ignore the important thing. Not good. Do both.

We have no control over urgent situations. We have to deal with them. But what we have control over is ‘important things’. Maybe some adjustments are needed. But Ignoring important things must not be our choice. Do both.

Check out the interesting Time Management Matrix below. Above, I touched quadrants 1 & 2 only.

important-vs-urgent

Advertisements

IScheduler Resolve Issue with Quartz.Net & Unity

Today I was creating a job scheduler using Windows service, Quartz.Net and Unity. It is a killer combination and provides graceful application setup for job scheduler. Not to mention, it works like a charm. But, unfortunately I came across a painful issue while resolving Quartz’s IScheduler interface. For several hours, I looked all over the internet for the solution but I couldn’t find any solution. Hence, I am writing this post.

Just to give you a quick background of application environment, I was using following framework and packages in my service. I installed them from Nuget Packge Manager.

  1. .NET Framework 4.5.2
  2. Quartz.Net 2.3.3
  3. Quartz.Unity 1.4.2
  4. Unity 4.0.1

In order for dependency injection to work in the scheduler applications built with Quartz, you have to resolve IScheduler using Unity. You can not directly instantiate StdSchedulerFactory() and GetScheduler (see here for normal set up). I wouldn’t go into much details about what each line of code does but below is the code snippet one should write.

Container.AddNewExtension<QuartzUnityExtension>();

var scheduler = Container.Resolve<IScheduler>();

scheduler.Start();

At the line #2 program fails. Briefly, it says:

Resolution of the dependency failed, type = “Quartz.ISchedulerFactory”, name = “”(none)”.

The issue looks like the picture below:

Exception

 

Why this issue, what I did wrong and how to resolve this?

I looked through what AddNewExtension is doing. Tried to manually register Scheduler Factory. Tried many things. Then, I looked through each and every package description, their versions & dependencies on Nuget website. And then when I looked at different versions available for dependent assemblies. Finally, I found the culprit assemblies:

  1. Common.Logging
  2. Common.Logging.Core

I found that the version I had in references was 3.0.0 for both the assemblies. I updated these assemblies with the latest version (3.3.1). Bingo! the application worked.

So what happened? The latest package of Quartz.Net is compiled with old version (3.0.0) of Common.Logging and Common.Logging.Core. When I installed Quartz.Net the old version of these assemblies ended up in my references.

Unfortunately, the exception didn’t mention anything about Common.Logging. One can argue that using another DI framework like Castle Windsor or drop Quartz from solution could be easier. But you never know when all of the sudden you would encounter such unrelated problem.

Yet another day. Hope this post will help.