apache / apache/grails-core

Allows to specify transaction phase when firing event through notify 'eventId'

Open
#10,905 0 comments 0 reactions 0 assignees View on GitHub
type: improvement
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

When using EventPublisher.notify to fire an event, the only way to specify a transaction phase is using the overload that receives a Event object, which makes the call a bit more verbose:
notify new Event("eventId", [arg1, arg2] as Object[]), TransactionPhase.XXX

If you do:
notify 'eventId', arg1, arg2, TransactionPhase.XXXX, the transaction phase is treated like an event argument just like arg1 and arg2

I would suggest that notify() is implemented so that if the last element of argument list is a TransactionPhase then it should be excluded from the argument list and treated like an actual TransactionPhase parameter.

Contributor guide

Open the contributing guide

Research direction

Start at EventPublisher.notify and trace the overload that accepts an event identifier and varargs. Check how the final TransactionPhase is currently passed through as an event argument, then add coverage showing that it is treated as the transaction phase while earlier arguments remain event arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.