Quartz.Net How to use XML to configure several jobs - c#

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>

Related

keep getting ERR.SWS.CLIENT.VALIDATION_FAILED exception when calling PassengerDetailsRQ

I am using Sabre SOAP Api in C#. I got the response from session creation successfully, I added wsdl Service Reference
http://files.developer.sabre.com/wsdl/sabreXML1.0.00/ServicesPlatform/PassengerDetails3.3.0RQ.wsdl to my test project and pass required values to parameters in the request as given in the documentation https://developer.sabre.com/docs/read/soap_apis/management/itinerary/Passenger_Details.
this is my xml to that is send to sabre and Getting Exception
<?xml version="1.0" encoding="utf-16"?>
<PassengerDetailsRQ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.2.1"
IgnoreOnError="false">
<MiscSegmentSellRQ xmlns="http://services.sabre.com/sp/pd/v3_2">
<MiscSegment DepartureDateTime="2018-01-10T16:45" InsertAfter="0" NumberInParty="1" Status="HK" Type="OTH">
<OriginLocation LocationCode="SAN" />
<Text>America Tours</Text>
<VendorPrefs>
<Airline Code="DL" />
</VendorPrefs>
</MiscSegment>
</MiscSegmentSellRQ>
<PostProcessing xmlns="http://services.sabre.com/sp/pd/v3_2">
<EndTransactionRQ>
<EndTransaction Ind="true">
<Email Ind="true" />
</EndTransaction>
<Source ReceivedFrom="SWS TESTING" />
</EndTransactionRQ>
</PostProcessing>
<PreProcessing xmlns="http://services.sabre.com/sp/pd/v3_2" />
<PriceQuoteInfo xmlns="http://services.sabre.com/sp/pd/v3_2">
<Link NameNumber="1.1" Record="1" />
</PriceQuoteInfo>
<SpecialReqDetails xmlns="http://services.sabre.com/sp/pd/v3_2">
<SpecialServiceRQ>
<SpecialServiceInfo>
<SecureFlight>
<PersonName DateOfBirth="02/02/1998" NameNumber="1.1">
<GivenName>Usama QW</GivenName>
<Surname>Alam</Surname>
</PersonName>
<VendorPrefs>
<Airline />
</VendorPrefs>
</SecureFlight>
</SpecialServiceInfo>
</SpecialServiceRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ xmlns="http://services.sabre.com/sp/pd/v3_2">
<AgencyInfo>
<Address>
<AddressLine>America Tours</AddressLine>
<CityName>Los Angeles</CityName>
<CountryCode>US</CountryCode>
<PostalCode>90020</PostalCode>
<StateCountyProv StateCode="CA" />
<StreetNmbr>3434 West 6th Street Suite 400-6</StreetNmbr>
</Address>
<Ticketing TicketType="7T-A" />
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber NameNumber="1.1" Phone="213-738-8185" PhoneUseType="A" />
<ContactNumber NameNumber="1.1" Phone="3162881034" PhoneUseType="A" />
</ContactNumbers>
<Email Address="www.usamaalam60#gmail.com" ShortText="AmericaTours" />
<Email Address="admin#koreaonly.com" ShortText="AmericaTours" />
<PersonName NameNumber="1.1" NameReference="MR" PassengerType="ADT">
<GivenName>Usama sd</GivenName>
<Surname>Alam</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
For this one you seem to be using invalid service version for the 3.2 namespace. Try with something like this:
*xmlns="http://services.sabre.com/sp/pd/v3_2"* and *version="3.2.0"*.
You were using version 2.2.1 here which will require a different URL.
Are you intending to use 3.2.0 version? I can see that the dates are not valid as per the schema as well. You have:
*DateOfBirth="02/02/1998"*
but should have:
*DateOfBirth="1998-02-02"*

