org.kie.api.event.rule.AgendaEventListener Java Examples

The following examples show how to use org.kie.api.event.rule.AgendaEventListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InjectionHelper.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
private static void wireListeners(BeanCreator beanCreator, BeanCreator fallbackBeanCreator, ClassLoader cl, List<ListenerModel> listenerModels, KieRuntimeEventManager kRuntimeEventManager) {
	for (ListenerModel listenerModel : listenerModels) {
        Object listener = createListener( beanCreator, fallbackBeanCreator, cl, listenerModel );
        switch(listenerModel.getKind()) {
            case AGENDA_EVENT_LISTENER:
                kRuntimeEventManager.addEventListener((AgendaEventListener)listener);
                break;
            case RULE_RUNTIME_EVENT_LISTENER:
                kRuntimeEventManager.addEventListener((RuleRuntimeEventListener)listener);
                break;
            case PROCESS_EVENT_LISTENER:
                kRuntimeEventManager.addEventListener((ProcessEventListener)listener);
                break;
        }
    }
}
 
Example #2
Source File: StatelessKnowledgeSessionImpl.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
private void registerListeners( StatefulKnowledgeSessionImpl wm ) {
    if ( listeners.isEmpty()) {
        return;
    }
    for (ListnerHolder listnerHolder : listeners ) {
        switch (listnerHolder.type) {
            case AGENDA:
                wm.addEventListener( (AgendaEventListener)listnerHolder.listener );
                break;
            case RUNTIME:
                wm.addEventListener( (RuleRuntimeEventListener)listnerHolder.listener );
                break;
            case PROCESS:
                wm.addEventListener( (ProcessEventListener)listnerHolder.listener );
                break;
        }
    }
}
 
Example #3
Source File: RuleConfigGenerator.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
private MethodDeclaration generateMergeEventListenerConfigMethod() {
    BlockStmt body = new BlockStmt().addStatement(new ReturnStmt(newObject(CachedRuleEventListenerConfig.class,
            callMerge(
                    VAR_RULE_EVENT_LISTENER_CONFIGS,
                    RuleEventListenerConfig.class, "agendaListeners",
                    VAR_AGENDA_EVENT_LISTENERS
            ),
            callMerge(
                    VAR_RULE_EVENT_LISTENER_CONFIGS,
                    RuleEventListenerConfig.class, "ruleRuntimeListeners",
                    VAR_RULE_RUNTIME_EVENT_LISTENERS
            )
    )));

    return method(Modifier.Keyword.PRIVATE, RuleEventListenerConfig.class, METHOD_MERGE_RULE_EVENT_LISTENER_CONFIG,
            NodeList.nodeList(
                    new Parameter().setType(genericType(Collection.class, RuleEventListenerConfig.class)).setName(VAR_RULE_EVENT_LISTENER_CONFIGS),
                    new Parameter().setType(genericType(Collection.class, AgendaEventListener.class)).setName(VAR_AGENDA_EVENT_LISTENERS),
                    new Parameter().setType(genericType(Collection.class, RuleRuntimeEventListener.class)).setName(VAR_RULE_RUNTIME_EVENT_LISTENERS)
            ),
            body);
}
 
Example #4
Source File: KieLoggersTest.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
@Test
public void testKieConsoleLoggerStateless() throws Exception {
    String drl = "package org.drools.integrationtests\n" + 
            "import org.drools.compiler.Message;\n" +
            "rule \"Hello World\"\n" + 
            "    when\n" + 
            "        m : Message( myMessage : message )\n" + 
            "    then\n" + 
            "end";
    // get the resource
    Resource dt = ResourceFactory.newByteArrayResource( drl.getBytes() ).setTargetPath("org/drools/integrationtests/hello.drl");
    
    // create the builder
    StatelessKieSession ksession = getStatelessKieSession(dt);
    KieRuntimeLogger logger = KieServices.Factory.get().getLoggers().newConsoleLogger( ksession );

    AgendaEventListener ael = mock( AgendaEventListener.class );
    ksession.addEventListener( ael );
    
    ksession.execute( new Message("Hello World") );
    
    verify( ael ).afterMatchFired( any(AfterMatchFiredEvent.class) );
    
    logger.close();
}
 
