Hi,
I have a question about the listener and performance.
For example:
I have 5 class:
+ Add Attachment Listener
+ Priority Field Change Listener
+ Add Comment Listener
+ Change Status of Issue Listener
+ Change Assignee Listener
All of the classes will listen on
@EventListener public void onIssueEvent(IssueEvent issueEvent) {
// Do some thing
}
I have 2 way implemented for this problem
Option 1: I register 5 class like this:
eventPublisher.register(AddAttachmentListener.class);
eventPublisher.register(PriorityFieldChangeListener.class);
eventPublisher.register(AddCommentListener.class);
eventPublisher.register(ChangeStatusOfIssueListener.class);
eventPublisher.register(ChangeAssigneeListener.class);
And use inside each class function onIssueEvent()
Option 2:
I just register only one class:
eventPublisher.register(IssueEventListener.class);
And in the function onIssueEvent() I will switch to each event.
But, If I register 5 class it will make the code cleaner and easy for reading.
So, which option could I follow?
If I use option 1, will I affect the performance?
Thank you
Hi!
you followed 1 option, as 5 listener is too low
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.