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>
Related
This is my XML file, it's not working at all.I want to configure multiple jobs using XML file, i searched for this and got no answer, so could anyone help me about this?
<schedule>
<job>
<name>employee</name>
<group>SampleGroup</group>
<description>My job</description>
<job-type>Quartz.Server.Interface_manip, Quartz.Server</job-type>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>employeeTrigger</name>
<group>SampleGroup</group>
<description>Simple trigger to simply fire sample job</description>
<job-name>employee</job-name>
<job-group>SampleGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<cron-expression>0 13 10 * * ?</cron-expression>
</cron>
</trigger>
<job>
<name>SampleJob</name>
<group>SampleGroup</group>
<description>My job</description>
<job-type>Quartz.Server.Next_Year_Quota, Quartz.Server</job-type>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>SampleTrigger</name>
<group>SampleGroup</group>
<description>Simple trigger to simply fire sample job</description>
<job-name>SampleJob</job-name>
<job-group>SamplerGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<cron-expression>0 31 10 * * ?</cron-expression>
</cron>
</trigger>
</schedule>
</job-scheduling-data>
it executed perfectly if there's only the first job, and it did nothing when i added the second one, but i really need it to execute multiple jobs, and it will be convenient to use XML.Thank you very much.
From what I can see your issue is due to the fact that you are grouping your job and trigger together. Try grouping your jobs together, and your triggers together.
Also, I don't know if you intended to exclude your xml and job-scheduling-data tags, but you need those.
As an extra, I find this tool helpful.
Cron Expression Generator & Explainer - Quartz
Try this:
<?xml version="1.0" encoding="utf-8" ?>
<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData">
<schedule>
<job>
<name>employee</name>
<group>SampleGroup</group>
<description>My job</description>
<job-type>Quartz.Server.Interface_manip, Quartz.Server</job-type>
<durable>true</durable>
<recover>false</recover>
</job>
<job>
<name>SampleJob</name>
<group>SampleGroup</group>
<description>My job</description>
<job-type>Quartz.Server.Next_Year_Quota, Quartz.Server</job-type>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>employeeTrigger</name>
<group>SampleGroup</group>
<description>Simple trigger to simply fire sample job</description>
<job-name>employee</job-name>
<job-group>SampleGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<cron-expression>0 13 10 * * ?</cron-expression>
</cron>
</trigger>
<trigger>
<cron>
<name>SampleTrigger</name>
<group>SampleGroup</group>
<description>Simple trigger to simply fire sample job</description>
<job-name>SampleJob</job-name>
<job-group>SamplerGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<cron-expression>0 31 10 * * ?</cron-expression>
</cron>
</trigger>
</schedule>
</job-scheduling-data>
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?
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>
I have this xml:
<?xml version="1.0" encoding="UTF-8"?>
<CueList xmlns="urn:CueListSchema.xml" xmlns:s="urn:schemas-rcsworks-com:SongSchema" xmlns:n="urn:schemas-rcsworks-com:NoteSchema" xmlns:l="urn:schemas-rcsworks-com:LinkSchema" xmlns:t="urn:schemas-rcsworks-com:TrafficSchema" xmlns:p="urn:schemas-rcsworks-com:ProductSchema" xmlns:m="urn:schemas-rcsworks-com:MediaSchema" xmlns:w="urn:schemas-rcsworks-com:WebPageSchema" xmlns:ns="urn:CueListSchema.xml" time="2011-12-02T13:34:39">
<Event eventID="14" eventType="song" status="happening" scheduledTime="13:34:38" scheduledDuration="332.82">
<s:Song title="Long Time Coming (Holding On)" internalID="007700028007AD480000">
<s:Artist name="The Winans" sequenceNumber="1" internalID="0067000180002B020000" sortName="Winans, The" />
<m:Media ID="{7C734B6C-7AF7-4998-8366-F1F11F5D56D7}" runTime="332.82" fileName="{7C734B6C-7AF7-4998-8366-F1F11F5D56D7}.wav" />
</s:Song>
</Event>
<Event eventID="15" eventType="link" status="committed" startTime="13:40:10" scheduledDuration="3.49">
<l:Link title="PG MFL DRY FEMALE" internalID="007B00028002DAEA0000">
<m:Media ID="{036BB0ED-3130-4AD0-8BAF-E5D0FBA7DC3B}" runTime="3.49" fileName="{036BB0ED-3130-4AD0-8BAF-E5D0FBA7DC3B}.wav" />
</l:Link>
</Event>
<Event eventID="16" eventType="song" status="committed" startTime="13:40:10" scheduledDuration="303.55">
<s:Song title="Not Making Sense, Making Faith" internalID="007700028009377F0000">
<s:Artist name="Donald Lawrence" sequenceNumber="1" internalID="006700018000308A0000" sortName="Lawrence, Donald" />
<m:Media ID="{B6FD04EA-9B42-4E6A-AC80-A26BF65E6F11}" runTime="303.55" fileName="{B6FD04EA-9B42-4E6A-AC80-A26BF65E6F11}.wav" />
</s:Song>
</Event>
</CueList>
I am able to set the namespaces for songs etc. But when I try and select Events it does not work, I tried setting the namespace for CueList and when I debug it says that namespace is null?
It's hard to know what's wrong when you haven't shown the code you're using, but it should be simple:
XNamespace ns = "urn:CueListSchema.xml";
var events = doc.Descendants(ns + "Event");
If that doesn't work, please give us a short but complete example of both the XML (formatted, please, and not just copied from a browser) and code you're using.