Example #5
Source File: RuleConfigGenerator.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public List<BodyDeclaration<?>> members() {

        if (annotator != null) {
            FieldDeclaration relcFieldDeclaration = annotator.withOptionalInjection(new FieldDeclaration().addVariable(new VariableDeclarator(genericType(annotator.multiInstanceInjectionType(), RuleEventListenerConfig.class), VAR_RULE_EVENT_LISTENER_CONFIGS)));
            members.add(relcFieldDeclaration);

            FieldDeclaration aelFieldDeclaration = annotator.withOptionalInjection(new FieldDeclaration().addVariable(new VariableDeclarator(genericType(annotator.multiInstanceInjectionType(), AgendaEventListener.class), VAR_AGENDA_EVENT_LISTENERS)));
            members.add(aelFieldDeclaration);

            FieldDeclaration rrelFieldDeclaration = annotator.withOptionalInjection(new FieldDeclaration().addVariable(new VariableDeclarator(genericType(annotator.multiInstanceInjectionType(), RuleRuntimeEventListener.class), VAR_RULE_RUNTIME_EVENT_LISTENERS)));
            members.add(rrelFieldDeclaration);

            members.add(generateExtractEventListenerConfigMethod());
            members.add(generateMergeEventListenerConfigMethod());
        } else {
            FieldDeclaration defaultRelcFieldDeclaration = new FieldDeclaration()
                    .setModifiers(Modifier.Keyword.PRIVATE)
                    .addVariable(new VariableDeclarator(new ClassOrInterfaceType(null, RuleEventListenerConfig.class.getCanonicalName()), VAR_DEFAULT_RULE_EVENT_LISTENER_CONFIG, newObject(DefaultRuleEventListenerConfig.class)));
            members.add(defaultRelcFieldDeclaration);
        }

        return members;
    }
 
Example #6
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireAfterRuleFlowGroupActivated(
        final RuleFlowGroup ruleFlowGroup,
        final InternalWorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    RuleFlowGroupActivatedEventImpl event = new RuleFlowGroupActivatedEventImpl(ruleFlowGroup, getKRuntime(workingMemory));

    if (iter.hasNext()) {
       
        do {
            iter.next().afterRuleFlowGroupActivated(event);
        } while (iter.hasNext());
    }
}
 
Example #7
Source File: DynamicRulesTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testJBRULES_2206() {
    KieBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
    ((RuleBaseConfiguration) config).setRuleBaseUpdateHandler( null );
    InternalKnowledgeBase kbase = (InternalKnowledgeBase) getKnowledgeBase( config );
    KieSession session = createKnowledgeSession( kbase );

    AgendaEventListener ael = mock( AgendaEventListener.class );
    session.addEventListener( ael );

    for ( int i = 0; i < 5; i++ ) {
        session.insert( new Cheese() );
    }

    kbase.addPackages( loadKnowledgePackages( "test_JBRULES_2206_1.drl" ));
    ((InternalAgenda) session.getAgenda()).evaluateEagerList();

    // two matching rules were added, so 2 activations should have been created 
    verify( ael, times( 2 ) ).matchCreated(any(MatchCreatedEvent.class));
    int fireCount = session.fireAllRules();
    // both should have fired
    assertEquals( 2, fireCount );

    kbase.addPackages( loadKnowledgePackages( "test_JBRULES_2206_2.drl" ));
    ((InternalAgenda) session.getAgenda()).evaluateEagerList();

    // one rule was overridden and should activate 
    verify( ael, times( 3 ) ).matchCreated(any(MatchCreatedEvent.class));
    fireCount = session.fireAllRules();
    // that rule should fire again
    assertEquals( 1, fireCount );

    session.dispose();
}
 
Example #8
Source File: PseudoClockEventsTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testEvenFirePseudoClockRuleA() throws Exception {

    AgendaEventListener ael = mock(AgendaEventListener.class);

    processStocks(evalFirePseudoClockStockCount, ael,
                  evalFirePseudoClockDeclaration + evalFirePseudoClockRuleA);

    verify(ael,
           times(evalFirePseudoClockStockCount * (evalFirePseudoClockStockCount - 1) / 2)).afterMatchFired(
            any(AfterMatchFiredEvent.class));
}
 
