Learning RabbitMQ 1st Edition Toshev Martin 2024 Scribd Download
Learning RabbitMQ 1st Edition Toshev Martin 2024 Scribd Download
com
https://textbookfull.com/product/learning-rabbitmq-1st-
edition-toshev-martin/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/rabbitmq-in-depth-1st-edition-gavin-
m-roy/
textboxfull.com
https://textbookfull.com/product/rabbitmq-in-depth-1st-edition-gavin-
m-roy-2/
textboxfull.com
https://textbookfull.com/product/the-optimal-rabbitmq-guide-2nd-
edition-lovisa-johansson/
textboxfull.com
Easy Japanese a Direct Learning Approach for Immediate
Communication Japanese Phrasebook 2016th Edition Samuel E
Martin
https://textbookfull.com/product/easy-japanese-a-direct-learning-
approach-for-immediate-communication-japanese-phrasebook-2016th-
edition-samuel-e-martin/
textboxfull.com
https://textbookfull.com/product/commanding-casey-a-forbidden-enemies-
to-lovers-romance-1st-edition-nicolina-martin-martin/
textboxfull.com
https://textbookfull.com/product/biopackaging-1st-edition-martin-
alberto-masuelli/
textboxfull.com
https://textbookfull.com/product/the-twins-gladiators-of-krix-4-1st-
edition-miranda-martin-james-d-horton-martin-miranda/
textboxfull.com
https://textbookfull.com/product/functional-design-principles-
patterns-and-practices-robert-c-martin-series-1st-edition-robert-c-
martin/
textboxfull.com
[1]
Learning RabbitMQ
Martin Toshev
BIRMINGHAM - MUMBAI
Learning RabbitMQ
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author(s), nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78398-456-5
www.packtpub.com
Credits
Reviewers Proofreader
Van Thoai Nguyen Safis Editing
Héctor Veiga
Indexer
Commissioning Editor Hemangini Bari
Ashwin Nair
Graphics
Acquisition Editor Disha Haria
Vinay Argekar
Production Coordinator
Content Development Editor Arvindkumar Gupta
Kirti Patil
Cover Work
Technical Editor Arvindkumar Gupta
Danish Shaikh
Copy Editor
Vibha Shukla
About the Author
Martin Toshev is a software developer and Java enthusiast with more than eight
years of experience and vast expertise originating from projects in areas such as
enterprise Java, social networking, source code analysis, Internet of Things, and
investment banking in companies such as Cisco and Deutsche Telekom. He is a
graduate of computer science from the University of Sofia. He is also a certified Java
professional (SCJP6) and a certified IBM cloud computing solution advisor. His areas
of interest include a wide range of Java-related technologies (Servlets, JSP, JAXB,
JAXP, JMS, JMX, JAX-RS, JAX-WS, Hibernate, Spring Framework, Liferay Portal, and
Eclipse RCP), cloud computing technologies, cloud-based software architectures,
enterprise application integration, and relational and NoSQL databases. Martin is
one of the leaders of the Bulgarian Java Users group (BGJUG), a regular speaker at
Java conferences, and one of the organizers behind the jPrime conference in Bulgaria
(http://jprime.io/).
About the Reviewers
Van Thoai Nguyen has worked in the software industry for a decade in various
domains. In 2012, he joined BuzzNumbers as one of the core senior software
engineers, where he had opportunities to design, implement, and apply many
cool technologies, tools, and frameworks. A RabbitMQ cluster was employed as
the backbone of the real-time data processing platform, which includes various
data collectors, data filtering, enrichment, and storage using a sharded cluster of
MongoDB and SOLR. He is still maintaining the open source .NET RabbitMQ client
library, Burrow.NET (https://github.com/vanthoainguyen/Burrow.NET), which
he built during the time he worked for BuzzNumbers. This library is still being used
in many different applications in that company. Van is interested in clean code and
design, SOLID principle, and BIG data. You can read his blog at http://thoai-
nguyen.blogspot.com.au/.
Héctor Veiga is a software engineer specializing in real-time data integration and
processing. Recently, he has focused his work on different cloud technologies, such
as AWS, to develop scalable, resilient, and high-performing applications with the
latest open source technologies, such as Scala, Akka, or Apache Spark. Additionally,
he has a strong foundation in messaging systems, such as RabbitMQ and AMQP. He
also has a master's degree in telecommunications engineering from the Universidad
Politécnica de Madrid and a master's degree in information technology and
management from the Illinois Institute of Technology.
He currently works as part of the Connected Driving real-time data collection team
and is actively developing scalable applications to ingest and process data from
several different sources. He utilizes RabbitMQ heavily to address their messaging
requirements. In the past, he worked at Xaptum Technologies, a company dedicated
to M2M technologies.
Héctor also helped with the reviewing process of RabbitMQ Cookbook and RabbitMQ
Essentials, both from Packt Publishing.
I would like to thank my parents, Pilar and Jose Carlos, as well as my sister, Paula,
for always supporting me and motivating me to keep pushing on. Without them,
all this would not have been possible.
www.PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.com
and as a print book customer, you are entitled to a discount on the eBook copy. Get in
touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and readPackt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[i]
Table of Contents
[ ii ]
Table of Contents
Reliable delivery 98
AMQP transactions 100
Publisher confirms 103
Client high availability 104
Client reconnections 104
Load balancing 104
Case study: introducing high availability in CSN 105
Summary 106
Exercises 106
Chapter 6: Integrations 107
Types of integrations 108
Spring framework 109
Spring AMQP 110
Spring Integration 113
Integration with ESBs 116
Mule ESB 116
WSO2 122
Integration with databases 127
Oracle RDBMS 127
MongoDB 129
Hadoop 129
RabbitMQ integrations 130
RabbitMQ deployment options 130
Puppet 131
Docker 132
Vagrant 133
Testing RabbitMQ applications 133
Unit testing of RabbitMQ applications 133
Integration testing of RabbitMQ applications 133
Case study: Integrating CSN with external systems 134
Summary 135
Exercises 135
Chapter 7: Performance Tuning and Monitoring 137
Performance tuning of RabbitMQ instances 137
Memory usage 139
Faster runtime execution 140
Message size 141
The maximum frame size of messages 141
The maximum number of channels 141
Connection heartbeats 142
Clustering and high availability 142
QoS prefetching 143
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Preface
Learning RabbitMQ provides you with a practical guide for the notorious message
broker and covers the essentials required to start using it. The reader is able to
build up knowledge along the way—starting from the very basics (such as what is
RabbitMQ and what features does it provide) and reaching the point where more
advanced topics, such as RabbitMQ troubleshooting and internals, are discussed.
Best practices and important tips are provided in a variety of scenarios; some of them
are related to external systems that provide integration with the message broker or
that are integrated as part of the message broker in the form of a RabbitMQ plugin.
Practical examples are also provided for most of these scenarios that can be applied
in a broader context and used as a good starting point.
An example system called CSN (Corporate Social Network) is used to illustrate the
various concepts provided throughout the chapters.
Each chapter ends with an Exercises section that allows the reader to test his
understanding on the presented topic.
[ vii ]
Preface
Chapter 7, Performance Monitoring and Tuning, gives a detailed list of factors that must
be considered in terms of performance tuning of the message broker. The PerfTest
tool is used to demonstrate how the RabbitMQ performance can be tested. At the end
of the chapter, several monitoring solutions that provide support for RabbitMQ such
as Nagios, Munin, and Monit are used to demonstrate how the message broker can
be monitored in terms of stability and performance.
Chapter 8, Troubleshooting, illustrates a number of problems that can occur during the
startup of the message broker and normal operation along with the various causes
and resolutions in such cases. A brief primer on the Erlang programming language
is provided for the purpose of understanding and analyzing the RabbitMQ crash
dump—either directly or using the Crashdump Viewer for convenience.
[ viii ]
Preface
Chapter 10, Internals, discusses the internal architecture of the message broker and
provides a detailed overview on the most important components that RabbitMQ
comprises of.
Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.
[ ix ]
Preface
New terms and important words are also shown in bold. Words that you see on the
screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking
the Next button moves you to the next screen."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it
helps us develop titles that you will really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
[x]
Preface
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.
[ xi ]
Introducing RabbitMQ
In the world of enterprise messaging systems there are a number of patterns and
practices that are already successfully applied in order improve to scalability and
interoperability between different components in a system or between varying in
size and complexity systems. RabbitMQ is one such messaging solution, which
combines powerful messaging capabilities with easy use and availability on a
number of target platforms.
[1]
Introducing RabbitMQ
Enterprise messaging
A typical enterprise will have a number of systems that must typically communicate
with each other in order to implement a well-defined business process. A question that
is frequently tackled for this reason is how to implement the communication channel
between these types of systems? For example, consider the following diagram:
System 1 System 4
System 2 ? System 5
System 3 System 6
The question mark in the preceding picture denotes the communication media for
the six systems that are illustrated. In the diagram, we can think of these separate
systems as the components of one large system and the problem stays the same.
Before discussing the various alternatives for integration, a number of key factors are
considered, as follows:
[2]
Chapter 1
Let's assume that the systems communicate directly via some kind of remote
procedure calls as shown in the following diagram:
System 1 System 4
System 2 System 5
System 3 System 6
This implies that separate communication links must be established between each
pair of systems, which leads to tight coupling, a lot of effort to maintain all of the
links, reduced scalability, and reduced extensibility (for every new system that
is added, a few more communication links with other systems must be created).
However, real-time communication requirements might be met with some additional
effort to design the communication links.
A second approach is to use a shared file system in order to exchange files between
the systems that are being integrated, as illustrated in the following diagram:
System 1 System 4
System 3 System 6
[3]
Introducing RabbitMQ
A shared file system is used to provide the communication medium. Each system
may export data to a file that can be imported and used by other systems. The fact
that each system may support its own data format leads to the fact that each system
must have a particular mechanism to import data from every other system that it
needs to communicate with. This, on other hand, leads to the same problems that are
described in the case of direct communication. Moreover, real-time communication
requirements might be more difficult to establish and reading or writing data from
disk is also an expensive operation.
System 1 System 4
System 2 System 5
Database
System 3 System 6
Here, all the systems should depend on the same database schema. Although this
reduces coupling between systems and improves extensibility (new systems must
conform to a single database schema in order to integrate with other systems),
real-time workload processing is still an issue. Scalability and maintainability
depend directly on the type of database that is being used and they could turn out
to be weak factors especially if it is a relational database (this may not be the case if
NoSQL solutions are applicable for the particular use case).
[4]
Chapter 1
Messaging comes to the rescue when considering the problems that arise when
applying the previous approaches. Consider the following diagram for the
Enterprise Messaging System:
System 1 System 4
Enterprise
System 2 Messaging System 5
System
System 3 System 6
The messaging system itself provides mechanisms to validate, store, route, and
transform messages that are being sent between the different systems. Each system is
responsible for crafting its own message that is transferred via the messaging system
(also called the messaging broker) to other systems that are connected to the broker
and configured to receive that particular type of message. Each system may create a
message in a proper format that is specified by the protocol of the message broker—
meaning that the system is only coupled with that particular protocol. If the broker
implements a protocol that is based on a well-recognized standard, then this would
further decouple the systems from that particular message broker implementation.
[5]
Introducing RabbitMQ
Real-time workload processing is typically quite fast as the particular protocol that
is implemented by different messaging brokers is optimized to process message data
in a reliable and secure manner with minimal overhead. Most messaging solutions
provide a number of facilities that allow easy configuration, management, and
monitoring; thus, simplifying maintainability. Clustering support is also considered
by most implementations due to scalability and reliability requirements and
increasing workload demands. Integrating new systems is a matter of implementing
a mechanism for direct communication with the message broker.
Use cases
There are a variety of scenarios where messaging systems may be applied, such as
the following:
• Financial services: High rate real-time trade transactions handled between
different systems
• Social networking: Activity streams and event propagation between
different components in a social network
• E-mailing: Sending e-mail notifications or digests periodically to a large
number of users
• Processing large volumes of data upon request, such as image rendering
• Chat services
• Propagation of events throughout a system
• Any type of real-time system integration (system of systems)
As you can see, messaging solutions can be applied to a variety of scenarios that
typically involve a number of systems that must communicate in a timely manner
or perform a large number of time-consuming tasks. Messaging solutions are also
extensively being deployed by Cloud providers in order to provide messaging as a
service for Cloud-based applications.
[6]
Other documents randomly have
different content
must not venture into the depths of reality. Molière would probably
have had a short way with those who cannot laugh at Tartuffe, as
Cervantes would have had a short way with those who cannot laugh
at Don Quixote. There is as much imagination—as much sympathy,
even, perhaps—in the laughter of the great comic writers as in the
tears of the sentimentalist. And Molière’s aim was laughter achieved
through an exaggerated imitation of reality. He was the poet of good
sense, and he felt that he had but to hold up the mirror of good
sense in order that we might see how absurd is every form of
egotism and pretentiousness. He took the side of the simple dignity
of human nature against all the narrowing vices, the anti-social
vices, whether of avarice, licentiousness, self-righteousness or
preciosity. He has written the smiling poetry of our sins. Not that he
is indulgent to them, like Anatole France, whose view of life is
sentimental. Molière’s work was a declaration of war against all
those human beings who are more pleased with themselves than
they ought to be, down to that amazing coterie of literary ladies in
Les Femmes savantes, concerning whose projected academy of taste
one of them announces in almost modern accents:
It is but too true that the love, and even the very idea, of
genuine liberty is extremely rare. It is but too true that there
are many whose whole scheme of freedom is made up of
pride, perverseness and insolence. They feel themselves in a
state of thraldom, they imagine that their souls are cooped
and cabined in, unless they have some man, or some body of
men, dependent on their mercy. This desire of having some
one below them descends to those who are the very lowest
of all; and a Protestant cobbler, debased by his poverty, but
exalted by his share of the ruling Church, feels a pride in
knowing it is by his generosity alone that the peer, whose
footman’s instep he measures, is able to keep his chaplain
from a jail. This disposition is the true source of the passion
which many men in very humble life have taken to the
American War. Our subjects in America, our colonies, our
dependants. This lust of party-power is the liberty they
hunger and thirst for; and this syren song of ambition has
charmed ears that one would have thought were never
organised to that sort of music.
All through his life Burke set his face against what may be called
the lusts of human nature. As a Member of Parliament he refused to
curry favour with his constituents by gratifying their baser appetites.
In the farewell speech from which I have quoted, he has left us an
impassioned statement of his position:
Burke spent the greater part of his life summoning men to the
discipline of duty and away from anarchic graspings after rights.
George III’s war against America, as well as the French Revolution is
the assertion of a “right,” and Burke’s hatred of the war, as of the
Revolution, arose from his belief that the assertion of “rights,” not
for great public ends, but from ill-tempered obstinacy in clinging to a
theory, was no likely means of increasing the happiness and liberties
of human beings. He once received a letter from a gentleman who
declared that, even if the assertion of her right to tax America meant
the ruin of England, he would nevertheless say “Let her perish!” All
through the American War Burke saw that what prevented peace
was this sort of doctrinaire theory of the rights of England. In 1775
the American Congress appointed a deputation to lay a petition
before the House of Commons. The Cabinet refused to receive an
“illegal” body. Penn brought over an “olive branch of peace” from
Congress in the same year, and again, holding fast to their theory of
the rights of Empire, ministers replied that Congress was an illegal
body. Burke saw the vital thing to decide between England and
America was not some metaphysical point in the disputed question
of rights, but the means by which two groups of human beings could
learn to live in peace and charity in the same world. I do not wish to
suggest that he cared nothing for the rights or wrongs of the
quarrel. He was the impassioned champion of right, in the noble
sense of the word, beyond any other statesman of his time. On the
other hand, he detested the assertion of a right for its own sake—
the politics born of the theory that one has the right (whether one is
a man or a nation) to do what one likes with one’s own. Burke saw
that this is the humour of children quarrelling in the nursery. “The
question with me is,” he said, “not whether you have a right to
render your people miserable, but whether it is not your interest to
make them happy.” He regarded peace as almost an end in itself,
and he besought his fellow-countrymen not to stand upon their
rights at the cost of making peace impossible. “Whether liberty be
advantageous or not,” he told them during the war, “(for I know it is
a fashion to decry the very principle), none will dispute that peace is
a blessing; and peace must in the course of human affairs be
frequently bought by some indulgence of liberty.” Thus we find him
all through the war reminding his fellow-countrymen that the
Americans were human beings—a fact of a kind that is always
forgotten in time of war—and that the Anglo-American problem was
chiefly a problem in human nature. “Nobody shall persuade me,” he
declared, drawing on his knowledge of human nature, “when a
whole people are concerned, that acts of lenity are not means of
conciliation.” Again, when he was told that America was worth
fighting for, his reply was: “Certainly it is, if fighting a people be the
best way of gaining them.” Though opposed to the separation of
America, he was in the end convinced that, if the alternatives were
separation and coercion, England was more likely to gain a separate
America than a bludgeoned America as a friend. Addressing his
former constituents, he said:
I parted with it as with a limb, but as a limb to save the
body; and I would have parted with more if more had been
necessary: anything rather than a fruitless, hopeless,
unnatural civil war. This mode of yielding would, it is said,
give way to independency without a war. I am persuaded
from the nature of things, and from every information, that it
would have had a directly contrary effect. But if it had this
effect, I confess that I should prefer independency without
war to independency with it; and I have so much trust in the
inclinations and prejudices of mankind, and so little in
anything else, that I should expect ten times more benefit to
this kingdom from the affection of America, though under a
separate establishment, than from her perfect submission to
the Crown and Parliament, accompanied with her terror,
disgust and abhorrence. Bodies tied together by so unnatural
a bond of union as mutual hatred are only converted to their
ruin.
There, again, you see the appeal to the “nature of things,” the use of
the imagination instead of blind partisan passion. He himself might
have called this distinguishing quality not imagination so much as a
capacity to take long views. He looked on the taking of long views as
itself a primary virtue in politics. He praised Cromwell and other
statesmen whom he regarded as great bad men because “they had
long views, and sanctified their ambition by aiming at the orderly
rule, and not the destruction of their country.” Who, reading to-day
his speeches on America and India, can question that Burke himself
possessed the genius of the long view, which is only another name
for imagination in politics?
Mr. Murison’s admirable student’s edition of some of the writings
of Burke gives us examples of Burke not only during the American
but during the French period. He has called his book, indeed, not
after the Letter to the Sheriffs of Bristol or the Speech at Bristol, but
after the Letter to a Noble Lord, in which Burke defends himself in
the French period against the Duke of Bedford. Here, as during the
American War, we find him protesting against the introduction of
“metaphysical” disputes about rights into politics. During the
American War he had said, in regard to the question of rights: “I do
not enter into these metaphysical distinctions. I hate the very sound
of them.” Now, during the Revolution, he declared: “Nothing can be
conceived more hard than the heart of a thoroughbred
metaphysician. It comes nearer to the cold malignity of a wicked
spirit than to the frailty and passion of man.” Unfortunately, Burke
himself was something of a “metaphysician” in his attack on the
French Revolution. He wrote against France from prejudice and from
theory, and his eye is continually distracted from the facts of human
nature to a paper political orthodoxy. Even here, however, he did not
forget human nature, and, in so far as the French Revolution was
false to human nature—if the phrase is permissible—Burke has told
the truth in lasting prose.
His greatness as an artist is shown by the fact that he can move
us to silent admiration even when we disagree with him. There is
plenty of dull matter in most of his writings, since much of them is
necessarily occupied with the detail of dead controversies, but there
is a tide of eloquence that continually returns into his sentences and
carries us off our feet. We never get to love him as a man. We do
not know him personally as we know Johnson. He is a voice, a
figure, not one of ourselves. His eloquence is the eloquence of
wisdom, seldom of personal intimacy. He is not a master of tears
and laughter, but, like Milton, seems rather to represent a sort of
impassioned dignity of human nature. But what an imagination he
poured into the public affairs of his time—an imagination to which
his time was all but indifferent until he used his eloquence in support
of (in Lord Morley’s phrase) “the great army of the indolent good,
the people who lead excellent lives and never use their reason.”
Even then, however, the imagination survived, and, hackneyed
though it is by quotation, one never grows weary of coming on that
great passage in which he mourns over the fate of Marie Antoinette
and the passing of the age of chivalry from Europe.
It is now sixteen or seventeen years since I saw the
Queen of France, then the Dauphiness, at Versailles; and
surely never lighted on this orb, which she hardly seemed to
touch, a more delightful vision. I saw her just above the
horizon, decorating and cheering the elevated sphere she just
began to move in; glittering like the morning star, full of life,
and splendour, and joy. Oh, what a revolution! and what a
heart must I have to contemplate without emotion that
elevation and that fall! Little did I dream when she added
titles of veneration to those of enthusiastic, distant, respectful
love, that she should ever be obliged to carry the sharp
antidote against disgrace concealed in that bosom; little did I
dream that I should have lived to see such disasters fallen
upon her in a nation of gallant men, in a nation of men of
honour and of cavaliers. I thought ten thousand swords must
have leaped from their scabbards to avenge even a look that
threatened her with insult. But the age of chivalry is gone.
That of sophisters, economists and calculators has
succeeded; and the glory of Europe is extinguished for ever.
Never, never more, shall we behold that generous loyalty to
rank and sex, that proud submission, that dignified
obedience, that subordination of the heart, which kept alive,
even in servitude itself, the spirit of an exalted freedom. The
unbought grace of life, the cheap defence of nations, the
nurse of manly sentiments and heroic enterprise is gone! It is
gone, that sensibility of principle, that chastity of honour,
which felt a stain like a wound, which inspired courage whilst
it mitigated ferocity, which ennobled whatever it touched, and
under which vice itself lost half its evil by losing all its
grossness.
And, if we dip into the thousands of other things that have been
written about Keats, including the centenary appreciations, we shall
find this personal emphasis on the part of the critic again and again.
Lord Houghton even did his best to raise Keats a step nearer in
the social scale by associating him with “the upper rank of the
middle class”—an exaggeration, however, which is no more
inaccurate than the common view that Keats was brought up on the
verge of pauperdom. As a matter of fact, Keats’s father was an ostler
who married his employer’s daughter, and his grandfather, the livery
stable keeper of Finsbury Pavement, left a fortune of £13,000. But it
is not only with regard to his birth that attempts to bring Keats into
the fold of respectability are common. His character, and the
character of his genius, are unconsciously doctored to suit the tastes
of those who do not apparently care for Keats as he actually was.
The Keats who thrashed the butcher is more important for them
than the Keats who fell in love with Fanny Brawne. They prefer
canonising Keats to knowing him, and the logical consequence of
their attitude is that the Keats who might have been means more to
them than the Keats who was. I do not deny that a great deal that is
said about Keats on all sides is true: possibly most of it is true. But
much of it is true only as an argument. The manly Keats is the true
answer to the effeminate Keats, as the effeminate Keats is the true
answer to the manly Keats. The Keats who said: “I think I shall be
among the English poets after my death,” and the Keats who was
“snuffed out by an article” similarly answer one another; and the
Keats of The Fall of Hyperion is the perfect critic of the Keats of the
Ode on Indolence, and vice versa. Keats was a score of Keatses. He
was luxurious and ascetic, heroic and self-indulgent, ambitious and
diffident, an artist and a thinker, vulgar and an æsthete, perfect in
phrase and gauche in phrase, melancholy and merry, sensual and
spiritual, a cynic about women and one of the great lovers, a teller
of heart-easing tales and a would-be redeemer. The perfect portrait
of Keats will reveal him in all these contradictory lights, and we shall
never understand Keats if we merely isolate one group of facts, such
as the thrashing of the butcher, or another group, such as that he
thought for a moment of abandoning Hyperion as a result of the
hostile reviews of Endymion. Keats’s life was not that of a planet
beautifully poised as it wheels on its lonely errand. He was a man
torn by conflicting demons—a martyr to poetry and love and,
ultimately, to ideals of truth and goodness.
He bowed before altars that, even when he bowed, he seems to
have known were altars of the lesser gods. Not that he blasphemed
the greater gods in doing so. He believed that the altar at the foot of
the hill was a stage in the poet’s progress to the altar at the summit.
As he grew older, however, his vision of the summit became more
intense, and a greater Muse announced to him:
But he was Zeus’s child, as he lay dying, and the very epitaph he left
for himself, remembering a phrase in The Maid’s Tragedy of
Beaumont and Fletcher, “Here lies one whose name is writ in water,”
was a last farewell to an Apollo who seemed to have failed him.
The Keats who achieved perfection in literature, however, was
Apollo’s Keats—Apollo’s and Aphrodite’s. His odes, written out of a
genius stirred to its depths for the first time by his passion for Fanny
Brawne—he does not seem to have been subject to love, as most
poets are, in his boyhood—were but the perfect expression of that
idolatry that had stammered in Endymion. Keats in his masterpieces
is still the Prince breaking through the wood to the vision of the
Sleeping Beauty. He has not yet touched her into life. He almost
prefers to remain a spectator, not an awakener. He loves the picture
itself more than the reality, though he guesses all the while at the
reality behind. That, perhaps, is why men do not go to Keats for
healing, as they go to Wordsworth, or for hope, as they go to
Shelley. Keats enriches life rather with a sense of a loveliness for
ever vanishing, and with a dream of what life might be if the
loveliness remained. Regret means more to him than hope:
Who are these coming to the sacrifice?
To what green altar, O mysterious priest,
Lead’st thou that heifer lowing at the skies,
And all her silken flanks with garlands drest?
What little town by river or sea-shore,
Or mountain-built with peaceful citadel,
Is emptied of its folk, this pious morn?
And, little town, thy streets for evermore
Will silent be; and not a soul to tell
Why thou art desolate, can e’er return.
2. THE ARTIFICER
It is an interesting fact that most of the writers who use words
like artificers have been townsmen. Milton and Gray, Keats and
Lamb, were all Londoners. It is as though to some extent words took
the place of natural scenes in the development of the townsman’s
genius. The town boy finds the Muse in a book rather than by a
stream. He hears her voice first, perhaps, in a beautiful phrase. It
would be ridiculous to speak as though the country-bred poet were
uninfluenced by books or the town-bred poet uninfluenced by bird
and tree, by winds and waters. All I suggest is that in the townsman
the influence of literature is more dominant, and frequently leads to
an excitement over phrases almost more intense than his excitement
over things.
Milton was thus a stylist in a sense in which Shakespeare was
not. Keats was a stylist in a sense in which Shelley was not. Not that
Milton and Keats used speech more felicitously, but they used it
more self-consciously. Theirs, at their greatest, was the magic of art
rather than of nature. They had not, in the same measure as
Shakespeare and Shelley, the freedom of the air—the bird-like flight
or the bird-like song.
The genius of Keats, we know, was founded on the reading of
books. He did not even begin writing till he was nearly eighteen,
when Cowden Clarke lent him the treasures of his library, including
The Faëry Queene. The first of his great poems was written after
reading Chapman’s Homer, and to the end of his life he was inspired
by works of art to a greater degree than any other writer of genius
in the England of his time.
This may help to explain why he was, as Mr. John Bailey has
pointed out, the poet of stillness. Books, pictures, and Grecian urns
are still. They fix life for us in the wonder of a trance, and, if Keats
saw Cortes “silent upon a peak in Darien,” and
and figure after figure in the same sculptured stillness, may this not
have been due to the fact that his genius fed so largely on the arts?
Keats, however, was the poet of trance, even apart from his stay
in the trance-world of the artists. One of his characteristic moods
was an ecstatic indolence, like that of a man who has tasted an
enchanted herb. He was a poet, indeed, whose soul escaped in song
as on the drowsy wings of a dream. He may be said to have turned
from the fever of life to the intoxication of poetry. He loved poetry
—“my demon poesy”—as a thing in itself, as, perhaps, no other poet
equally great has done. This was his quest: this was his Paradise. He
prayed, indeed:
That I may die a death
Of luxury, and my young spirit follow
The morning sunbeams to the great Apollo
Like a fresh sacrifice; or, if I can bear
The o’erwhelming sweets, ’twill bring me to the fair
Visions of all places: a bowery nook
Will be elysium—an eternal book
Whence I may copy many a lovely saying
About the leaves and flowers—about the playing
Of nymphs in woods, and fountains; and the shade
Keeping a silence round a sleeping maid.
This was the mood in which he wrote his greatest work. At the
same time Keats was not an unmixed æsthete. He recognised from
the first, as we see in this early poem, “Sleep and Poetry,” that the
true field of poetry is not the joys of the senses, but the whole of
human life:
3. FANNY BRAWNE
“My dear Brown,” wrote the dying Keats, with Fanny Brawne in
his thoughts, in almost the last of his surviving letters, “for my sake,
be her advocate for ever.” “You think she has many faults,” he had
written a month earlier, when leaving England; “but, for my sake,
think she has none.” Thus did Keats bequeath the perfect image of
Fanny Brawne to his friend. And the bequest is not only to his friend
but to posterity. We, too, must study her image in the eyes of Keats,
and hang the portrait of the lady who had no faults in at least as
good a position on the wall with those other portraits of the flawed
lady—the minx, the flirt, the siren, the destroyer.
Sir Sidney Colvin, in his noble and monumental biography of
Keats, found no room for this idealised portrait. He was scrupulously
fair to Fanny Brawne as a woman, but he condemned her as the
woman with whom Keats happened to fall in love. To Sir Sidney she
was not Keats’s goddess, but Keats’s demon. Criticising the book on
its first appearance, I pointed out that almost everything that is
immortal in the poetry of Keats was written when he was under the
influence of his passion for Fanny Brawne, and I urged that, had it
not been for the ploughing and harrowing of love, we should
probably never have had the rich harvest of his genius. Sir Sidney
has now added a few pages to his preface, in which he replies to
this criticism, and declares that to write of Fanny Brawne in such a
manner is “to misunderstand Keats’s whole career.” He admits that
“most of Keats’s best work was done after he had met Fanny
Brawne,” but it was done, he insists, “not because of her, but in spite
of her.” “At the hour when his genius was naturally and splendidly
ripening of itself,” he writes, “she brought into his life an element of
distracting unrest, of mingled pleasure and torment, to use his own
words, but of torment far more than of pleasure.... In writing to her
or about her he never for a moment suggests that he owed to her
any of his inspiration as a poet.... In point of fact, from the hour
when he passed under her spell he could never do any long or
sustained work except in absence from her.” Now all this means little
more than that Fanny Brawne made Keats suffer. On that point
everybody is agreed. The only matter in dispute is whether this
suffering was a source of energy or of destruction to Keats’s genius.
Keats has left us in one of his letters his own view of the part
suffering plays in the making of a soul. Scoffing at the conception of
the world as a “vale of tears,” he urges that we should regard it
instead as “the vale of soul-making,” and asks: “Do you not see how
necessary a world of pain and troubles is to school an intelligence
and make it a soul?” Thus, according to his own philosophy, there is
no essential contradiction between a love that harrows and a love
that enriches. As for his never having suggested that he owed any of
his inspiration to his love for Fanny, he may not have done this in so
many words, but he makes it clear enough that she stirred his
nature to the depths for the first time and awakened in him that
fiery energy which is one of the first conditions of genius in poetry.
“I cannot think of you,” he wrote, “without some sort of energy—
though mal à propos. Even as I leave off, it seems to me that a few
more moments’ thought of you would uncrystallise and dissolve me.
I must not give way to it—but turn to my writing again—if I fail I
shall die hard. O my love, your lips are growing sweet again to my
fancy—I must forget them.” Sir Sidney would read this letter as a
confession that love and genius were at enmity in Keats. It seems to
me a much more reasonable view that in the heat of conflict Keats’s
genius became doubly intense, and that, had there been no
struggle, there would have been no triumph. It is not necessary to
believe that Fanny Brawne was the ideal woman for Keats to have
loved: the point is that his love of her was the supreme event in his
life. “I never,” he told her, “felt my mind repose upon anything with
complete and undistracted enjoyment—upon no person but you.” “I
have been astonished,” he wrote in another letter, “that men could
die martyrs for religion—I have shuddered at it. I shudder no more—
I could be martyr’d for my religion—love is my religion—I could die
for that. I could die for you. My creed is love, and you are its only
tenet.” And still earlier he had written: “I have two luxuries to brood
over in my walks—your loveliness and the hour of my death. O, that
I could have possession of them both in the same minute.... I will
imagine you Venus to-night and pray, pray, pray to your star like a
heathen.” It is out of emotional travail such as we find in these
letters that poetry is born. Is it possible to believe that, if Keats had
never fallen in love—and he had never been in love till he met Fanny
—he would have been the great poet we know?
I hold that it is not. Hence I still maintain the truth of the
statement which Sir Sidney Colvin sets out to controvert, that, while
Fanny “may have been the bad fairy of Keats as a man, she was his
good fairy as a poet.”
Keats’s misfortune in love was a personal misfortune, not a
misfortune to his genius. He was too poor to marry, and, in his own
phrase, he “trembled at domestic cares.” He was ill and morbid: he
had longed for the hour of his death before ever he set eyes on
Fanny. Add to this that he was young and sensual and as jealous as
Othello. His own nature had in it all the elements of tragic suffering,
even if Fanny had been as perfect as St. Cecilia. And she was no St.
Cecilia. He had called her “minx” shortly after their first meeting in
the autumn of 1818, and described her as “beautiful and elegant,
graceful, silly, fashionable and strange.” Even then, however, he was
in love with her. “The very first week I knew you,” he told her
afterwards, “I wrote myself your vassal.... If you should ever feel for
man at the first sight what I did for you, I am lost.” It is clear from
this that his heart and his head quarrelled about Fanny. At the same
time, after those first censures, he never spoke critically of her
again, even to his most intimate friends. Some of his friends
evidently disliked Fanny and wished to separate the lovers. He refers
to this in a letter in which he speaks angrily of “these laughers who
do not like you, who envy you for your beauty,” and writes of himself
as “one who, if he never should see you again, would make you the
saint of his memory.” But Keats himself could not be certain that she
was a saint. “My greatest torment since I have known you,” he tells
her, “has been the fear of you being a little inclined to the Cressid.”
He is so jealous that, when he is ill, he tells her that she must not
even go into town alone till he is well again, and says: “If you would
really what is called enjoy yourself at a party—if you can smile in
people’s faces, and wish them to admire you now—you never have
nor ever will love me.” But he adds a postscript: “No, my sweet
Fanny—I am wrong—I do not wish you to be unhappy—and yet I do,
I must while there is so sweet a beauty—my loveliest, my darling!
Good-bye! I kiss you—O the torments!” In a later letter he returns to
his jealousy, and declares: “Hamlet’s heart was full of such misery as
mine is when he said to Ophelia, ‘Go to a nunnery, go, go!’” He tells
this fragile little worldly creature that she should be prepared to
suffer on the rack for him, accuses her of flirting with Brown, and, in
one of the most painful of his letters, cries out:
Lamb’s life is an epic of such things as this, and Mr. Lucas is its
rhapsodist. He has written an anthological biography that will have a
permanent place on the shelves beside the works of Lamb himself.
VII
BYRON ONCE MORE
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com