Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External Groovy Scripts For Dao Events #51

Closed
basejump opened this issue Nov 30, 2017 · 7 comments · Fixed by #93, #131 or #135
Closed

External Groovy Scripts For Dao Events #51

basejump opened this issue Nov 30, 2017 · 7 comments · Fixed by #93, #131 or #135
Assignees

Comments

@basejump
Copy link
Member

basejump commented Nov 30, 2017

We want to be able to have external groovy scripts to run custom business logic during the dao events. For example, at one customer we do special customer.num generation before a new customer object is saved.

this plugin should detect an external scripts executor plugin.
we should have a contract on how the scripts are called. Either we have the script return an object implementing a trait or interface and then it can get registerd, or we have the script run and register a listener using the grails 3.3 events.

see the end of this as an example. https://github.com/Netflix/asgard/blob/master/grails-app/conf/spring/resources.groovy
we could setup reloadable groovy beans.

see https://docs.spring.io/spring/docs/current/spring-framework-reference/languages.html#groovy and http://mrhaki.blogspot.com/2013/03/grails-goodness-use-constructor.html

@snimavat
Copy link
Contributor

snimavat commented Dec 1, 2017

We can do the similar thing as asgard example above, register groovy beans from scripts.
The beans can subscribe to events. Dao will need to fire events using grails event mechanism (We currently dont do that)

@snimavat
Copy link
Contributor

snimavat commented Dec 5, 2017

Example in benchmarks project

@basejump
Copy link
Member Author

Add instructions for how we are doing this for events to the docs.

basejump added a commit that referenced this issue Dec 15, 2017
#51 Add docs for external event listeners
@basejump
Copy link
Member Author

basejump commented Dec 15, 2017

@snimavat Example doesn't look right. Good example for how to add listeners but not for refreshable beans

@basejump basejump reopened this Dec 15, 2017
snimavat added a commit that referenced this issue Jan 5, 2018
basejump pushed a commit that referenced this issue Jan 5, 2018
* #51 Add docs for refreshable beans

* update docs
@basejump basejump reopened this Jan 5, 2018
@basejump
Copy link
Member Author

basejump commented Jan 5, 2018

@snimavat clear example of setting up events listeners in the refreshable beans, @eventlistener won't work. I think it should be referenced and pointed to from docs on events. basically, doc what we are doing in the benchmarks with CitySpringEventsRefreshable and CityRefreshableBeanSubscriber (<- if that still relevant)

@basejump
Copy link
Member Author

basejump commented Jan 5, 2018

also, both Defining refreshable beans using Spring dynamic language support. and Using external groovy beans as event listeners. should be under the same section External refreshable beans for Events. try to shorten the titles a bit too so they don't wrap on the TOC to the right

snimavat added a commit that referenced this issue Jan 11, 2018
@snimavat
Copy link
Contributor

snimavat commented Jan 11, 2018

@basejump does the docs look good now ? 6a304a6

basejump pushed a commit that referenced this issue Jan 16, 2018
* #51 update docs

* Update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants