Click here to load reader

Spring AMQP - Reference Documentation · PDF file Spring AMQP 1.3.7.RELEASE Spring AMQP - Reference Documentation iv Preface The Spring AMQP project applies core Spring concepts to

  • View
    3

  • Download
    0

Embed Size (px)

Text of Spring AMQP - Reference Documentation · PDF file Spring AMQP 1.3.7.RELEASE Spring AMQP -...

  • Spring AMQP - Reference Documentation

    1.3.7.RELEASE

    Mark Pollack , Mark Fisher , Oleg Zhurakousky , Dave Syer , Gary Russell , Gunnar Hillert

    Copyright © 2010-2014 GoPivotal, Inc. All Rights Reserved.

    Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.

  • Spring AMQP

    1.3.7.RELEASE Spring AMQP - Reference

    Documentation ii

    Table of Contents

    Preface ..................................................................................................................................... iv I. Introduction ............................................................................................................................. 1

    1. Quick Tour for the impatient ........................................................................................... 2 1.1. Introduction ......................................................................................................... 2

    Very, Very Quick ................................................................................................ 2 With XML Configuration ...................................................................................... 2 With Java Configuration ...................................................................................... 3

    2. What's New ................................................................................................................... 5 2.1. Changes in 1.3 Since 1.2 .................................................................................... 5

    Listener Concurrency ......................................................................................... 5 Listener Queues ................................................................................................. 5 Consumer Priority .............................................................................................. 5 Exclusive Consumer ........................................................................................... 5 Rabbit Admin ..................................................................................................... 5 Direct Exchange Binding .................................................................................... 5 AMQP Template ................................................................................................ 5 Caching Connection Factory ............................................................................... 6 Binding Arguments ............................................................................................. 6 Routing Connection Factory ................................................................................ 6 MessageBuilder and MessagePropertiesBuilder ................................................... 6 RetryInterceptorBuilder ....................................................................................... 6 RepublishMessageRecoverer .............................................................................. 6 Default Error Handler (Since 1.3.2) ..................................................................... 6 Listener Container 'missingQueuesFatal` Property (Since 1.3.5) ............................ 6

    2.2. Changes to 1.2 Since 1.1 .................................................................................... 7 RabbitMQ Version .............................................................................................. 7 Rabbit Admin ..................................................................................................... 7 Rabbit Template ................................................................................................. 7 JSON Message Converters ................................................................................ 7 Automatic Declaration of Queues, etc .................................................................. 7 AMQP Remoting ................................................................................................ 7 Requested Heart Beats ...................................................................................... 7

    2.3. Changes to 1.1 Since 1.0 .................................................................................... 8 General .............................................................................................................. 8 AMQP Log4j Appender ....................................................................................... 8

    II. Reference .............................................................................................................................. 9 3. Using Spring AMQP ..................................................................................................... 10

    3.1. AMQP Abstractions ........................................................................................... 10 3.2. Connection and Resource Management .............................................................. 13

    Configuring the Underlying Client Connection Factory ......................................... 15 Routing Connection Factory .............................................................................. 15 Publisher Confirms and Returns ........................................................................ 16

    3.3. AmqpTemplate .................................................................................................. 16 Adding Retry Capabilities .................................................................................. 17 Publisher Confirms and Returns ........................................................................ 17

    3.4. Sending messages ............................................................................................ 18 Message Builder API ........................................................................................ 19

  • Spring AMQP

    1.3.7.RELEASE Spring AMQP - Reference

    Documentation iii

    Publisher Confirms ........................................................................................... 20 Publisher Returns ............................................................................................. 20

    3.5. Receiving messages .......................................................................................... 20 Polling Consumer ............................................................................................. 20 Asynchronous Consumer .................................................................................. 22

    'auto-delete' Queues ................................................................................. 23 3.6. Message Converters .......................................................................................... 24 3.7. Request/Reply Messaging .................................................................................. 27

    Message Correlation With A Reply Queue ......................................................... 28 Reply Listener Container .......................................................................... 28

    Spring Remoting with AMQP ............................................................................ 29 3.8. Configuring the broker ....................................................................................... 31

    Conditional Declaration ..................................................................................... 35 3.9. Exception Handling ............................................................................................ 37 3.10. Transactions .................................................................................................... 38

    A note on Rollback of Received Messages ........................................................ 39 Using the RabbitTransactionManager ................................................................ 39

    3.11. Message Listener Container Configuration ........................................................ 40 3.12. Listener Concurrency ....................................................................................... 44 3.13. Exclusive Consumer ........................................................................................ 45 3.14. Listener Container Queues ............................................................................... 45 3.15. Resilience: Recovering from Errors and Broker Failures ..................................... 45

    Automatic Declaration of Exchanges, Queues and Bindings ................................ 46 Failures in Synchronous Operations and Options for Retry .................................. 46 Message Listeners and the Asynchronous Case ................................................ 47 Exception Classification for Retry ...................................................................... 48

    3.16. Debugging ....................................................................................................... 48 4. Erlang integration ......................................................................................................... 49

    4.1. Introduction ....................................................................................................... 49 4.2. Communicating with Erlang processes ................................................................ 49

    Executing RPC ................................................................................................. 49 ErlangConverter ............................................................................................... 50

    4.3. Exception

Search related