Menu

DataSourceListener

Help
2019-12-09
2020-02-12
  • Liam O'Toole

    Liam O'Toole - 2019-12-09

    In the Web Services Usage and Customization Guide, Section 5.7, it states:

    Users can add their own listener implementing org.openl.rules.ruleservice.loader.DataSourceListener for additional control of data source modifications with the required behavior and register it in datasource.

    How does one do that? Where is the new listener registered?

     
  • Marat Kamalov

    Marat Kamalov - 2020-02-12

    Hi,

    This document contains information for developers and this interface for listener is designed for implementing a new type of Production Repository.

    What are you want to do?

    Thanks, Marat Kamalov.

     
  • Liam O'Toole

    Liam O'Toole - 2020-02-12

    I want to send a notification to an external program when data is modified. A DataSourceListener seemed the obvious place to do that.

     
  • Marat Kamalov

    Marat Kamalov - 2020-02-12

    You can look at org.openl.rules.ruleservice.publish.RuleServicePublisherListener interface.

     
  • Marat Kamalov

    Marat Kamalov - 2020-02-12

    How to use: Just register a bean in Spring context that implements RuleServicePublisherListener interface,

     
  • Marat Kamalov

    Marat Kamalov - 2020-02-12

    FYI, it is a listener that fires when services are updated in ruleservice. Use it when you want to nofify third application that service is updated.

    If you want to fire a listener when database is changed but ruleservices are not updated (because deployments are ignored by configuration) then RuleServicePublisherListener is not fired.

    Also, RuleServicePublisherListener fires only after service is updated if DB is changed. But DataSourceListener fires when DB is update but service can be not updated yet.

    BTW, I don't recomend look at DataSourceListener because it is internal API and can be changed someday and you don't have an easy way to use it. But, If you can't use RuleServicePublisherListener you can wrap org.openl.rules.ruleservice.management.ServiceManagerImpl#onDeploymentAdded via Spring AOP.

     

Log in to post a comment.