[ 
https://issues.apache.org/jira/browse/PIVOT-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12881222#action_12881222
 ] 

Greg Brown commented on PIVOT-535:
----------------------------------

OK, I can see the value in the annotation processing. I imagine it would be 
accomplished via some static method in MessageBus, e.g.

  public static void subscribe(Object listener)

This method would process the listener class's methods looking for annotations 
and subscribe to the appropriate topics - correct?

I can see adding support for weak references to the annotation, e.g.:

  @MessageListener(weak=true)

I'm not as sure about message replies - how would that work with multiple 
listeners attached to the same topic? We do something like that with vetoable 
events right now, but we have a well-defined way for consolidating the return 
values (instances of Vote). I can't see how that would work for arbitrary 
objects.

Couple additional questions/comments:

1) We might want to rename @MessageListener to @MessageHandler. 
"MessageListener" implies that it is an event listener interface, whereas 
"handler" seems more appropriate for a method.

2) We should probably also provide additional static methods for managing weak 
listeners. These methods would be called via the static subscribe() method 
while processing the annotations. I was thinking earlier that adding a boolean 
"weak" argument to the subscribe() method would be sufficient, but I'm not sure 
what, if anything, that might mean for unsubscribe(). Thoughts?



> Add a @MessageListener annotation and an annotation processor for application 
> context message listener
> ------------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-535
>                 URL: https://issues.apache.org/jira/browse/PIVOT-535
>             Project: Pivot
>          Issue Type: Improvement
>            Reporter: Appddevvv
>             Fix For: 2.0
>
>
> Add a message listener annotation and a static method for annotation 
> processing to automatically enroll instance/methods in application message 
> handling.
> I have the classes that I can submit as a starting point. They allow weak and 
> strong references as well as optional request-reply semantics.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to