Example #9
Source File: PseudoClockEventsTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testEvenFirePseudoClockRuleB() throws Exception {

    AgendaEventListener ael = mock(AgendaEventListener.class);

    processStocks(evalFirePseudoClockStockCount, ael,
                  evalFirePseudoClockDeclaration + evalFirePseudoClockRuleB);

    verify(ael,
           times(evalFirePseudoClockStockCount - 1)).afterMatchFired(
            any(AfterMatchFiredEvent.class));
}
 
Example #10
Source File: PseudoClockEventsTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testEvenFirePseudoClockRulesAB() throws Exception {

    AgendaEventListener ael = mock(AgendaEventListener.class);

    processStocks(evalFirePseudoClockStockCount, ael,
                  evalFirePseudoClockDeclaration + evalFirePseudoClockRuleA + evalFirePseudoClockRuleB);

    final int expectedActivationCount = evalFirePseudoClockStockCount * (evalFirePseudoClockStockCount - 1) / 2
                                        + evalFirePseudoClockStockCount - 1;
    verify(ael,
           times(expectedActivationCount)).afterMatchFired(
            any(AfterMatchFiredEvent.class));
}
 
Example #11
Source File: PseudoClockEventsTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
private int processStocks(int stockCount, AgendaEventListener agendaEventListener, String drlContentString)
        throws Exception {
    KieBaseConfiguration kconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
    kconf.setOption(EventProcessingOption.STREAM);
    KieBase kbase = loadKnowledgeBaseFromString(kconf, drlContentString);

    KieSessionConfiguration ksessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
    ksessionConfig.setOption(ClockTypeOption.get("pseudo"));
    ksessionConfig.setProperty("keep.reference", "true");
    final KieSession ksession = kbase.newKieSession(ksessionConfig, null);
    ksession.addEventListener(agendaEventListener);

    PseudoClockScheduler clock = (PseudoClockScheduler) ksession.<SessionClock>getSessionClock();

    Thread fireUntilHaltThread = new Thread(ksession::fireUntilHalt, "Engine's thread");
    fireUntilHaltThread.start();
    try {
        Thread.currentThread().setName("Feeding thread");

        for (int stIndex = 1; stIndex <= stockCount; stIndex++) {
            clock.advanceTime(20, TimeUnit.SECONDS);
            Thread.sleep( 100 );
            final StockTickInterface st = new StockTick(stIndex,
                                                        "RHT",
                                                        100 * stIndex,
                                                        100 * stIndex);
            ksession.insert(st);
            Thread.sleep( 100 );
        }

        Thread.sleep(100);
    } finally {
        ksession.halt();
        ksession.dispose();
    }
    
    fireUntilHaltThread.join(5000);

    return stockCount;
}
 
Example #12
Source File: ActivationIteratorTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testEagerEvaluation() throws Exception {
    String str =
            "package org.simple \n" +
            "rule xxx @Propagation(EAGER) \n" +
            "when \n" +
            "  $s : String()\n" +
            "then \n" +
            "end  \n" +
            "rule yyy @Propagation(EAGER) \n" +
            "when \n" +
            "  $s : String()\n" +
            "then \n" +
            "end  \n";

    KieSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
    conf.setOption( ForceEagerActivationOption.YES );

    KieBase kbase = loadKnowledgeBaseFromString(str);
    KieSession ksession = createKnowledgeSession(kbase, conf);

    final List list = new ArrayList();

    AgendaEventListener agendaEventListener = new DefaultAgendaEventListener() {
        public void matchCreated(org.kie.api.event.rule.MatchCreatedEvent event) {
            list.add("activated");
        }
    };
    ksession.addEventListener(agendaEventListener);

    ksession.insert("test");

    assertEquals(2, list.size());
}
 
Example #13
Source File: FirstOrderLogicTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testOrWithVariableResolution2() throws Exception {
    //        KieBase kbase = loadKnowledgeBase( "test_OrCEFollowedByMultipleEval.drl");
    //        KieSession workingMemory = createKnowledgeSession(kbase);

    final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add( ResourceFactory.newClassPathResource( "test_OrCEFollowedByMultipleEval2.drl",
                                                        FirstOrderLogicTest.class ),
                  ResourceType.DRL );

    assertFalse(kbuilder.hasErrors(), kbuilder.getErrors().toString());

    final InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
    kbase.addPackages( kbuilder.getKnowledgePackages() );

    final KieSession ksession = createKnowledgeSession(kbase);

    final AgendaEventListener al = mock( AgendaEventListener.class );
    ksession.addEventListener( al );

    ksession.insert( new FactA( "a" ) );
    ksession.insert( new FactB( "b" ) );
    ksession.insert( new FactC( "c" ) );

    ksession.fireAllRules();
    verify( al,
            times( 8 ) ).afterMatchFired(any(AfterMatchFiredEvent.class));
}
 
