Announcement Announcement Module
Collapse
No announcement yet.
Better Spring AMQP tutorials and examples Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Better Spring AMQP tutorials and examples

    I am building a Java web application that will both publish messages to a topic exchange and subscribe to messages from its queue. The only useful example I could find was the stocks application in the spring-amqp-samples. (The helloworld sync and async examples are client, not server applications and don't help me.) I have spent hours and hours re-compiling and playing with it, but it is extremely involved and difficult to figure out. It uses a mix of xml and annotated Java configurations that are poorly documented. For a Spring novice like me it's virtually incomprehensible.

    Does anyone have a recent tutorial or example demonstrating a web application using the Spring AMQP libraries (I'm using 1.1.4) that both publishes and subscribes and uses a topic exchange? One that uses only an xml configuration or an annotated java configuration (but not both), or demonstrates both but in separate applications so it's easy to see how to configure one way vs. the other.

    I'm hung up on how to bind a queue to the exchange, then listen to that specific queue in the listener container. I presume the binding is done when the application is deployed/started (for example, in Tomcat), but I'm lost as to how to listen to the queue that was bound to the exchange.

  • #2
    Originally posted by springshats View Post
    I'm hung up on how to bind a queue to the exchange, then listen to that specific queue in the listener container. I presume the binding is done when the application is deployed/started (for example, in Tomcat), but I'm lost as to how to listen to the queue that was bound to the exchange.
    This section of the reference manual should clear it up (especially the XML config excerpt which should be all you need):
    http://static.springsource.org/sprin...single/#d4e276

    If you define Queues and Bindings along with a RabbitAdmin within the ApplicationContext (all can be done with the XML namespace), then those will be declared automatically. That is explained here:
    http://static.springsource.org/sprin...-configuration

    Hope that helps.
    -Mark

    Comment


    • #3
      You also might want to take a look at the Spring Integration sample, which uses Spring Integration as a thin layer on top of Spring-AMQP, while providing an introduction to the power of using the Spring Integration framework to abstract away all the low-level protocol-specific concepts.

      https://github.com/garyrussell/sprin...ter/basic/amqp

      Comment

      Working...
      X