Note: This e-mail is subject to the disclaimer contained at the bottom of this message.

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.
I'm initialising the session like this:
SessionConfiguration sessionConfiguration = new SessionConfiguration();
sessionConfiguration.setClockType( ClockType.PSEUDO_CLOCK );
StatelessKnowledgeSession session = _testKnowledgeBase.newStatelessKnowledgeSession(sessionConfiguration);
The only thing I could think of to set the pseudo clock was to write a command something like:
private static class SetPseudoClockCommand implements org.drools.process.command.Command<Boolean> {
public Boolean execute(ReteooWorkingMemory session) {
// Set the clock to the current date
pseudoSessionClock.advanceTime(new DateTime().getMillis(), TimeUnit.MILLISECONDS);
// Add a couple of days
pseudoSessionClock.advanceTime(2, TimeUnit.DAYS);
return true;
But this doesn't appear to take any effect whilst rules are running.
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?

The information transmitted in this message and its attachments (if any) is intended only for the person or entity to which it is addressed.

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.

If you have received this in error, please contact the sender and delete this e-mail and associated material from any computer.

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.

This message has been scanned for viruses with Symantec Scan Engine and cleared by MailMarshal.