How to identify duplicate value in XML file using (c#)?

Hi I have XML file as below. I need to check for duplicate value inside and if any duplicate found then I need to trigger a notification mail of its existence. Inner text of must be unique for the whole XML file.
From the below file I have 2 value(inner text) of are same. So how do I write the code to identify these duplicate and trigger a notification mail using (c#). sample code will be much appreciable.
<?xml version="1.0" encoding="utf-8"?>
<JobsMapper>
<Platform>
<Platform_Data Name="GLP" ServerName="Lydsyd119" Input_Location="\\10.51.226.65\FTK_Production\IO\FileWatcherIO\GLP\GLP\"/>
<External_Delete_Request InstanceName="archive" DestinationFolder="\\10.51.226.65\FTK Production Release\FTK_Production\IO\FabricationIO\ExternalDeleteRequest\ExternalDelete\INPUT\"/>
<Archival InstanceName="archive" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\Archive\BundleArchive\INPUT\"/>
<Job InstanceName="0018" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0018\MixedContent\INPUT\">
<DPSI>0018</DPSI>
</Job>
<Job InstanceName="0019" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0019\MixedContent\INPUT\">
<DPSI>0019</DPSI>
</Job>
<Job InstanceName="0CPN" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0CPN\MixedContent\INPUT\">
<DPSI>0CPN</DPSI>
</Job>
<Job InstanceName="0011" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0011\MixedContent\INPUT\">
<DPSI>0011</DPSI>
</Job>
<Job InstanceName="0011" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0011\MixedContent\INPUT\">
<DPSI>0011</DPSI>
</Job>
<Job InstanceName="000S" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\000S\MixedContent\INPUT\">
<DPSI>000S</DPSI>
</Job>
<Job InstanceName="06JW" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\06JW\MixedContent\INPUT\">
<DPSI>06JW</DPSI>
</Job>
<Job InstanceName="0N2Z" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0N2Z\MixedContent\INPUT\">
<DPSI>0N2Z</DPSI>
</Job>
<Job InstanceName="0HNQ" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0HNQ\MixedContent\INPUT\">
<DPSI>0HNQ</DPSI>
</Job>
<Job InstanceName="000Z" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\000Z\MixedContent\INPUT\">
<DPSI>000Z</DPSI>
</Job>
<Job InstanceName="000W" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\000W\MixedContent\INPUT\">
<DPSI>000W</DPSI>
</Job>
<Job InstanceName="0014" DestinationFolder="\\10.51.226.65\FTK_Production\IO\FabricationIO\0014\MixedContent\INPUT\">
<DPSI>0014</DPSI>
</Job>
</Platform>
</JobsMapper>
The following code will let you know how many nodes have duplicate values.
var result = XDocument.Parse(xml)
.Descendants("DPSI")
.GroupBy(x => x.Value)
.Where(x => x.Count() > 1);

Quartz.Net XML config start-time / end-time

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>

Quartz.net Configure several jobs in XML

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>

ETW Channel Providers - Channel Names

I am using latest EventSource Nuget-Package for creating eventlogs where every application gets its own folder for different types of logs.
As playing around I figured out that I can't simply change the logs name.
I tried to change it in the manifest file and registered the new channel where it displayed its new name. Unfortunately every event fired to these logs won't show up anymore till I register a new channel with predefined channel name.
Any chance to change that? Since I have to create manifest files on each machine i have to change it programatically because channel names were created by predefined values (Admin, Operational, etc...)
To be clear: I want to change following names AND have all logs written into these channels.
Sample-manifest which was generated automatically:
<instrumentationManifest xmlns="http://schemas.microsoft.com/win/2004/08/events">
<instrumentation xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events">
<events xmlns="http://schemas.microsoft.com/win/2004/08/events">
<provider name="Samples-EventSourceDemos-EventLog" guid="{d89ec17d-ee69-5275-eb6f-0c826bb76bd8}" resourceFileName="E:\EventlogTest\bin\Debug\EventlogTest.Samples-EventSourceDemos-EventLog.etwManifest.dll" messageFileName="E:\EventlogTest\bin\Debug\EventlogTest.Samples-EventSourceDemos-EventLog.etwManifest.dll" symbol="SamplesEventSourceDemosEventLog">
<channels>
<channel chid="Admin" name="Samples-EventSourceDemos-EventLog/Admin" value="16" type="Admin" enabled="true"/>
<channel chid="Analytic" name="Samples-EventSourceDemos-EventLog/Analytic" value="18" type="Analytic" enabled="false"/>
<channel chid="Debug" name="Samples-EventSourceDemos-EventLog/Debug" value="19" type="Debug" enabled="false"/>
</channels>
<tasks>
<task name="Request" message="$(string.task_Request)" value="1"/>
<task name="DebugTrace" message="$(string.task_DebugTrace)" value="65530"/>
</tasks>
<opcodes>
</opcodes>
<keywords>
<keyword name="Requests" message="$(string.keyword_Requests)" mask="0x1"/>
<keyword name="Debug" message="$(string.keyword_Debug)" mask="0x2"/>
<keyword name="Session3" message="$(string.keyword_Session3)" mask="0x100000000000"/>
<keyword name="Session2" message="$(string.keyword_Session2)" mask="0x200000000000"/>
<keyword name="Session1" message="$(string.keyword_Session1)" mask="0x400000000000"/>
<keyword name="Session0" message="$(string.keyword_Session0)" mask="0x800000000000"/>
</keywords>
<events>
<event value="1" version="0" level="win:Error" symbol="RequestStart" message="$(string.event_RequestStart)" keywords="Requests" opcode="win:Start" task="Request" channel="Admin" template="RequestStartArgs"/>
<event value="2" version="0" level="win:Error" symbol="RequestPhase" message="$(string.event_RequestPhase)" keywords="Requests" task="Request" channel="Analytic" template="RequestPhaseArgs"/>
<event value="3" version="0" level="win:Error" symbol="RequestStop" message="$(string.event_RequestStop)" keywords="Requests" opcode="win:Stop" task="Request" channel="Admin" template="RequestStopArgs"/>
<event value="4" version="0" level="win:Error" symbol="DebugTrace" message="$(string.event_DebugTrace)" keywords="Debug" task="DebugTrace" channel="Debug" template="DebugTraceArgs"/>
</events>
<templates>
<template tid="RequestStartArgs">
<data name="RequestID" inType="win:Int32"/>
<data name="Url" inType="win:UnicodeString"/>
</template>
<template tid="RequestPhaseArgs">
<data name="RequestID" inType="win:Int32"/>
<data name="PhaseName" inType="win:UnicodeString"/>
</template>
<template tid="RequestStopArgs">
<data name="RequestID" inType="win:Int32"/>
</template>
<template tid="DebugTraceArgs">
<data name="Message" inType="win:UnicodeString"/>
</template>
</templates>
</provider>
</events>
</instrumentation>
<localization>
<resources culture="de-DE">
<stringTable>
<string id="event_DebugTrace" value="DebugMessage: %1"/>
<string id="event_RequestPhase" value="Entering Phase %2 for request %1"/>
<string id="event_RequestStart" value="Start processing request%n%t*** %1 ***%nfor URL%n%t=== %2 ==="/>
<string id="event_RequestStop" value="Stop processing request%n%t*** %1 ***"/>
<string id="keyword_Debug" value="Debug"/>
<string id="keyword_Requests" value="Requests"/>
<string id="keyword_Session0" value="Session0"/>
<string id="keyword_Session1" value="Session1"/>
<string id="keyword_Session2" value="Session2"/>
<string id="keyword_Session3" value="Session3"/>
<string id="task_DebugTrace" value="DebugTrace"/>
<string id="task_Request" value="Request"/>
</stringTable>
</resources>
</localization>
</instrumentationManifest>
Thanks for your help.

Categories