JobDataMap for trigger in Quatz jobs xml - quartz.net

I am running into an issue setting the job data map for the trigger in Quartz. I know it's possible pro grammatically, but I need to do it in the xml jobs file. However, every time I try to add it to the trigger, it says that job-data-map is invalid. Looking at the XSD (http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd) for the jobs file, it looks like it should be a valid child of the cron tag because it inherits abstractTriggerType, but my app won't accept it.
Here is my code. I am using Quartz.Net 2.0
<job>
<name>StagingJob</name>
<job-type>MyAssembly.StagingJob, MyAssembly</job-type>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>StagingTrigger</name>
<job-name>StagingJob</job-name>
<misfire-instruction>SmartPolicy</misfire-instruction>
<job-data-map>
<entry>
<key>end-time-cron</key>
<value>0 59 * * * ?</value>
</entry>
<entry>
<key>thread-count</key>
<value>3</value>
</entry>
</job-data-map>
<cron-expression>0 1 * * * ?</cron-expression>
</cron>
</trigger>
What is the correct way to add job data to the trigger via xml?

Try removing the element misfire-instruction, smart policy is the default anyway. If you'd like to keep the element, it should come after the job-data-map element. Quartz is quite strict about ordering of XML elements.
Visual Studio should also give you intellisense with this document if you set Schemas in VS property window point to XSD file included in the distribution.

Related

Turning on Saxon performance analysis in eXist-db

I've used the performance analysis tool in Saxon (https://www.saxonica.com/documentation11/index.html#!using-xsl/performanceanalysis) to analyze stylesheets, and it's quite useful. I'd like to do the analysis from within eXist-db rather than the command line. For one, the performance could be different. But mainly because some stylesheets open documents in exist-db, and I can't run these from the command line. Is there a way to configure Saxon to output the profile.html document when it's run via eXist-db?
I was hoping there would be an attribute in conf.xml , or attributes that could be sent via transform:transform(), but I don't see any options related to the performance analysis tool.
I can't be certain this will work, but it's worth a try.
The $attributes parameter of Exist-db's transform() method allows you to set Saxon configuration properties. The available properties are listed at https://www.saxonica.com/documentation11/index.html#!configuration/config-features . You could try setting the properties TRACE_LISTENER_CLASS (to "net.sf.saxon.trace.TimingTraceListener") and TRACE_LISTENER_OUTPUT_FILE (to the required "profile.html" output file).
Incidentally, note that the performance is going to be different when you run with a trace listener. The profile generated using -TP is useful because it tells you which templates and functions are accounting for the most time and therefore need attention; the absolute numbers are not important or accurate. The hot spots will almost certainly be the same whether you are running within eXist or from the command line.
I can confirm this did work. Here's the XQL I used:
let $params :=
<parameters>
</parameters>
let $attributes :=
<attributes>
<attr name="http://saxon.sf.net/feature/traceListenerClass" value="net.sf.saxon.trace.TimingTraceListener"/>
<attr name="http://saxon.sf.net/feature/traceListenerOutputFile" value="/tmp/profile.html"/>
</attributes>
let $serialization := 'method=html5 media-type=text/html indent=no'
return transform:transform($xml, $xsl, $params, $attributes, $serialization)

How to set a timeout in VoiceXML?

In VoiceXML, how can I set the timeout when start the xml?
This is my VoiceXML document:
<vxml version="2.1">
<form>
<block>
<prompt>Hello from VXML</prompt>
</block>
<transfer name="result" dest="tel:+12321312" bridge="true">
<prompt>Please wait while we transfer you.</prompt>
<grammar xml:lang="en-US" root = "TOPLEVEL" mode="voice">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> disconnect </item>
</one-of>
</rule>
</grammar>
</transfer>
</form>
</vxml>
Two transfer property you can use:
connecttimeout The time to wait while trying to connect the call before returning the noanswer condition. The value is a Time Designation . Only applies if bridge is true. Default is platform specific.
maxtime The time that the call is allowed to last, or 0s if no limit is imposed. The value is a Time Designation . Only applies if bridge is true. Default is 0s.
I'm not completely sure what you mean. If you want to set up a timeout so that it throws an error if that vxml page you posted is not fetched within that time, you can set the fetchtimeout property before your first form.
If you go to the W3C, it says:
A VoiceXML interpreter context needs to fetch VoiceXML documents, and other resources, such as audio files, grammars, scripts, and objects. Each fetch of the content associated with a URI is governed by the following attributes:
fetchtimeout
The interval to wait for the content to be returned before throwing an error.badfetch event. The value is a Time Designation (see Section 6.5). If not specified, a value derived from the innermost fetchtimeout property is used.
fetchhint
Defines when the interpreter context should retrieve content from the server. prefetch indicates a file may be downloaded when the page is loaded, whereas safe indicates a file that should only be downloaded when actually needed. If not specified, a value derived from the innermost relevant fetchhint property is used.
maxage
maxscale

