Comments (2)
It is not working because you are not providing any implementation for notificationTrigger
. See AbstractEventBus.groovy#L128. The afterCommit
is correctly triggered but does nothing apart from adding a synchronization.
In the above sample application, it is adding synchronization later in the stage when notify("myEventTag${num}", Instant.now())
is called from the transaction after commit is trigger and notificationTrigger.run()
is never executed. I think you can directly call the following instead of registering TransactionSynchronizationAdaptor as:
@Transactional(propagation = Propagation.REQUIRES_NEW)
void doSomething() {
String random = RandomStringUtils.random(20, true, false)
log.info('Saving a new SomeDomain: '+ random)
new SomeDomain(text: random).save()
notify(Event.from("myEventTag1", Instant.now()), TransactionPhase.AFTER_COMMIT)
}
It works when you call notify
in a Promise
because TransactionSynchronizationManager.synchronizations.get
is null in the new thread and the other branch of notify(Event)
method is called here
from grails-async.
thanks @puneetbehl
from grails-async.
Related Issues (20)
- Migrate to Develocity build cache connector
- java.lang.NoClassDefFoundError: org/grails/encoder/CodecFactory HOT 1
- Evaluate if Sitemesh dependency is now necessary
- Add implementation to addErrorHandler
- Fix failing tests in Travis HOT 1
- Fix pubsub-demo tests dependencies failing
- Execute groovydoc in travis HOT 1
- Update travis credentials HOT 1
- WebPromise broken when Interceptor present (Grails 3.3.9)
- Does it support servlet 3.1?
- Subclasses of Event cannot be used in subscriber method signature
- Documentation: no links to earlier versions HOT 1
- Missing Source Jars For grails-events HOT 1
- Upgrade to Groovy 3.0.7 and Grails 5.0.x, and lasted version of rxjava1, rxjava2 HOT 5
- SendAndReceive does not trigger when subscriber is a method
- Async Task Out of Memory Hangs Application without OOME
- Version in grails-plugin.xml in published artifact is wrong HOT 1
- Task 'docs' not found in root project 'grails-async' and its subprojects.
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grails-async.