Results 1 to 4 of 4

Thread: cafe sample - annotation/XML config usage?

  1. #1
    Join Date
    Mar 2006
    Location
    Austin, Texas
    Posts
    21

    Default cafe sample - annotation/XML config usage?

    While reviewing the cafe sample code, I wanted to see how I could save 2 lines of XML config by using annotations on the Barista class to do things like configuring the concurrency policy and parameterizing the handlers.

    The API doesn't support this, but I first thought something like the following would be ok

    Code:
    // INVALID CODE
    @MessageEndpoint
    @Concurrency(core="25", max="50")
    public class Barista {
        ...
    
        @Handler(input="coldDrinks")
        public void prepareColdDrink(Drink drink) {...}
    
        @Handler(input="hotDrinks")
        public void prepareHotDrink(Drink drink) {...}
    
        ...
    }
    ...and then I threw this style out as it makes the endpoint almost completely non-resusable...appears locked to a specific concurrency strategy and channel mapping at compile time.

    Not being that familiar with the API yet, any usage suggestions on annotations and XML config? I'm all for minimizing the XML config

    Jon

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Jon,

    There has been a plan to add the @Concurrency annotation or at least concurrency attributes for the @MessageEndpoint annotation. For per-channel handler methods like that, the @Subscriber annotation would provide individual endpoints for the methods. If a @Concurrency annotation were available, then it could be applied alongside either of the @MessageEndpoint or @Subscriber annotations. That said, I do agree that externalized configuration of the concurrency values seems more appropriate.

    Mark

  3. #3
    Join Date
    Mar 2006
    Location
    Austin, Texas
    Posts
    21

    Default

    Mark,

    Thanks for summarizing a usage of @Subscriber.

    I'm trying to dig through the code to better conceptualize what "Indicates that method-invoking handler adapter should delegate to this method" means as far as the behind-the-scenes activity. Maybe a proxy (which intfc?) that forwards to the annotated method when any message is sent to the specified channel?

    What intfc's/classes should I focus on to learn more?

    Jon

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Have a look at: org.springframework.integration.config.Susbscriber AnnotationPostProcessor

    And let me know if you have any further questions. The documentation will continue to evolve in terms of the amount of detail.

    Hope that helps.
    -Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •