<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Times New Roman, serif" size="2">
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT size=1>Note: This 
e-mail is subject to the disclaimer contained at the bottom of this 
message.<O:P></O:P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT size=1>
<HR>
<O:P></O:P></FONT></SPAN>
<P></P>

<div style="margin-top: 5pt; margin-bottom: 5pt; ">I'm wanting to use the date-effective and date-expiry rule metadata to add date specific rule variants within my app. To test these I was planning on using the pseudo clock and setting the expected date prior
to executing the rules within a StatelessKnowledgeSession. I can set the clock easily enough, but can't understand why the getSessionClock() method is missing? It's on the StatefulKnowledgeSession, but not on the Stateless. </div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">I'm initialising the session like this:<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">SessionConfiguration sessionConfiguration = new SessionConfiguration();<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">sessionConfiguration.setClockType( ClockType.PSEUDO_CLOCK );<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">StatelessKnowledgeSession session = _testKnowledgeBase.newStatelessKnowledgeSession(sessionConfiguration); </div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">The only thing I could think of to set the pseudo clock was to write a command something like:<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">private static class SetPseudoClockCommand implements org.drools.process.command.Command&lt;Boolean&gt; {<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">public Boolean execute(ReteooWorkingMemory session) {<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">// Set the clock to the current date<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">pseudoSessionClock.advanceTime(new DateTime().getMillis(), TimeUnit.MILLISECONDS);<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">// Add a couple of days<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">pseudoSessionClock.advanceTime(2, TimeUnit.DAYS); </div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">return true;<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">}<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">}<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">But this doesn't appear to take any effect whilst rules are running.<font size="3"> </font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">Is there another way to get programmatic access to the session clock, or some better way of changing the underlying date prior to rule execution? </div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">Ben. </div>
<div>&nbsp;</div>
<div><font face="Arial, sans-serif">&nbsp;</font></div>
</font>

<SPAN style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial">
<HR>

<P></P></FONT></O:P></SPAN>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1>The information transmitted in this message and its attachments (if any) 
is intended only for the person or entity to which it is 
addressed.<O:P></O:P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1>The message may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in reliance upon this information, by persons or entities other than the 
intended recipient is prohibited.<O:P></O:P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><O:P><FONT 
size=1></FONT></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1>If you have received this in error, please contact the sender and delete 
this e-mail and associated material from any 
computer.<O:P></O:P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><O:P><FONT 
size=1></FONT></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1>The intended recipient of this e-mail may only use, reproduce, disclose 
or distribute the information contained in this e-mail and any attached files, 
with the permission of the sender.<O:P></O:P></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><O:P><FONT 
size=1></FONT></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1>This message has been scanned for viruses with Symantec Scan Engine and 
cleared by MailMarshal.</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" 
align=left><SPAN style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT 
size=1><O:P></O:P></FONT></SPAN></P><SPAN 
style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Arial"><FONT size=1>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify" align=left>
<HR>

<P></P><O:P></O:P></FONT></SPAN>
</body>
</html>