Thông tin tài liệu
MANNING
Alvaro Videla
Jason J.W. Williams
FOREWORD BY
ALEXIS RICHARDSON
IN ACTION
Distributed messaging for everyone
www.it-ebooks.info
RabbitMQ in Action
www.it-ebooks.info
www.it-ebooks.info
RabbitMQ in Action
DISTRIBUTED MESSAGING FOR EVERYONE
ALVARO VIDELA
JASON J.W. WILLIAMS
MANNING
SHELTER ISLAND
www.it-ebooks.info
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 261
Shelter Island, NY 11964
Email: orders@manning.com
©2012 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books
are printed on paper that is at least 15 percent recycled and processed without the use of
elemental chlorine.
Manning Publications Co. Development editors: Maria Townsley, Cynthia Kane
20 Baldwin Road Technical proofreader: Jerry Kuch
PO Box 261 Copyeditor: Benjamin Berg
Shelter Island, NY 11964 Proofreader: Katie Tennant
Typesetter:Dottie Marsico
Cover designer: Marija Tudor
ISBN 9781935182979
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – MAL – 17 16 15 14 13 12
www.it-ebooks.info
To my grandfather, Maximiliano Godoy,
who showed me the ways of life. Gracias.
—A.V.
To Mama, Papa, and my sister J’aime.
Your love, support, and faith in me
has made it possible to climb mountains
and to God who always carries me to the other side.
—J.W.
www.it-ebooks.info
www.it-ebooks.info
vii
brief contents
1
■
Pulling RabbitMQ out of the hat 1
2
■
Understanding messaging 12
3
■
Running and administering Rabbit 37
4
■
Solving problems with Rabbit: coding and patterns 60
5
■
Clustering and dealing with failure 87
6
■
Writing code that survives failure 107
7
■
Warrens and Shovels: failover and replication 120
8
■
Administering RabbitMQ from the Web 137
9
■
Controlling Rabbit with the REST API 154
10
■
Monitoring: Houston, we have a problem 167
11
■
Supercharging and securing your Rabbit 195
12
■
Smart Rabbits: extending RabbitMQ 216
www.it-ebooks.info
www.it-ebooks.info
ix
contents
foreword xv
preface xvii
acknowledgments xix
about this book xxi
about the cover illustration xxiv
1
Pulling RabbitMQ out of the hat 1
1.1 Living in other people’s dungeons 3
1.2 AMQP to the rescue 5
1.3 A brief history of RabbitMQ 5
1.4 Picking RabbitMQ out of the hat (and other open
options) 8
1.5 Installing RabbitMQ on Unix systems 8
Why environment matters—living la vida Erlang 8
■
Getting the
package 9
■
Setting up the folder structure 9
■
Firing Rabbit up
for the first time 9
1.6 Summary 10
2
Understanding messaging 12
2.1 Consumers and producers (not an economics lesson) 13
2.2 Building from the bottom: queues 16
2.3 Getting together: exchanges and bindings 20
www.it-ebooks.info
[...]... Summary 215 www.it-ebooks.info 198 xiii CONTENTS 12 Smart Rabbits: extending RabbitMQ 216 12.1 RabbitMQ plugins 217 What can you do with plugins? 217 Where do you find plugins? 218 Installing plugins 218 Removing plugins 220 ■ ■ 12.2 Making your own plugins ■ 221 Getting the RabbitMQ Public Umbrella 222 Setting up the folder structure 223 Including the plugin build system 223 Creating the Erlang application... problems to solve integrating applications and serving high transaction loads RabbitMQ provides a powerful toolkit for solving those problems, and brings to the masses the rich history of messaging … and finally a pluggable information bus for everyone that needs one www.it-ebooks.info 8 1.4 CHAPTER 1 Pulling RabbitMQ out of the hat Picking RabbitMQ out of the hat (and other open options) Today, RabbitMQ isn’t... messagequeuing server software In the 17 years since, MQSeries has evolved into WebSphere MQ and is today the dominant commercial message-queuing platform During that time, Ranadivé’s TIB hardly disappeared into the bowels of Reuters Instead it has remained the other major player in enterprise messaging, thriving through a renaming to Rendezvous and Teknekron’s re-emergence as an independent company in the form... that messaging was the right answer to distributed computing More important, in the tech world circa 2004 a huge gap existed for open source messaging No one was providing a messaging solution except for the big commercial vendors, and while “enterprise” open source was flourishing with databases (MySQL) and application servers (JBoss), no one was touching the missing component: messaging Interestingly,... TIB software and the rules for tagging and routing the information Since the financial trading industry is full of information with a constantly changing set of interested folks, TIB spread like wildfire in that sector It was also noticed by telecommunications www.it-ebooks.info 4 CHAPTER 1 Pulling RabbitMQ out of the hat and especially news organizations, who also had information that needed timely... improvements for the foundations RabbitMQ will run on Every new release of Erlang includes performance improvements that are worth having Once you have RabbitMQ dependencies solved, create a folder where you can perform our tests Assuming that you’re running a Unix-flavored system, fire up a terminal to start typing commands: $ mkdir rabbitmqinaction $ cd rabbitmqinaction www.it-ebooks.info Installing RabbitMQ. .. Creating your custom exchange module 225 Registering your exchange with RabbitMQ 227 Implementing the exchange behaviour 230 Compiling your custom exchange 236 Taking your plugin for a test drive 239 ■ ■ ■ 12.4 appendix A appendix B appendix C Summary 243 Using Rabbit from Java and NET 244 Online resources 270 Installing RabbitMQ on Windows 275 index 279 www.it-ebooks.info www.it-ebooks.info foreword... RabbitMQ server Now it’s time to get the broker up and running and start doing cool stuff with it The operating system requirements for running RabbitMQ are flexible because we can run it on several platforms including Linux, Windows, Mac OS X, and other Unix-like systems In this chapter we’ll go through the process of setting up the server for a generic Unix system (all examples and instructions in. .. and data Messaging is essentially asynchronous in that it decouples applications by separating the sending and receiving of data The wonderful thing is that this connection pattern works in the same way at any scale xv www.it-ebooks.info xvi FOREWORD Scale is the point The dominance of the internet as a basis for application delivery has made scale the critical factor in application design Thinking small... was Alexis meeting Matthias Radestock Matthias was working for LShift, where Alexis was subleasing office space while at Metalogic LShift at the time was heavily involved in language modeling and distributed computing contracts for a major software vendor The background in these areas triggered Matthias’s interest in Erlang, the programming language that Ericsson had originally developed for their telephone . www.it-ebooks.info RabbitMQ in Action DISTRIBUTED MESSAGING FOR EVERYONE ALVARO VIDELA JASON J.W. WILLIAMS MANNING SHELTER ISLAND www.it-ebooks.info For online information and ordering of this and other Manning. find plugins? 218 ■ Installing plugins 218 ■ Removing plugins 220 12.2 Making your own plugins 221 Getting the RabbitMQ Public Umbrella 222 ■ Setting up the folder structure 223 ■ Including. MANNING Alvaro Videla Jason J.W. Williams FOREWORD BY ALEXIS RICHARDSON IN ACTION Distributed messaging for everyone www.it-ebooks.info RabbitMQ in Action www.it-ebooks.info www.it-ebooks.info RabbitMQ
Ngày đăng: 29/03/2014, 22:20
Xem thêm: RabbitMQ in Action: Distributed Messaging for Everyone pot, RabbitMQ in Action: Distributed Messaging for Everyone pot, 4 Picking RabbitMQ out of the hat (and other open options), 1 Consumers and producers (not an economics lesson), 5 Where’s my message? Durability and you, 6 Putting it all together: a day in the life of a message, 1 A decoupling story: what pushes us to messaging, 3 Remember me: RPC over RabbitMQ and waiting for answers, 1 Warrens: another way of clustering, 1 Beyond rabbitmqctl: the RabbitMQ Management plugin, 1 RabbitMQ monitoring: keeping an eye on your warren, A.1 Saying hello again (library options and Hello World), A.3 RPC with your coffee: implementing AMQP RPC with Java