-
Notifications
You must be signed in to change notification settings - Fork 18
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
Ability to do both Async and Synchronous events in the bus. #14
Comments
You can already subscribe GORM events synchronously by using |
yes, but only if it's gorm event and it operate under a completely different mechanism with GormEventDispatcher. Also requires any events that you might want synchronous to be an AbstractPersitentEvent. If we can just have a buildNotificationCallableSync and a subscribeSync then it would be easy to extend and have both simliar to what is done in the SynchronousEventBus setup for testing. There are a ton of use cases for this but the biggest one would be events that are transactional and don't use GORM, specifically in lighter weight microservices. |
We are using a forked version of Platform plugin and were hoping to replace it with this or at least be able to extend this, the only main thing missing from the base EventBus is a mechanism for synchronous events. The way its deisgned its also more or less locked down so we can't even add another , less than ideal solution, SynchronousEventBus as it will blow an IllegalStateException |
@graemerocher We can do the work on this and issue a PR but was looking for some consensus on this. |
Sounds good. Contributions welcome |
We could close this feature request if we were the only ones interested in it. For synchronous events that need to be in a transaction, we are leaning on Spring's built-in event support. |
We are also interested in a way to subscribe to events synchronously and have them execute with the same transaction as the publisher. I was considering implementing a custom event bus that allows me to look at the subscription to see if it should be synchronous before returning the callable wrapper. I haven't really gotten to implementing it so there could be other problems with this approach. |
After implementing the same solution as @basejump I started wondering why I even needed the Grails By adding The downside is that I don't see any call back support for handling 'replies' on the spring side, so no Are there other reasons that I might prefer using the Grails event plugin vs. the built-in spring support that I'm not considering? Just thinking out loud really, but it seems like they have mostly overlapping functionality so I'm wondering why both. |
Was there any development to this issue? I'm in a similar position, attempting to replicate synchronous events, if nothing else I'd like to use the sendAndReceive functionality however can't find any documentation explaining how to do so. |
Add a buildNotificationCallableSync and a subscribeSync to make it possible to add Synchronous subscriptions listeners without the need for a Gorm AbstractPersitentEvent. This would be especially useful in easily enabling subscribers to participate in Transactions.
The text was updated successfully, but these errors were encountered: