daily pastebin goal
79%
SHARE
TWEET

Untitled

a guest Nov 17th, 2018 63 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. rule "One"
  2.     when
  3.         m : Message( status == Message.HELLO, myMessage : message )
  4.     then
  5.         System.out.println( myMessage );
  6.         m.setMessage( "Goodbye cruel world" );
  7.         m.setStatus( Message.GOODBYE );
  8.         update( m );
  9. end
  10.  
  11. rule "Two"
  12.     when
  13.         Message( status == Message.GOODBYE, myMessage : message )
  14.     then
  15.         System.out.println( myMessage );
  16. end
  17.  
  18.  
  19. KieServices ks = KieServices.Factory.get();
  20. KieContainer kContainer = ks.getKieClasspathContainer();
  21. KieSession kSession = kContainer.newKieSession("ksession-rules");
  22.  
  23. Message message = new Message();
  24. message.setMessage("Hello World");
  25. message.setStatus(Message.HELLO);    
  26. kSession.insert(message);    
  27. int rulesFired = kSession.fireAllRules();
  28.    
  29. rule "One"
  30.   ruleflow-group "dog"
  31.     when
  32.         m : Message( status == Message.HELLO, myMessage : message )
  33.     then
  34.         System.out.println( myMessage );
  35.         m.setMessage( "Goodbye cruel world" );
  36.         m.setStatus( Message.GOODBYE );
  37.         update( m );
  38. end
  39.  
  40. rule "Two"
  41.   ruleflow-group "dog"
  42.     when
  43.         Message( status == Message.GOODBYE, myMessage : message )
  44.     then
  45.         System.out.println( myMessage );
  46. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top