<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Art Of Creation - Dynamics AX Blog &#187; Batch</title>
	<atom:link href="http://www.artofcreation.be/tag/batch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.artofcreation.be</link>
	<description>The everyday life of a Dynamics AX developer</description>
	<lastBuildDate>Fri, 23 Jul 2010 16:29:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Run AIF inbound and outbound manually</title>
		<link>http://www.artofcreation.be/2010/02/17/run-aif-inbound-and-outbound-manually/</link>
		<comments>http://www.artofcreation.be/2010/02/17/run-aif-inbound-and-outbound-manually/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 17:51:53 +0000</pubDate>
		<dc:creator>Klaas Deforche</dc:creator>
				<category><![CDATA[AIF]]></category>
		<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[Job]]></category>

		<guid isPermaLink="false">http://www.artofcreation.be/?p=485</guid>
		<description><![CDATA[To have AIF import and export message, you have to have 4 batch tasks running (all about it here on TechNet). However, when developing, it is inefficient (and also tad tedious) to wait for those batches. Here are two jobs to run inbound and outbound messages manually, so you don&#8217;t have to wait for the [...]]]></description>
			<content:encoded><![CDATA[<p>To have AIF import and export message, you have to have 4 batch tasks running (<a href="http://technet.microsoft.com/en-us/library/aa570105.aspx">all about it here on TechNet</a>). However, when developing, it is inefficient (and also tad tedious) to wait for those batches.</p>
<p>Here are two jobs to run inbound and outbound messages manually, so you don&#8217;t have to wait for the batches to pick them up.</p>
<p>Inbound:</p>
<div class="codecolorer-container xpp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> KlForrunAIFInbound<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; ;<br />
&nbsp; &nbsp; <span style="color: #007f00;">// read the messages</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">new</span> AifGateWayReceiveService<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">run</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #007f00;">// process the messages in queue</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">new</span> AifInboundProcessingService<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">run</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;done&quot;</span><span style="color: #000000;">&#41;</span>;<br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Outbound:</p>
<div class="codecolorer-container xpp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> KlForrunAIFOutbound<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; ;<br />
&nbsp; &nbsp; <span style="color: #007f00;">// process messages in queue</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">new</span> AifOutboundProcessingService<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">run</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #007f00;">// send messages</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">new</span> AifGateWaySendService<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">run</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;done&quot;</span><span style="color: #000000;">&#41;</span>;<br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Ofcourse, you can put this code in classes, or combine them so they are executed together. Because inbound messages can trigger outbound messages, it&#8217;s better to process the inbound messages before the outbound messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.artofcreation.be/2010/02/17/run-aif-inbound-and-outbound-manually/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing in the event log from Dynamics AX</title>
		<link>http://www.artofcreation.be/2009/06/19/writing-in-the-event-log-from-dynamics-ax/</link>
		<comments>http://www.artofcreation.be/2009/06/19/writing-in-the-event-log-from-dynamics-ax/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 11:14:55 +0000</pubDate>
		<dc:creator>Klaas Deforche</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[Event Log]]></category>
		<category><![CDATA[System.Diagnostics]]></category>

		<guid isPermaLink="false">http://www.artofcreation.be/?p=125</guid>
		<description><![CDATA[Writing to the event log in Windows using AX is very easy when you use the EventLog class from the System.Diagnostics namespace. The following job demonstrates how to use the EventLog class. static void EventViewer&#40;Args _args&#41; &#123; &#160; &#160; System.Diagnostics.EventLog eventlog; &#160; &#160; #Define.LogSource&#40;&#34;Dynamics AX&#34;&#41; &#160; &#160; #Define.LogName&#40;&#34;Dynamics AX Log&#34;&#41; &#160; &#160; &#160; &#160; ; [...]]]></description>
			<content:encoded><![CDATA[<p>Writing to the event log in Windows using AX is very easy when you use the EventLog class from the System.Diagnostics namespace. The following job demonstrates how to use the EventLog class.</p>
<div class="codecolorer-container xpp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> EventViewer<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; System.<span style="color: #000000;">Diagnostics</span>.<span style="color: #000000;">EventLog</span> eventlog;<br />
&nbsp; &nbsp; #Define.<span style="color: #000000;">LogSource</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Dynamics AX&quot;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; #Define.<span style="color: #000000;">LogName</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Dynamics AX Log&quot;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; ;<br />
&nbsp; &nbsp; <span style="color: #007f00;">// check if the log already exists</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">if</span><span style="color: #000000;">&#40;</span><span style="color: #00007f;">!</span>System.<span style="color: #000000;">Diagnostics</span>.<span style="color: #000000;">EventLog</span><span style="color: #00007f;">::</span><span style="color: #000000;">SourceExists</span><span style="color: #000000;">&#40;</span>#LogSource<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007f00;">// create new log</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; System.<span style="color: #000000;">Diagnostics</span>.<span style="color: #000000;">EventLog</span><span style="color: #00007f;">::</span><span style="color: #000000;">CreateEventSource</span><span style="color: #000000;">&#40;</span>#LogSource<span style="color: #00007f;">,</span> #LogName<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; eventlog <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> System.<span style="color: #000000;">Diagnostics</span>.<span style="color: #000000;">EventLog</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; eventlog.<span style="color: #000000;">set_Source</span><span style="color: #000000;">&#40;</span>#LogSource<span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #007f00;">// write info entry</span><br />
&nbsp; &nbsp; eventlog.<span style="color: #000000;">WriteEntry</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Just writing in the event viewer.&quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #007f00;">// write error entry</span><br />
&nbsp; &nbsp; eventlog.<span style="color: #000000;">WriteEntry</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Error! Please check the stack trace below. <span style="color: #000000;">\n</span><span style="color: #000000;">\n</span>&quot;</span> <span style="color: #00007f;">+</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; con2str<span style="color: #000000;">&#40;</span>xSession<span style="color: #00007f;">::</span><span style="color: #000000;">xppCallStack</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #00007f;">,</span> System.<span style="color: #000000;">Diagnostics</span>.<span style="color: #000000;">EventLogEntryType</span><span style="color: #00007f;">::</span><span style="color: #000000;">Error</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #007f00;">// write warning entry</span><br />
&nbsp; &nbsp; eventlog.<span style="color: #000000;">WriteEntry</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Job finished.&quot;</span> <span style="color: #00007f;">,</span> System.<span style="color: #000000;">Diagnostics</span>.<span style="color: #000000;">EventLogEntryType</span><span style="color: #00007f;">::</span><span style="color: #000000;">Warning</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Check the event viewer!&quot;</span><span style="color: #000000;">&#41;</span>;<br />
<span style="color: #000000;">&#125;</span></div></div>
<p>A possible use for this is when monitoring batch jobs.<br />
Tested using AX 2009, XP Pro. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.artofcreation.be/2009/06/19/writing-in-the-event-log-from-dynamics-ax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
