Not sure where excatly - but I read somewhere that with later Commerce releases EPiServer is moving jobs from Quartz to EPiServer scheduled jobs infrastructure. IMHO Quartz jobs are much more robust approach, does not interference with web app jobs, runs in separate process, probably on different server (keep in mind licenses stuff).
We are using Quartz service with few jobs in it side by side with CMS installation - you just have to "re-create" Commerce context (config files, factories initializations, stuff like that) before proceeding with your job logic.
Yeah it is a shame they have moved away from using the Quartz service. I favour the approach for long running resource intensive jobs. I've been trying to create a windows service to run the product import. Have added all the necessary configs etc. But keep getting an "Entry point not found" error when the last line below is executed. The error occurs in the ConfigureContainer method.
var container = new StructureMap.Container();
var locator = new EPiServer.ServiceLocation.StructureMapServiceLocator(container);
var context = new EPiServer.ServiceLocation.ServiceConfigurationContext(HostType.WebApplication, container);
new Mediachase.Commerce.Initialization.CommerceInitialization().ConfigureContainer(context);
Not too sure what is going on there. Seems to work in a console application though. I may need to keep progressing with a console application instead of a windows service unfortunately. I'm just not sure of the factory initialisations required when working outside of the context of the commerce and cms web applications
Is this whole initialization code? Things you could try:
ServiceLocator.SetLocator(new StructureMapServiceLocator(container));
and
var context = new EPiServer.ServiceLocation.ServiceConfigurationContext(HostType.Service, container);
I've decided to go with a console application but starting to struggle with that as well. When combining your suggestions above my code in the Main() method looks like the following:
var container = new StructureMap.Container();
var context = new EPiServer.ServiceLocation.ServiceConfigurationContext(HostType.Service, container);
new Mediachase.Commerce.Initialization.CommerceInitialization().ConfigureContainer(context);
EPiServer.ServiceLocation.ServiceLocator.SetLocator(new StructureMapServiceLocator(container));
if (SqlContext.Current == null)
{
SqlContext.Current = new SqlContext(ConfigurationManager.ConnectionStrings["EcfSqlConnection"].ConnectionString);
}
if (DataContext.Current == null)
{
DataContext.Current = new DataContext(ConfigurationManager.ConnectionStrings["EcfSqlConnection"].ConnectionString);
}
CatalogEntryDto entryDto = CatalogContext.Current.GetCatalogEntryDto("35971", new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull));
When I execute the final line above to get the entry object I get an exception stating the following:
{"Activation error occurred while trying to get instance of type IPriceService, key \"\""}
{"StructureMap Exception Code: 202\nNo Default Instance defined for PluginFamily Mediachase.Commerce.Pricing.IPriceService, Mediachase.Commerce, Version=7.0.243.0, Culture=neutral, PublicKeyToken=6e58b501b34abce3"}
Starting to run out of ideas to get past this exception.
Any help would be greatly appreciated.
Thanks,
Damo
After initialization code line
EPiServer.ServiceLocation.ServiceLocator.SetLocator(new StructureMapServiceLocator(container));
can you check what's inside your IoC container? Like:
var service = ServiceLocator.Current.GetInstance<IPriceService>();
if (service == null)
{
Debugger.Break();
}
Sounds like after Commerce have been initialized a container it's overwritten or flushed. Try to change order of initialization.
EPiServer.ServiceLocation.ServiceLocator.SetLocator(new StructureMapServiceLocator(container));
new Mediachase.Commerce.Initialization.CommerceInitialization().ConfigureContainer(context);
Everything in the IoC container is fine and the actual concrete class is returned. I raised a support ticket a few days ago about this issue. It looks like it is linked to the version of the EPiServer.Framework.dll. The code that we have listed above is all fine.
EPiServer.Framework Version 7.0859.1 - Works perfectly
EPiServer.Framework Version 7.0.859.8 - Error in DI
EPiServer.Framework Version 7.0.859.16 - Error in DI
So in summary I finally got the console application to work referencing EPiServer.Framework version 7.0.859.1. Unfortunately the newer version throw a DI error. Not sure exactly why but I'm going to ask support why this is the case and if it will be fixed.
However, this still does not fix the problem in a windows service. So I'm continuing with the console application.
Thanks for your help,
Damo
Has anyone made it work with EPiServer.Framework Version 7.7.0.0. I have upgraded to 7.6 and could not make quartz work so far. I fix one type initilization issue but another type starts complianing. Any help will be much appreciated?
Hi All,
Has anyone used the quartz service with Commerce 1R3? Or does anyone know if it is compatible with this version of Commerce? It doesn't seem to be an option anymore in the EPiServer Deployment Center to install. I'd like to use it for the purpose of regular product imports and index rebuilds, as these processes will be long running jobs.
Thanks heaps,
Damo