Example #14
Source File: FirstOrderLogicTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
    public void testOrWithVariableResolution() throws Exception {
//        KieBase kbase = loadKnowledgeBase( "test_OrCEFollowedByMultipleEval.drl");
//        KieSession workingMemory = createKnowledgeSession(kbase);

        final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add( ResourceFactory.newClassPathResource( "test_OrCEFollowedByMultipleEval.drl",
                                                            FirstOrderLogicTest.class ),
                      ResourceType.DRL );

        assertFalse(kbuilder.hasErrors(), kbuilder.getErrors().toString());

        final InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addPackages( kbuilder.getKnowledgePackages() );

        final KieSession ksession = createKnowledgeSession(kbase);

        final AgendaEventListener al = mock( AgendaEventListener.class );
        ksession.addEventListener( al );

        ksession.insert( new FactA( "a" ) );
        ksession.insert( new FactB( "b" ) );
        ksession.insert( new FactC( "c" ) );

        ksession.fireAllRules();
        verify( al,
                times( 6 ) ).afterMatchFired(any(AfterMatchFiredEvent.class));
    }
 
Example #15
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireAfterRuleFlowGroupDeactivated(
        final RuleFlowGroup ruleFlowGroup,
        final InternalWorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    RuleFlowGroupDeactivatedEventImpl event = new RuleFlowGroupDeactivatedEventImpl(ruleFlowGroup, getKRuntime(workingMemory));

    if (iter.hasNext()) {
         
        do {
            iter.next().afterRuleFlowGroupDeactivated(event);
        } while (iter.hasNext());
    }
}
 
Example #16
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireBeforeRuleFlowGroupDeactivated(
        final RuleFlowGroup ruleFlowGroup,
        final InternalWorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    RuleFlowGroupDeactivatedEventImpl event = new RuleFlowGroupDeactivatedEventImpl(ruleFlowGroup, getKRuntime(workingMemory));

    if (iter.hasNext()) {
        
        do {
            iter.next().beforeRuleFlowGroupDeactivated(event);
        } while (iter.hasNext());
    }
}
 
Example #17
Source File: GetAgendaEventListenersCommand.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public Collection<AgendaEventListener> execute(Context context) {
    KieSession ksession = ((RegistryContext) context).lookup( KieSession.class );
    final Collection<AgendaEventListener> agendaEventListeners = ksession.getAgendaEventListeners();

    if ( this.outIdentifier != null ) {
        ((RegistryContext) context).lookup( ExecutionResultImpl.class ).setResult(this.outIdentifier,
                                                                                  agendaEventListeners);
    }

    return agendaEventListeners;
}
 
Example #18
Source File: WorkingMemoryLogger.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new working memory logger for the given working memory.
 * 
 * @param workingMemory
 */
public WorkingMemoryLogger(final WorkingMemory workingMemory) {
    workingMemory.addEventListener( (RuleRuntimeEventListener) this );
    workingMemory.addEventListener( (AgendaEventListener) this );
    setProcessRuntimeEventListener( (InternalWorkingMemory) workingMemory );
    workingMemory.addEventListener( (KieBaseEventListener) this );
}
 
Example #19
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireActivationCreated(final Activation activation,
                                  final WorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();

    MatchCreatedEvent event = new ActivationCreatedEventImpl(activation, getKRuntime(workingMemory));
    if (iter.hasNext()) {

        do{
            iter.next().matchCreated(event);
        }  while (iter.hasNext());
    }
}
 
Example #20
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireActivationCancelled(final Activation activation,
                                    final WorkingMemory workingMemory,
                                    final MatchCancelledCause cause) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    MatchCancelledEvent event = new ActivationCancelledEventImpl(activation, getKRuntime(workingMemory), cause);

    if (iter.hasNext()) {
        
        do{
            iter.next().matchCancelled(event);
        }  while (iter.hasNext());
    }
}
 
