How to configure correctly the XML for several jobs in Quartz.Net? Is there any tutorials on that?
I found tutorials for one job in the XML. It is working. But I am not sure for several jobs how to configure the quartz_jobs.xml.
I agree with you that a "jobs" (plural) xml-tag would be more intuitive. But basically you put in multiple "job" (singular) xml elements. And just ignore the fact there is no <jobs> (plural) element.
Note that the
<job><name>
needs to match the
<trigger><simple><job-name>
value, to get the job to map to the correct trigger.
But here is my xml for 2 jobs.
<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
<!-- This value wipes out existing jobs...be very careful with it being "true" -->
<processing-directives>
<overwrite-existing-data>true</overwrite-existing-data>
</processing-directives>
<schedule>
<!-- First Job -->
<job>
<name>LogStuffJobJobName</name>
<group>LogStuffJobGroupName</group>
<description>LogStuffJobNonConcurrentJob Description</description>
<job-type>MyCompany.Apps.QuartzPOC.BAL.Jobs.LogStuffJobNonConcurrentJob, MyCompany.Apps.QuartzPOC.BAL</job-type>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<!--Parameters for the job-->
<entry>
<key>JobDetailParameter001</key>
<value>Value001_Set_In_Quartz_Jobs_001_xml</value>
</entry>
<entry>
<key>DefinedInJobDetailAndTriggerKey</key>
<value>DefinedInJobDetailAndTriggerKeyValue_JobElement_Set_In_Quartz_Jobs_001_xml</value>
</entry>
</job-data-map>
</job>
<trigger>
<simple>
<name>LogStuffJobTriggerName</name>
<group>LogStuffJobTriggerGroup</group>
<description>LogStuffJobTriggerName Description</description>
<job-name>LogStuffJobJobName</job-name>
<job-group>LogStuffJobGroupName</job-group>
<job-data-map>
<entry>
<key>TriggerParameter001Key</key>
<value>TriggerParameter001Value_Set_In_Quartz_Jobs_001_xml</value>
</entry>
<entry>
<key>TriggerParameter002Key</key>
<value>TriggerParameter002Value_Set_In_Quartz_Jobs_001_xml</value>
</entry>
<entry>
<key>DefinedInJobDetailAndTriggerKey</key>
<value>DefinedInJobDetailAndTriggerKeyValue_TriggerElement_Set_In_Quartz_Jobs_001_xml</value>
</entry>
</job-data-map>
<!--<start-time>1982-06-28T18:15:00.0Z</start-time>-->
<!--<end-time>2020-05-04T18:13:51.0Z</end-time>-->
<misfire-instruction>SmartPolicy</misfire-instruction>
<!-- repeat indefinitely every 5 seconds -->
<repeat-count>-1</repeat-count>
<repeat-interval>5000</repeat-interval>
</simple>
</trigger>
<!-- Second Job -->
<job>
<name>TextFilePoppingJobJobName</name>
<group>TextFilePoppingJobGroupName</group>
<description>TextFilePoppingJob Desription</description>
<job-type>MyCompany.Apps.QuartzPOC.BAL.Jobs.TextFilePoppingJob, MyCompany.Apps.QuartzPOC.BAL</job-type>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key>FavoriteActor</key>
<value>Harrison Ford</value>
</entry>
<entry>
<key>FavoriteColor</key>
<value>Green</value>
</entry>
</job-data-map>
</job>
<trigger>
<simple>
<name>TextFilePoppingJobTriggerName</name>
<group>TextFilePoppingJobTriggerGroup</group>
<description>TextFilePoppingJobTriggerName Description</description>
<job-name>TextFilePoppingJobJobName</job-name>
<job-group>TextFilePoppingJobGroupName</job-group>
<job-data-map>
<entry>
<key>FavoriteCity</key>
<value>Chicago</value>
</entry>
</job-data-map>
<misfire-instruction>SmartPolicy</misfire-instruction>
<repeat-count>-1</repeat-count>
<repeat-interval>10000</repeat-interval>
</simple>
</trigger>
</schedule>
</job-scheduling-data>
Related
Good Afternoon,
We have been trying to consume a Carrier API, but have hit some issue with the WSDL Generation. The Example XML message the company has provided has ns1-3 and appears that it is important for the address fields. the XML generated from their WSDL seems to generate the same fields but has no name spaces like the original and fails with "Address details are invalid", Is there some setting we are missing so that it generates the correct XML?
This is their Example XML
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns3:CreateLabel xmlns:ns3="http://courier.ck.dx.metafour.com/" xmlns:ns2="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<order>
<ns2:customerID>14337622</ns2:customerID>
<ns2:dates>
<date format="yyyy-MM-dd HH:mm:ss" type="requestedCollectionDate">2018-12-12 17:59:21</date>
</ns2:dates>
<sourceSystemReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">AMS207554</sourceSystemReference>
<customerReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">286956</customerReference>
<orderAttributes xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" xsi:nil="true" />
<ns2:orderLines>
<ns2:consignment>
<pieces>
<dimensions>
<value>1.0</value>
<type>cdlWeight</type>
<UOM>KG</UOM>
</dimensions>
<barcode xsi:nil="true" />
<trackingNumber xsi:nil="true" />
</pieces>
<qty>1</qty>
<legacyService>
<name>serviceLevel</name>
<partyId>0</partyId>
<partyType>HITS</partyType>
</legacyService>
<legacyService>
<name>serviceType</name>
<partyId>2</partyId>
<partyType>HITS</partyType>
</legacyService>
<deliverTo>
<ns2:address primary="true">
<organisationName>Argos</organisationName>
<addressLine1>Argos</addressLine1>
<addressLine2>Argos Ltd</addressLine2>
<addressLine3>11 Canning Street</addressLine3>
<city>BURNLEY</city>
<postalCode>BB12 0AD</postalCode>
<country>
<countryCode>GB</countryCode>
<description>GB</description>
</country>
</ns2:address>
<contact />
</deliverTo>
</ns2:consignment>
</ns2:orderLines>
<labelType>ZPL</labelType>
</order>
<serviceHeader>
<password>test</password>
<userId>test</userId>
</serviceHeader>
</ns3:CreateLabel>
</s:Body>
</s:Envelope>
This is our Generated XML
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CreateLabel xmlns="http://courier.ck.dx.metafour.com/">
<order xmlns="">
<customerID xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">14337622</customerID>
<dates xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<date xmlns="" format="yyyy-MM-dd HH:mm:ss" type="requestedCollectionDate">2019-01-25 10:17:33</date>
</dates>
<sourceSystemReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">AMS207554</sourceSystemReference>
<customerReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">286956</customerReference>
<orderAttributes xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" xsi:nil="true" />
<orderLines xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<consignment>
<pieces xmlns="">
<dimensions>
<value>1.0</value>
<type>cdlWeight</type>
<UOM>KG</UOM>
</dimensions>
<barcode xsi:nil="true" />
<trackingNumber xsi:nil="true" />
</pieces>
<qty>1</qty>
<legacyService xmlns="">
<name>serviceLevel</name>
<partyId>0</partyId>
<partyType>HITS</partyType>
</legacyService>
<legacyService xmlns="">
<name>serviceType</name>
<partyId>2</partyId>
<partyType>HITS</partyType>
</legacyService>
<deliverTo xmlns="">
<address xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<organisationName xmlns="">Argos</organisationName>
<addressLine1 xmlns="">Argos</addressLine1>
<addressLine2 xmlns="">Argos Ltd</addressLine2>
<addressLine3 xmlns="">11 Canning Street</addressLine3>
<city xmlns="">BURNLEY</city>
<postalCode xmlns="">BB12 0AD</postalCode>
<country xmlns="">
<countryCode>GB</countryCode>
<description>GB</description>
</country>
</address>
<contact xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" />
</deliverTo>
</consignment>
</orderLines>
<labelType>ZPL</labelType>
</order>
<serviceHeader xmlns="">
<password>test</password>
<userId>test</userId>
</serviceHeader>
</CreateLabel>
</s:Body>
</s:Envelope>
Any help would be greatly appreciated!
This is resolved,
I could not figure out a way to change or add additional namespace to the generated references.cs file, and ended up sending the SOAP to their server manually with an XML string serialized using a httpWebRequest and XmlSerializer
I have an XML file which contains 1) a serialized object and 2) a serialized hashtable. Here is my pseudo xml file(data.xml):
//PROPERTIES of an object called "Information"
<?xml version="1.0" encoding="utf-8"?>
<Information xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CompileScript>false</CompileScript>
<SaveScript>false</SaveScript>
<ConvertPaths>false</ConvertPaths>
<UseUninstaller>true</UseUninstaller>
<UninstallSuccess>[NAME] was successfully removed from your computer. </UninstallSuccess>
<UninstallPrompt>Are you sure you want to completely remove [NAME] and all of its components?</UninstallPrompt>
<AllowChangeStartMenuFolderName>false</AllowChangeStartMenuFolderName>
//... (many others)
//Here starts KEYS & VALUES of my hashtable
<entry>
<fileName> My file name 1</fileName>
<instDir>My file location 1</instDir>
</entry>
<entry>
<fileName> My file name 2</fileName>
<instDir>My file location 2</instDir>
</entry>
//...and so on.
My goal is to deserialize half of the XML file (up to "AllowChangeStartMenuFolderName") back to "Information" object and the remaining part back to a hashtable. My concerns:
How do I tell the program to deserialize the file up to "AllowChangeStartMenuFolderName" and then STOP?
How do I tell the program to start deserializing at a certain point of an XML file(starting from the "entry" tag and down to the end of the file)?
Can somebody at least put me in the right direction, I haven't found any information on the internet. Thanks
EDIT
I have tried :
XmlTextReader reader = new XmlTextReader("...Path...\\data.xml");
//the last element before the keys and values of a hashtable start
reader.ReadToDescendant("AllowChangeStartMenuFolderName");
XmlSerializer serializer = new XmlSerializer(typeof(Classes.Information));
//info is a new empty object which should be filled with values from the XML file
this.info = (Classes.Information)serializer.Deserialize(reader.ReadSubtree());
reader.Close();
Throws me an exception at the last line - "Error in XML Document (27,4)".
My original XML (the first one was pseude code):
<?xml version="1.0" encoding="utf-8"?>
<Information xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CompileScript>false</CompileScript>
<SaveScript>false</SaveScript>
<ConvertPaths>false</ConvertPaths>
<UseUninstaller>true</UseUninstaller>
<UninstallSuccess>[NAME] was successfully removed from your computer.</UninstallSuccess>
<UninstallPrompt>Are you sure you want to completely remove [NAME] and all of its components?</UninstallPrompt>
<AllowChangeStartMenuFolderName>false</AllowChangeStartMenuFolderName>
<StartMenuShortcut>true</StartMenuShortcut>
<StartMenuUninstallIcon>true</StartMenuUninstallIcon>
<TheRightProgramFilesDirectoryUserView>Program Files (x86)</TheRightProgramFilesDirectoryUserView>
<RadioButtonRadioButton>false</RadioButtonRadioButton>
<CheckBoxRadioButton>false</CheckBoxRadioButton>
<ClassicButtonRadioButton>false</ClassicButtonRadioButton>
<AllowChangeDirectoryCheckBox>true</AllowChangeDirectoryCheckBox>
<ApplicationDirectory>C:\Program Files(x86)\ANNAX\My application</ApplicationDirectory>
<ApplicationName>My application</ApplicationName>
<ApplicationVersion>1.0</ApplicationVersion>
<ApplicationPublisher>My company, Inc.</ApplicationPublisher>
<ApplicationWebsite>http://wwww.mycompany.com</ApplicationWebsite>
<SetupIcon>Icons\modern-install.ico</SetupIcon>
<GermanCheckBox>false</GermanCheckBox>
<EnglishCheckBox>true</EnglishCheckBox>
<FrenchCheckBox>false</FrenchCheckBox>
<ThirtyTwoBitRadioButton>true</ThirtyTwoBitRadioButton>
<SixtyFourBitRadioButton>false</SixtyFourBitRadioButton>
<entry>
<fileName>file1</fileName>
<instDir>instDir1</instDir>
</entry>
<entry>
<fileName>file2</fileName>
<instDir>instDir2</instDir>
</entry>
<entry>
<fileName>file3</fileName>
<instDir>instDir3</instDir>
</entry>
<entry>
<fileName>file4</fileName>
<instDir>instDir4</instDir>
</entry>
<entry>
<fileName>file5</fileName>
<instDir>instDir5</instDir>
</entry>
<entry>
<fileName>file6</fileName>
<instDir>instDir6</instDir>
</entry>
<entry>
<fileName>file7</fileName>
<instDir>instDir7</instDir>
</entry>
<entry>
<fileName>file8</fileName>
<instDir>instDir8</instDir>
</entry>
<entry>
<fileName>file9</fileName>
<instDir>instDIr9</instDir>
</entry>
I'm currently trying to get rid of OData error which looks like a problem with decimal parsing/deserializing.
I have working OData API (using System.Web.Http.OData library) in my ASP.NET MVC application and user can download OData Feed file *.odc pointing to said OData API. When there is a decimal in OData API response, such as
<d:Value m:type="Edm.Decimal">50.50</d:Value>
and user wants to open OData Feed file in Excel (tested on Excel 2016) to fetch data he gets an error:
We couldn't get data from the Data Model. Here's the error message we got:
The following system error occurred: Type mismatch.
What is intersting is that there is no error when the decimal value has no decimal part, like this:
<d:Value m:type="Edm.Decimal">50.00</d:Value>
Here's complete API response (with urls cut out):
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="xxxxxxxxx" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://schemas.datacontract.org/2004/07/</id>
<title />
<updated>2016-06-22T11:01:10Z</updated>
<link rel="self" href="xxxxxxxxxxxxx" />
<entry>
<id>xxxxx</id>
<category term="Itm.Erp.Domain.Finance.CashRegistryListView" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="xxxx" />
<link rel="self" href="xxxx" />
<title />
<updated>2016-06-22T11:01:10Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Number>001</d:Number>
<d:Location m:null="true" />
<d:Direction>In</d:Direction>
<d:Person>Sam</d:Person>
<d:Company>Company</d:Company>
<d:Date m:type="Edm.DateTime">2016-06-06T00:00:00</d:Date>
<d:IsProcessed m:type="Edm.Boolean">true</d:IsProcessed>
<d:ExpenseType m:null="true" />
<d:Value m:type="Edm.Decimal">50.50</d:Value>
<d:EffectiveValue m:type="Edm.Decimal">50.50</d:EffectiveValue>
<d:Seller m:null="true" />
<d:DocumentNumber m:null="true" />
</m:properties>
</content>
</entry>
</feed>
What is the problem with decimals in API response and is there a way to fix it? Does anyone had a similar problem and managed to solve it?
I am trying to set up a trigger in quartz_jobs.xml that launches a job at 8:05AM and finishes today at 12:10PM from Monday to Friday. The job is not repeated, the job is fetching continuous data.
Any idea how to do that? Can I do that with a simple trigger, as the cron trigger does not have control on the end-time?
I would like something like this, but I do not know the syntax:
<start-time>todayT08:05:00.0Z</start-time>
<end-time>todayT12:10:00.0Z</end-time>
Find below the code I try which does not work:
<job>
<name>simplejob</name>
<group>jobGroup1</group>
<description>jobDesciption1</description>
<job-type>BigBrother.ScheduledJobs.DataFeedJob, BigBrother</job-type>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key>JobMapDataKey_HistRTD</key>
<value>RTD</value>
</entry>
<entry>
<key>JobMapDataKey_ParamaterFile</key>
<value>Config\ParametersData_Test.csv</value>
</entry>
</job-data-map>
</job>
<trigger>
<simple>
<name>SimpleTrigger</name>
<job-name>simplejob</job-name>
<job-group>jobGroup1</job-group>
<!-- It will run from Monday To Friday at 8:05 to 12:10PM-->
<start-time>2015-04-14T08:05:00.0Z</start-time>
<end-time>2015-04-14T12:10:00.0Z</end-time>
<misfire-instruction>SmartPolicy</misfire-instruction>
</simple>
</trigger>
I have to migrate a large .net 1.1 application to .net 3.5.
The system used Configuration Management Application Block (CMAB) to load config files starting with the app.config file as:
<configuration>
<configSections>
<section
name="applicationConfigurationManagement"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.ConfigurationManagerSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement, Version=1.0.0.0,Culture=neutral,PublicKeyToken=e64cb664730084d3" />
<section
name="MyAppSystemSettings"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.XmlHashtableSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement, Version=1.0.0.0,Culture=neutral,PublicKeyToken=e64cb664730084d3" />
</configSections>
<appSettings>
<!-- Key / Value Pairs -->
</appSettings>
<!-- ## Configuration Management Settings ## -->
<applicationConfigurationManagement defaultSection="MyAppSystemSettings">
<configSection name="MyAppSystemSettings">
<configCache enabled="true" refresh="* 6 * * *" />
<configProvider
assembly="Microsoft.ApplicationBlocks.ConfigurationManagement, Version=1.0.0.0,Culture=neutral,PublicKeyToken=e64cb664730084d3"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFileStorage"
signed="false"
refreshOnChange="false"
encrypted="false"
path="C:\Program Files\MyApp\Config\MyAppSystemSettings.Config" />
</configSection>
</applicationConfigurationManagement>
</configuration>
As can be seen this is referencing the MyAppSystemSettings.Config 'sub' config file which looks like:
<configuration>
<MyAppSystemSettings>
<XmlSerializableHashtable xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entries>
<Entry>
<key xsi:type="xsd:string">Key0</key>
<value xsi:type="xsd:string">Value0</value>
</Entry>
<Entry>
<key xsi:type="xsd:string">Key1</key>
<value xsi:type="xsd:string">Value1</value>
</Entry>
<Entry>
<key xsi:type="xsd:string">ExtraConfigFile</key>
<value xsi:type="xsd:string">C:\Program Files\MyApp\Config\ExtraConfig.xml</value>
</Entry>
</XmlSerializableHashtable>
</MyAppSystemSettings>
</configuration>
Considering that the app.config file refers to 10+ 'sub' config files similar to MyAppSystemSettings.Config and that they each contain 100+ entries I'm looking for the simplest way to migrate them to use System.Configuration correctly to give me the same results as the .net 1.1 solution using CMAB?