What is the second value of quartz.net configuration job-type parameter?

I'm trying to use Quartz.net in my web project. I configured my application like this:
<job>
<name>CRMMoreThanOneJob</name>
<group>jobGroup1</group>
<job-type>ReportingPortalBLL.Jobs.CRMCalledMoreThanOneJob, ReportingPortalBLL.Jobs</job-type>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key>MessageToLog</key>
<value>Hello from MyJob</value>
</entry>
</job-data-map>
</job>
But it did not work because of the job-type statement. My Job class' is defined like below and its namespace is ReportingPortalBll.Jobs
namespace ReportingPortalBLL.Jobs
{
public class CRMCalledMoreThanOneJob:IJob
{ .
.
}
}
After i changed it to ReportingPortalBLL.Jobs.CRMCalledMoreThanOneJob, ReportingPortalBLL (without .Job) it worked well.
I looked at the documentation but couldn't find what is represented at the second value of job-type parameter. What should i write on the second parameter? What is the second value on the below representation means? I will be using Quartz on my other projects so it would be nice to know how to configure it easily.
<job-type>Namespace.Job1, secondValue</job-type>
The secondValue corresponds to assembly name.
If you go through the source code of quartz.net you can see that the job-type is being passed to Type.GetType as parameter and Type.GetType accepts a assembly qualified name. The assembly-qualified name of a type consists of the type name, including its namespace, followed by a comma, followed by the display name of the assembly.
refer to these links for more info
http://msdn.microsoft.com/en-us/library/c5cf8k43.aspx
http://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname.aspx

How do I get the Ant <input> task to output åäö (and similar characters) properly?

My first question. Please bear with me!
I have an Ant task that need to get some input from the user before proceeding. I use the Input task to achieve this. The input message will contain Swedish characters (eg å, ä and ö) but I am unable to get Ant to output the message properly. I'm testing this using the command line on a machine running Windows 7 Pro English (but obviously using a Swedish keyboard). Example:
<input message="åäö"/>
will output:
[input] Õõ÷
The build.xml is saved in UTF-8 format. If I do 'chcp' on the command line I get "Active code page: 850".
The same result can be seen when doing an echo:
<echo message="åäö"/>
will output:
[echo] Õõ÷
But in the case of the echo task I'm able to do:
<echo encoding="850" message=åäö">
to get the expected output:
[echo] åäö
The input task does however not have an encoding attribute and I'd very much prefer to not have to define an encoding at all, especially not on a per-task level (since I can't tell for sure on what machine the Ant script will be run from).
PS I have additional problems with the received input if it contains åäö and I set the input as a property that is later used in a filter copy task, but I guess that's a whole other question
I can observe the issue on my Polish Windows.
<script language="javascript">
java.lang.System.out.println("default charset: "
+ java.nio.charset.Charset.defaultCharset());
</script>
reports default charset as "windows-1250" while the console operates at "iso-8859-2" (I guess so).
Looks like <input> task uses the default charset thinking it would match the console input. In case it does not, I managed to override the encoding this way:
set ANT_OPTS=-Dfile.encoding=iso-8859-2
ant
In your case I would try to force 850, as it looks like JRE defaults to something else.
This question helped me to find the property name.
It is also important where ant is run from. If I run it from my ide, jedit console plugin, I don't need to override encoding, because I configured it to operate in windows-1250. So it seems to be another workaround, using an IDE.

Get reference to the list of modifications from within Ant task

I'm try to develop a cruise control step which will process database migration scripts and apply them.
I'd like to be able to get hold of a list of the modifications from the SourceControl (to see if any new database changes need to be applied).
Any ideas how I can achieve this? I know that this information is written into the log xml but I was wondering if there is an easy mechanism to get a reference to this from with an Ant builder.
I have investigated writing a custom CC Listener or Builder plugin but neither supply this in the interface.
We have "svn update" as one of the steps in ant builder, and later we use output redirected to the file (ant property also could be used):
<exec executable="svn" dir=".">
<arg line="up"/>
<redirector output="svnup.log" alwayslog="true" append="true"/>
</exec>
<property name="svnup.log" value="svnup.log"/>
this creates file named "svnup.log" in the build folder with output of "svn up" command.
I think I'm going to try to write a custom plugin implementing Publisher
#Override
public void publish(Element cruisecontrolLog) throws CruiseControlException { XMLLogHelper xmlHelper = new XMLLogHelper(cruisecontrolLog);
Set<Modification> modifications = xmlHelper.getModifications();
for (Modification modification : modifications) {
handleModification(modification);
}
}
Or another idea is to use the timestamp flag in the sscm ant task combined with the cclastbuildtimestamp property supplied to the ant builder to produce a list of files changed since last build.

Resources