Example #21
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public BeforeMatchFiredEvent fireBeforeActivationFired(final Activation activation,
                                      final WorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    BeforeMatchFiredEvent event = new BeforeActivationFiredEventImpl(activation, getKRuntime(workingMemory));

    if (iter.hasNext()) {
        
        do{
            iter.next().beforeMatchFired(event);
        }  while (iter.hasNext());
    }
    
    return event;
}
 
Example #22
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireAfterActivationFired(final Activation activation,
                                     final InternalWorkingMemory workingMemory, 
                                     BeforeMatchFiredEvent beforeMatchFiredEvent) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    AfterMatchFiredEvent event = new AfterActivationFiredEventImpl(activation, getKRuntime(workingMemory), beforeMatchFiredEvent);

    if (iter.hasNext()) {
        
        do{
            iter.next().afterMatchFired(event);
        }  while (iter.hasNext());
    }
}
 
Example #23
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireAgendaGroupPopped(final AgendaGroup agendaGroup,
                                  final InternalWorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    AgendaGroupPoppedEventImpl event = new AgendaGroupPoppedEventImpl(agendaGroup, getKRuntime(workingMemory));

    if (iter.hasNext()) {
        
        do{
            iter.next().agendaGroupPopped(event);
        }  while (iter.hasNext());
    }
}
 
Example #24
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireAgendaGroupPushed(final AgendaGroup agendaGroup,
                                  final InternalWorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    AgendaGroupPushedEventImpl event = new AgendaGroupPushedEventImpl(agendaGroup, getKRuntime(workingMemory));

    if (iter.hasNext()) {
        
        do{
            iter.next().agendaGroupPushed(event);
        }  while (iter.hasNext());
    }
}
 
Example #25
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireBeforeRuleFlowGroupActivated(
        final RuleFlowGroup ruleFlowGroup,
        final InternalWorkingMemory workingMemory) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    RuleFlowGroupActivatedEventImpl event = new RuleFlowGroupActivatedEventImpl(ruleFlowGroup, getKRuntime(workingMemory));

    if (iter.hasNext()) {
        
        do {
            iter.next().beforeRuleFlowGroupActivated(event);
        } while (iter.hasNext());
    }
}
 
Example #26
Source File: ActivationIteratorTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testFilteredEagerEvaluation() throws Exception {
    String str =
            "package org.simple \n" +
            "rule xxx @Propagation(EAGER) \n" +
            "when \n" +
            "  $s : String()\n" +
            "then \n" +
            "end  \n" +
            "rule yyy @Propagation(EAGER) \n" +
            "when \n" +
            "  $s : String()\n" +
            "then \n" +
            "end  \n";

    KieSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
    conf.setOption( new ForceEagerActivationOption.FILTERED( new ForceEagerActivationFilter() {
        @Override
        public boolean accept(Rule rule) {
            return rule.getName().equals("xxx");
        }
    }));

    KieBase kbase = loadKnowledgeBaseFromString(str);
    KieSession ksession = createKnowledgeSession(kbase, conf);

    final List list = new ArrayList();

    AgendaEventListener agendaEventListener = new DefaultAgendaEventListener() {
        public void matchCreated(org.kie.api.event.rule.MatchCreatedEvent event) {
            list.add("activated");
        }
    };
    ksession.addEventListener(agendaEventListener);

    ksession.insert("test");
    ((InternalWorkingMemory) ksession).flushPropagations();

    assertEquals(1, list.size());
}
 
Example #27
Source File: StatelessKnowledgeSessionImpl.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public Collection<AgendaEventListener> getAgendaEventListeners() {
    return (Collection<AgendaEventListener>) getListeners(ListnerHolder.Type.AGENDA);
}
 
Example #28
Source File: StatefulKnowledgeSessionImpl.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void addEventListener(final AgendaEventListener listener) {
    this.agendaEventSupport.addEventListener( listener );
}
 
Example #29
Source File: StatefulKnowledgeSessionImpl.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public Collection<AgendaEventListener> getAgendaEventListeners() {
    return Collections.unmodifiableCollection(this.agendaEventSupport.getEventListeners());
}
 
Example #30
Source File: StatefulKnowledgeSessionImpl.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void removeEventListener(final AgendaEventListener listener) {
    this.agendaEventSupport.removeEventListener( listener );
}