100% found this document useful (7 votes)
74 views

Download full (Ebook) Practical Microservices Architectural Patterns - Event-Based Java Microservices with Spring Boot and Spring Cloud by Binildas Christudas ISBN 9781484245019, 1484245016 ebook all chapters

The document provides links to various ebooks focused on microservices architecture, particularly using Java with Spring Boot and Spring Cloud. It includes titles such as 'Practical Microservices Architectural Patterns' by Binildas Christudas and 'Learn Microservices with Spring Boot' by Moisés Macero García, among others. Each entry features ISBN numbers and direct links for downloading the ebooks in multiple formats.

Uploaded by

cubastandi1l
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (7 votes)
74 views

Download full (Ebook) Practical Microservices Architectural Patterns - Event-Based Java Microservices with Spring Boot and Spring Cloud by Binildas Christudas ISBN 9781484245019, 1484245016 ebook all chapters

The document provides links to various ebooks focused on microservices architecture, particularly using Java with Spring Boot and Spring Cloud. It includes titles such as 'Practical Microservices Architectural Patterns' by Binildas Christudas and 'Learn Microservices with Spring Boot' by Moisés Macero García, among others. Each entry features ISBN numbers and direct links for downloading the ebooks in multiple formats.

Uploaded by

cubastandi1l
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Download the Full Ebook and Access More Features - ebooknice.

com

(Ebook) Practical Microservices Architectural


Patterns - Event-Based Java Microservices with
Spring Boot and Spring Cloud by Binildas
Christudas ISBN 9781484245019, 1484245016
https://ebooknice.com/product/practical-microservices-
architectural-patterns-event-based-java-microservices-with-
spring-boot-and-spring-cloud-10416632

OR CLICK HERE

DOWLOAD EBOOK

Download more ebook instantly today at https://ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Practical Microservices Architectural Patterns: Event-Based Java


Microservices with Spring Boot and Spring Cloud by Christudas, Binildas ISBN
9781484245002, 1484245008

https://ebooknice.com/product/practical-microservices-architectural-patterns-
event-based-java-microservices-with-spring-boot-and-spring-cloud-55586520

ebooknice.com

(Ebook) Learn Microservices with Spring Boot: A Practical Approach to RESTful


Services Using an Event-Driven Architecture, Cloud-Native Patterns, and
Containerization by Moisés Macero García ISBN 9781484261316, 1484261313

https://ebooknice.com/product/learn-microservices-with-spring-boot-a-practical-
approach-to-restful-services-using-an-event-driven-architecture-cloud-native-
patterns-and-containerization-14457582

ebooknice.com

(Ebook) Learn Microservices with Spring Boot: A Practical Approach to RESTful


Services Using an Event-Driven Architecture, Cloud-Native Patterns, and
Containerization by Macero García, Moisés ISBN 9781484261309, 1484261305

https://ebooknice.com/product/learn-microservices-with-spring-boot-a-practical-
approach-to-restful-services-using-an-event-driven-architecture-cloud-native-
patterns-and-containerization-53775930

ebooknice.com

(Ebook) Learn Microservices with Spring Boot 3: A Practical Approach Using Event-
Driven Architecture, Cloud-Native Patterns, and Containerization by Moisés Macero
García, Tarun Telang ISBN 9781484297568, 1484297563, B0CHTVG43Q

https://ebooknice.com/product/learn-microservices-with-spring-
boot-3-a-practical-approach-using-event-driven-architecture-cloud-native-
patterns-and-containerization-53790608

ebooknice.com
(Ebook) Spring Boot 2.0 Projects: Build production-grade reactive applications and
microservices with Spring Boot (English Edition) by Mohamed Shazin Sadakath ISBN
9781789136159, 1789136156

https://ebooknice.com/product/spring-boot-2-0-projects-build-production-grade-
reactive-applications-and-microservices-with-spring-boot-english-
edition-22122616

ebooknice.com

(Ebook) Cloud Native Java: Designing Resilient Systems with Spring Boot, Spring
Cloud, and Cloud Foundry by Long, Josh, Bastani, Kenny ISBN 9781449374648,
1449374646

https://ebooknice.com/product/cloud-native-java-designing-resilient-systems-
with-spring-boot-spring-cloud-and-cloud-foundry-55586008

ebooknice.com

(Ebook) Spring REST: Building Java Microservices and Cloud Applications by Balaji
Varanasi, Maxim Bartkov ISBN 9781484274767, 1484274768

https://ebooknice.com/product/spring-rest-building-java-microservices-and-cloud-
applications-36432446

ebooknice.com

(Ebook) Beginning Spring Boot 3: Build Dynamic Cloud-Native Java Applications and
Microservices - Second Edition by K. Siva Prasad Reddy, Sai Upadhyayula ISBN
9781484287927, 9781484287910, 1484287924, 1484287916

https://ebooknice.com/product/beginning-spring-boot-3-build-dynamic-cloud-
native-java-applications-and-microservices-second-edition-53048286

ebooknice.com

(Ebook) Learn Microservices with Spring Boot 3 by Moises Macero Garcia, Tarun Telang
ISBN 9781484297568, 9781484297575, 1484297563, 1484297571

https://ebooknice.com/product/learn-microservices-with-spring-boot-3-53783902

ebooknice.com
Practical
Microservices
Architectural Patterns
Event-Based Java Microservices
with Spring Boot and Spring Cloud

Binildas Christudas
Foreword by Guy Pardon, Allard Buijze
and Schahram Dustdar
Practical Microservices
Architectural Patterns
Event-Based Java Microservices with
Spring Boot and Spring Cloud

Binildas Christudas
Foreword by Guy Pardon, Allard Buijze
and Schahram Dustdar
Practical Microservices Architectural Patterns
Binildas Christudas
Trivandrum, Kerala, India

ISBN-13 (pbk): 978-1-4842-4500-2    ISBN-13 (electronic): 978-1-4842-4501-9


https://doi.org/10.1007/978-1-4842-4501-9

Copyright © 2019 by Binildas Christudas


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Nikhil Karkal
Development Editor: Siddhi Chavan
Coordinating Editor: Divya Modi
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street,
6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a
Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-4500-2. For more
detailed information, please visit www.apress.com/source-code.
Printed on acid-free paper
To Sowmya, Ann, and Ria.
Table of Contents
About the Author����������������������������������������������������������������������������������������������������xxi

About the Technical Reviewer������������������������������������������������������������������������������xxiii


Acknowledgments�������������������������������������������������������������������������������������������������xxv

Foreword�������������������������������������������������������������������������������������������������������������xxvii

Introduction����������������������������������������������������������������������������������������������������������xxxi

Chapter 1: Distributed Computing Architecture Landscape������������������������������������� 1


System Architectures�������������������������������������������������������������������������������������������������������������������� 2
Mainframe Architecture����������������������������������������������������������������������������������������������������������� 4
Client-Server Architecture������������������������������������������������������������������������������������������������������� 4
Three-Tier Architecture����������������������������������������������������������������������������������������������������������� 4
N-Tier Architecture������������������������������������������������������������������������������������������������������������������ 5
Network Architectures������������������������������������������������������������������������������������������������������������������ 5
Point to Point��������������������������������������������������������������������������������������������������������������������������� 6
Hub and Spoke������������������������������������������������������������������������������������������������������������������������ 6
Enterprise Message Bus���������������������������������������������������������������������������������������������������������� 6
Enterprise Service Bus (ESB)��������������������������������������������������������������������������������������������������� 7
Software Architectures����������������������������������������������������������������������������������������������������������������� 7
Application Tiers���������������������������������������������������������������������������������������������������������������������� 7
Application Layers������������������������������������������������������������������������������������������������������������������� 8
The Application Architecture Landscape��������������������������������������������������������������������������������������� 8
Typical Application Architecture���������������������������������������������������������������������������������������������� 9
Typical Deployment Architecture������������������������������������������������������������������������������������������� 11
The Scalability Dilemma������������������������������������������������������������������������������������������������������������� 13
Application State������������������������������������������������������������������������������������������������������������������� 13

v
Table of Contents

The Dependency Nightmare�������������������������������������������������������������������������������������������������� 15


The Application Monolith������������������������������������������������������������������������������������������������������� 16
The Scalable Architecture����������������������������������������������������������������������������������������������������������� 17
Stateless Design�������������������������������������������������������������������������������������������������������������������� 18
Divide and Conquer��������������������������������������������������������������������������������������������������������������� 18
Summary������������������������������������������������������������������������������������������������������������������������������������ 19

Chapter 2: Introducing Microservices�������������������������������������������������������������������� 21


The Modular Monolith����������������������������������������������������������������������������������������������������������������� 21
The Modular Organization����������������������������������������������������������������������������������������������������� 22
The Monolith Application������������������������������������������������������������������������������������������������������� 23
Monolith Application Boundary���������������������������������������������������������������������������������������������� 24
Monolith Intermodule Dependency���������������������������������������������������������������������������������������� 25
The Scalability Dilemma�������������������������������������������������������������������������������������������������������� 26
Monolith Technology Constraints������������������������������������������������������������������������������������������� 28
Introducing Microservices���������������������������������������������������������������������������������������������������������� 29
Independent Modules������������������������������������������������������������������������������������������������������������ 29
Intermodule Communication������������������������������������������������������������������������������������������������� 30
The Microservices����������������������������������������������������������������������������������������������������������������� 31
Summary������������������������������������������������������������������������������������������������������������������������������������ 34

Chapter 3: Microservices in Depth������������������������������������������������������������������������� 35


Look and Feel of a Microservice������������������������������������������������������������������������������������������������� 36
The E-Commerce Microservice��������������������������������������������������������������������������������������������� 36
No Tier, Distributed���������������������������������������������������������������������������������������������������������������� 37
The Micromonolith����������������������������������������������������������������������������������������������������������������� 38
Understanding Self-Contained Microservices����������������������������������������������������������������������� 40
Resemblance of Microservices to SOA���������������������������������������������������������������������������������� 41
Message-Oriented Microservices������������������������������������������������������������������������������������������ 44
Advanced Microservices Capabilities����������������������������������������������������������������������������������������� 46
Fail-Safe Microservices��������������������������������������������������������������������������������������������������������� 46

vi
Table of Contents

Scalable Microservices��������������������������������������������������������������������������������������������������������� 47
Extensible Microservices������������������������������������������������������������������������������������������������������� 51
Summary������������������������������������������������������������������������������������������������������������������������������������ 52

Chapter 4: Microservices Architecture������������������������������������������������������������������� 55


Architecture for Digital Business������������������������������������������������������������������������������������������������ 56
The Digital Era����������������������������������������������������������������������������������������������������������������������� 56
The Digital App���������������������������������������������������������������������������������������������������������������������� 57
The Mesh App and Service Architecture�������������������������������������������������������������������������������� 58
The Context for Microservices���������������������������������������������������������������������������������������������������� 60
Granularity of Services���������������������������������������������������������������������������������������������������������� 60
The Gateway�������������������������������������������������������������������������������������������������������������������������� 64
Domain-Centric Partition������������������������������������������������������������������������������������������������������� 65
The Cloud Native Shift����������������������������������������������������������������������������������������������������������� 67
Web Scale Computing����������������������������������������������������������������������������������������������������������� 68
The Indispensable Cloud������������������������������������������������������������������������������������������������������������� 68
Cloud Architecture Model������������������������������������������������������������������������������������������������������ 68
Cloud Service Model�������������������������������������������������������������������������������������������������������������� 71
SaaS Maturity Models����������������������������������������������������������������������������������������������������������� 72
Virtualization�������������������������������������������������������������������������������������������������������������������������� 75
Virtualized Servers vs. Containers����������������������������������������������������������������������������������������� 75
The Architecture of Microservices���������������������������������������������������������������������������������������������� 79
Inversion of Architecture������������������������������������������������������������������������������������������������������� 79
The Inner Architecture Perspective��������������������������������������������������������������������������������������� 80
The Outer Architecture Perspective��������������������������������������������������������������������������������������� 83
The Big Picture of MASA�������������������������������������������������������������������������������������������������������� 85
Summary������������������������������������������������������������������������������������������������������������������������������������ 86

Chapter 5: Essential Patterns for Microservices���������������������������������������������������� 87


Orthogonal Scale Out of Services����������������������������������������������������������������������������������������������� 88
Write vs. Read Transactions�������������������������������������������������������������������������������������������������� 88
The Look-to-Book Challenge������������������������������������������������������������������������������������������������� 89

vii
Table of Contents

CQRS: Command Query Responsibility Segregation������������������������������������������������������������������� 90


Traditional vs. CQRS-Based Software Systems��������������������������������������������������������������������� 90
The Nomenclature in CQRS��������������������������������������������������������������������������������������������������� 96
Event-Based CQRS Architecture������������������������������������������������������������������������������������������������� 96
A Meta Model for Event-Based CQRS Design������������������������������������������������������������������������ 96
Command Query Segregation Using Events������������������������������������������������������������������������ 100
Scale Out for CQRS-Based Microservices��������������������������������������������������������������������������� 102
Summary���������������������������������������������������������������������������������������������������������������������������������� 104

Chapter 6: Distributed Messaging������������������������������������������������������������������������ 105


Messaging for Resiliency���������������������������������������������������������������������������������������������������������� 105
Message Persistence���������������������������������������������������������������������������������������������������������� 105
Design for Various Operational Characteristics of Microservices���������������������������������������� 107
A Chain Is As Strong As Its Weakest Link���������������������������������������������������������������������������� 108
Synchronous vs. Asynchronous������������������������������������������������������������������������������������������������ 110
Synchronous Interactions Between Microservices������������������������������������������������������������� 110
Asynchronous Interactions Between Microservices������������������������������������������������������������ 113
Send and Receive Messages to a Single Node RabbitMQ Broker��������������������������������������������� 118
RabbitMQ Message Sender������������������������������������������������������������������������������������������������� 118
RabbitMQ Message Receiver����������������������������������������������������������������������������������������������� 119
Build and Run the RabbitMQ Sample���������������������������������������������������������������������������������� 121
Send and Receive Messages to RabbitMQ Using Spring AMQP������������������������������������������������ 124
Spring AMQP Message Listener������������������������������������������������������������������������������������������ 124
Spring AMQP Message Producer����������������������������������������������������������������������������������������� 127
Build and Run the Spring AMQP RabbitMQ Sample������������������������������������������������������������� 128
Send and Receive Messages to Multi-Node RabbitMQ Cluster������������������������������������������������ 130
Tying the Knots Between the Consumer and Producer������������������������������������������������������������� 134
Correlation ID����������������������������������������������������������������������������������������������������������������������� 134
Code a Custom Network Server to Handle Concurrent Heavy Traffic���������������������������������� 135
The Simultaneous Exhibition Game������������������������������������������������������������������������������������� 143
Message Correlation and Microservices����������������������������������������������������������������������������� 145
Summary���������������������������������������������������������������������������������������������������������������������������������� 145

viii
Table of Contents

Chapter 7: Spring Boot����������������������������������������������������������������������������������������� 147


Performing Data Operations Using Spring Boot and MongoDB������������������������������������������������� 148
Creating a Spring Boot Project Template Using the Spring Initializer���������������������������������� 149
Design and Code the Domain Entities��������������������������������������������������������������������������������� 154
Code the Repositories��������������������������������������������������������������������������������������������������������� 155
Code the Boot Application Executable��������������������������������������������������������������������������������� 157
Build and Package the Spring Boot Application������������������������������������������������������������������ 157
Run and Test the Spring Boot Application��������������������������������������������������������������������������� 158
Developing Using the Spring HAL Browser, HATEOAS��������������������������������������������������������������� 163
The HAL Browser����������������������������������������������������������������������������������������������������������������� 163
Test HAL REST End Points Using RestTemplate������������������������������������������������������������������� 168
Develop a RESTful Web Service������������������������������������������������������������������������������������������������ 171
REST Basics������������������������������������������������������������������������������������������������������������������������� 171
HTTP Methods for CRUD Resources������������������������������������������������������������������������������������ 172
Develop a REST Controller in Spring Boot��������������������������������������������������������������������������� 173
Test the REST Controller Using RestTemplate��������������������������������������������������������������������� 179
Summary���������������������������������������������������������������������������������������������������������������������������������� 182

Chapter 8: Spring Cloud���������������������������������������������������������������������������������������� 183


Spring Cloud for Microservices Architecture���������������������������������������������������������������������������� 184
Feign Client Usage in Spring Cloud������������������������������������������������������������������������������������������� 184
Design a Feign Client Scenario�������������������������������������������������������������������������������������������� 185
Code Using Feign Client������������������������������������������������������������������������������������������������������� 188
Build and Test the Feign Client�������������������������������������������������������������������������������������������� 190
Hystrix Fallback������������������������������������������������������������������������������������������������������������������������ 192
Design a Hystrix Fallback Scenario������������������������������������������������������������������������������������� 192
Code the Hystrix Fallback Scenario������������������������������������������������������������������������������������� 195
Build and Test the Hystrix Fallback Scenario���������������������������������������������������������������������� 198
Hystrix Dashboard��������������������������������������������������������������������������������������������������������������������� 200
Redesign a Hystrix Fallback Method����������������������������������������������������������������������������������� 200
Code the New Design of Hystrix������������������������������������������������������������������������������������������ 201
Build and Test the Hystrix Fallback Scenario���������������������������������������������������������������������� 205

ix
Table of Contents

Inspect Hystrix Dashboard��������������������������������������������������������������������������������������������������� 206


Ribbon, the Client-Side Load Balancer������������������������������������������������������������������������������������� 208
Design a Ribbon Client Scenario����������������������������������������������������������������������������������������� 208
Code to Use Ribbon Client��������������������������������������������������������������������������������������������������� 209
Build and Test the Ribbon Client������������������������������������������������������������������������������������������ 210
Eureka, the Service Registry����������������������������������������������������������������������������������������������������� 212
Design a Eureka-Enabled Scenario������������������������������������������������������������������������������������� 213
Code to Use Eureka������������������������������������������������������������������������������������������������������������� 214
Build and Test the Eureka Sample��������������������������������������������������������������������������������������� 220
Bootstrap Your Bootstrap Server����������������������������������������������������������������������������������������� 225
Zuul, the API Gateway��������������������������������������������������������������������������������������������������������������� 226
The Bootstrap URL��������������������������������������������������������������������������������������������������������������� 226
Design a Zuul-Enabled Scenario����������������������������������������������������������������������������������������� 231
Code to Use Zuul����������������������������������������������������������������������������������������������������������������� 232
Build and Test the Zuul Sample������������������������������������������������������������������������������������������� 235
The Config Server��������������������������������������������������������������������������������������������������������������������� 237
Design a Configuration Scenario����������������������������������������������������������������������������������������� 238
Code to Use Config Server��������������������������������������������������������������������������������������������������� 238
Build and Test the Config Server����������������������������������������������������������������������������������������� 242
Summary���������������������������������������������������������������������������������������������������������������������������������� 244

Chapter 9: High Availability and Microservices��������������������������������������������������� 245


High Availability������������������������������������������������������������������������������������������������������������������������� 246
Measuring High Availability������������������������������������������������������������������������������������������������� 246
Baselining High Availability������������������������������������������������������������������������������������������������� 247
Decomposing High Availability�������������������������������������������������������������������������������������������������� 247
DNS Redundancy����������������������������������������������������������������������������������������������������������������� 247
DNS Load Balancing������������������������������������������������������������������������������������������������������������ 249
ISP Redundancy������������������������������������������������������������������������������������������������������������������� 251
Application Architecture Redundancy���������������������������������������������������������������������������������� 253
Data and Storage Redundancy�������������������������������������������������������������������������������������������� 255
Highly Available Microservices������������������������������������������������������������������������������������������������� 259

x
Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
Table of Contents

A Highly Available Spring Cloud Microservice Demonstration�������������������������������������������������� 261


Design a Highly Available Microservice Scenario���������������������������������������������������������������� 261
Code to Demonstrate Highly Available Microservices��������������������������������������������������������� 263
Build and Test the Microservices High Availability�������������������������������������������������������������� 271
Summary���������������������������������������������������������������������������������������������������������������������������������� 276

Chapter 10: Microservice Performance���������������������������������������������������������������� 279


Communication Across the Outer Architecture������������������������������������������������������������������������� 279
Asynchronous HTTP������������������������������������������������������������������������������������������������������������������ 281
The Bad and the Ugly Part of HTTP�������������������������������������������������������������������������������������� 281
APIs for Asynchronous HTTP Processing����������������������������������������������������������������������������� 281
Design a Scenario to Demo Async HTTP Between Microservices��������������������������������������� 285
Code to Use Async HTTP in Spring Boot������������������������������������������������������������������������������ 286
Build and Test Asynchronous HTTP Between Microservices����������������������������������������������� 291
Google Protocol Buffer Between Spring Boot Microservices���������������������������������������������������� 296
Protocol Buffer�������������������������������������������������������������������������������������������������������������������� 296
A Scenario to Demonstrate Protocol Buffer Between Microservices���������������������������������� 299
Code to Use Protocol Buffer in Spring Boot������������������������������������������������������������������������� 300
Build and Test the Protocol Buffer Between Microservices������������������������������������������������� 307
The Impact of Using Protocol Buffer������������������������������������������������������������������������������������ 309
Summary���������������������������������������������������������������������������������������������������������������������������������� 314

Chapter 11: Events, Eventuality, and Consistency����������������������������������������������� 315


Event-Driven Architecture��������������������������������������������������������������������������������������������������������� 316
Events���������������������������������������������������������������������������������������������������������������������������������� 316
EDA Components����������������������������������������������������������������������������������������������������������������� 316
Microservices and Event-Driven Architecture��������������������������������������������������������������������������� 319
Evolution of Microservices�������������������������������������������������������������������������������������������������� 319
Eventual Consistency and Microservices���������������������������������������������������������������������������� 323
Microservices and the CAP Theorem���������������������������������������������������������������������������������������� 326
The Scale Cube�������������������������������������������������������������������������������������������������������������������� 327
The CAP Theorem���������������������������������������������������������������������������������������������������������������� 329

xi
Table of Contents

BASE (Basically Available, Soft State, Eventually Consistent) Systems������������������������������� 332


CAP Pyramid������������������������������������������������������������������������������������������������������������������������ 333
Summary���������������������������������������������������������������������������������������������������������������������������������� 335

Chapter 12: Axon for CQRS Architecture�������������������������������������������������������������� 337


Introducing Axon, the CQRS Framework����������������������������������������������������������������������������������� 338
What Is Axon?���������������������������������������������������������������������������������������������������������������������� 338
Where Can You Use Axon?��������������������������������������������������������������������������������������������������� 339
What You Need to Run Axon������������������������������������������������������������������������������������������������ 342
Command and Event Handling in the Same JVM���������������������������������������������������������������������� 342
The Sample Scenario���������������������������������������������������������������������������������������������������������� 342
Code the Sample Scenario�������������������������������������������������������������������������������������������������� 345
Build and Test the Example Scenario���������������������������������������������������������������������������������� 357
Distributed Command and Event Handling������������������������������������������������������������������������������� 360
The Example Scenario��������������������������������������������������������������������������������������������������������� 361
Code the Example Scenario������������������������������������������������������������������������������������������������� 364
Build and Test the Example Scenario���������������������������������������������������������������������������������� 375
Summary���������������������������������������������������������������������������������������������������������������������������������� 383

Chapter 13: Distributed Transactions������������������������������������������������������������������� 385


The Two Generals Paradox�������������������������������������������������������������������������������������������������������� 386
Illustrating the Two Generals Paradox��������������������������������������������������������������������������������� 386
Solution Approaches������������������������������������������������������������������������������������������������������������ 387
Microservices as Generals�������������������������������������������������������������������������������������������������� 388
TCP/IP, the Valley Between the Generals����������������������������������������������������������������������������� 388
Transactions������������������������������������������������������������������������������������������������������������������������������ 390
Hardware Instruction Sets at the Core of Transactions������������������������������������������������������� 390
The ACID in the Transaction������������������������������������������������������������������������������������������������� 390
Transaction Models������������������������������������������������������������������������������������������������������������� 392
Transaction Attributes in EJB vs. Spring������������������������������������������������������������������������������ 393
Transaction Isolation Mechanisms�������������������������������������������������������������������������������������� 394
Transaction Isolation Levels������������������������������������������������������������������������������������������������ 394

xii
Table of Contents

Transaction Concurrency����������������������������������������������������������������������������������������������������� 395


Transaction Isolation Control Methods�������������������������������������������������������������������������������� 396
Enterprise Transaction Categories�������������������������������������������������������������������������������������������� 397
ACID Transactions���������������������������������������������������������������������������������������������������������������� 397
BASE = ACID in Slices��������������������������������������������������������������������������������������������������������� 398
BASE Transactions��������������������������������������������������������������������������������������������������������������� 399
Relaxed BASE Transactions������������������������������������������������������������������������������������������������� 400
ACID vs. BASE��������������������������������������������������������������������������������������������������������������������������� 403
Distributed Transactions Revisited�������������������������������������������������������������������������������������������� 404
Local Transactions��������������������������������������������������������������������������������������������������������������� 404
Distributed Transactions������������������������������������������������������������������������������������������������������ 406
Distributed Transactions in Java������������������������������������������������������������������������������������������ 407
Distributed Transaction Example Using MySQL, ActiveMQ, Derby, and Atomikos��������������������� 407
The Example Scenario��������������������������������������������������������������������������������������������������������� 408
Code the Example Scenario������������������������������������������������������������������������������������������������� 409
Build and Test the Example’s Happy Flow��������������������������������������������������������������������������� 442
Test the Transaction Rollback Scenario������������������������������������������������������������������������������� 453
Simulating Relaxed Base Anomalies����������������������������������������������������������������������������������� 457
Common Messaging Pitfalls������������������������������������������������������������������������������������������������ 473
Summary���������������������������������������������������������������������������������������������������������������������������������� 481

Chapter 14: Transactions and Microservices������������������������������������������������������� 483


Partitioning and Microservices������������������������������������������������������������������������������������������������� 484
Microservices and Distributed Data������������������������������������������������������������������������������������ 485
Idempotent Operations and Microservices�������������������������������������������������������������������������� 488
Global vs. Local Resources�������������������������������������������������������������������������������������������������� 489
Distributed Transactions Example: Refactoring Towards Less ACID������������������������������������������ 495
Towards Relaxed BASE: Redesign For Dealing with Duplicates and
Out-Of-Order Messages������������������������������������������������������������������������������������������������������� 496
Code the Relaxed Example Scenario����������������������������������������������������������������������������������� 500
Build and Test the Duplicate Message Being Sent Scenario����������������������������������������������� 510
Test the Duplicate Message Consumption Scenario����������������������������������������������������������� 523
Test the Message Received Out of Order Scenario������������������������������������������������������������� 526
xiii
Table of Contents

Choosing Transaction Options��������������������������������������������������������������������������������������������������� 536


Message Queues, Peek, and Client Acknowledge��������������������������������������������������������������� 537
Summary���������������������������������������������������������������������������������������������������������������������������������� 541

Chapter 15: Transactions Optimized for Microservices���������������������������������������� 543


Saga for Microservices Transactions���������������������������������������������������������������������������������������� 543
Saga Explained�������������������������������������������������������������������������������������������������������������������� 544
Distributed Saga������������������������������������������������������������������������������������������������������������������ 545
Saga Example Code Using Axon������������������������������������������������������������������������������������������������ 555
Design the Example Saga Scenario������������������������������������������������������������������������������������� 556
Code the Example Saga Scenario���������������������������������������������������������������������������������������� 567
Build and Test the Saga Example���������������������������������������������������������������������������������������� 577
Summary���������������������������������������������������������������������������������������������������������������������������������� 587

Chapter 16: Advanced High Availability and Scalability��������������������������������������� 589


High Availability and Scalability Templates Using an Oracle DB as a Reference���������������������� 590
The Simple, Inception Architecture�������������������������������������������������������������������������������������� 590
The Simple, Scaled Out Architecture����������������������������������������������������������������������������������� 593
Architecture to Address the Database Bottleneck��������������������������������������������������������������� 596
Independent Read and Write Scalability to Improve Efficiency������������������������������������������� 598
Sharding for Web Scale Architecture����������������������������������������������������������������������������������� 601
Good Architecture, But We Need Better and Simpler����������������������������������������������������������� 602
Highly Available and Scalable CQRS Example in Axon�������������������������������������������������������������� 603
Design the Sample Scenario����������������������������������������������������������������������������������������������� 603
Code the Sample Scenario�������������������������������������������������������������������������������������������������� 605
Build and Test the High Availability Scenario����������������������������������������������������������������������� 605
Scaling Aggregate Root Entities in Write Nodes for AXON CQRS���������������������������������������������� 615
Concurrently Modify Requests to Clone of Same Entity������������������������������������������������������ 615
Optimistic Locking��������������������������������������������������������������������������������������������������������������� 618
Conflict Detection and Resolution in Axon��������������������������������������������������������������������������� 619

xiv
Table of Contents

Example Demonstrating Optimistic Locking in Axon CQRS������������������������������������������������������� 620


Design the Sample Scenario����������������������������������������������������������������������������������������������� 620
Code the Sample Scenario�������������������������������������������������������������������������������������������������� 622
Build and Test the Sample Scenario������������������������������������������������������������������������������������ 625
Summary���������������������������������������������������������������������������������������������������������������������������������� 637

Chapter 17: Axon CQRS Microservices E-Commerce�������������������������������������������� 639


Revisiting a Traditional E-Commerce Application��������������������������������������������������������������������� 640
The E-Commerce Business Summarized���������������������������������������������������������������������������� 640
E-Commerce Architecture Revisited������������������������������������������������������������������������������������ 641
The E-Commerce Microservice Application������������������������������������������������������������������������������ 643
Logical Architecture for a Microservice-Based E-Commerce Architecture������������������������� 644
The ACID Within the BASE���������������������������������������������������������������������������������������������������� 645
The Design of the E-Commerce Microservices������������������������������������������������������������������� 645
Technical Architecture for the Microservice-Based E-Commerce Architecture������������������� 646
Design and Code the E-Commerce Microservice Application��������������������������������������������������� 648
Listing Product Categories and Products���������������������������������������������������������������������������� 648
Listing Product Details Mashed Up with Inventory Data����������������������������������������������������� 650
Add a Product to the Cart���������������������������������������������������������������������������������������������������� 652
Create a New Order������������������������������������������������������������������������������������������������������������� 652
Cancel an Order������������������������������������������������������������������������������������������������������������������� 662
Ship an Order Received������������������������������������������������������������������������������������������������������� 668
Deliver a Shipped Order������������������������������������������������������������������������������������������������������ 673
Delivery Failure for a Shipped Order����������������������������������������������������������������������������������� 678
Retrieve Order History Views����������������������������������������������������������������������������������������������� 683
Design and Code the E-Commerce Microservice Infrastructure����������������������������������������������� 684
Config Server����������������������������������������������������������������������������������������������������������������������� 684
Service Registry������������������������������������������������������������������������������������������������������������������ 686
API Gateway������������������������������������������������������������������������������������������������������������������������ 686
Configure the E-Commerce Microservice Application�������������������������������������������������������������� 693
Set Up the Environment Infrastructure for the E-Commerce Microservice Application������������ 700
Build and Run E-Commerce Microservice Application�������������������������������������������������������������� 703

xv
Table of Contents

Test the E-Commerce Microservice Use Cases������������������������������������������������������������������������ 711


View Product Category and Product Details������������������������������������������������������������������������ 713
Add to Cart��������������������������������������������������������������������������������������������������������������������������� 714
User Profile Creation������������������������������������������������������������������������������������������������������������ 715
Create a New Order������������������������������������������������������������������������������������������������������������� 718
Ship a New Order���������������������������������������������������������������������������������������������������������������� 721
Deliver Successfully the Shipped Order������������������������������������������������������������������������������ 723
Delivery Failure for the Shipped Order�������������������������������������������������������������������������������� 725
Cancel a New Order������������������������������������������������������������������������������������������������������������� 727
Reverting the Inventory������������������������������������������������������������������������������������������������������� 731
Summary���������������������������������������������������������������������������������������������������������������������������������� 732

Chapter 18: Microservices Security��������������������������������������������������������������������� 733


OAuth 2.0 and Microservices���������������������������������������������������������������������������������������������������� 734
OAuth 2.0����������������������������������������������������������������������������������������������������������������������������� 734
OAuth 2.0 Roles������������������������������������������������������������������������������������������������������������������� 734
OAuth 2.0 Client vs. User Agent������������������������������������������������������������������������������������������� 735
Trusted vs. Untrusted Clients����������������������������������������������������������������������������������������������� 735
The Authorization Code Grand Types����������������������������������������������������������������������������������� 742
Tokens for Scalable API Invocations����������������������������������������������������������������������������������������� 746
Session IDs�������������������������������������������������������������������������������������������������������������������������� 746
Tokens��������������������������������������������������������������������������������������������������������������������������������� 746
JSON Web Token (JWT)�������������������������������������������������������������������������������������������������������� 747
Design Security for the Example Microservices Application����������������������������������������������������� 750
Security Architecture for Microservices������������������������������������������������������������������������������ 750
Asymmetric Signing and Reference Tokens������������������������������������������������������������������������ 752
Code Security into Microservices E-Commerce Application����������������������������������������������������� 754
Enable the Web App to Handle Security������������������������������������������������������������������������������ 754
Zuul, the API Gateway as OAuth Client�������������������������������������������������������������������������������� 761
Authorization Server������������������������������������������������������������������������������������������������������������ 765
Resource Server������������������������������������������������������������������������������������������������������������������ 772

xvi
Table of Contents

Set Up the E-Commerce Microservice Application������������������������������������������������������������������� 776


Configure the Application���������������������������������������������������������������������������������������������������� 776
Set Up the Environment Infrastructure�������������������������������������������������������������������������������� 776
Build and Run the Application��������������������������������������������������������������������������������������������� 776
Test the Application������������������������������������������������������������������������������������������������������������� 777
Summary���������������������������������������������������������������������������������������������������������������������������������� 777

Chapter 19: Axon Microservices and BASE Transactions������������������������������������� 779


Command and Event Handling in the Same JVM Using Axon 3������������������������������������������������ 780
Design the Example Scenario���������������������������������������������������������������������������������������������� 780
Code the Example Scenario������������������������������������������������������������������������������������������������� 781
Build and Test the Example Scenario���������������������������������������������������������������������������������� 785
Distributed Command and Event Handling Using Axon 3���������������������������������������������������������� 786
Design Distributed Command Bus with Spring Cloud��������������������������������������������������������� 786
Code the Example Scenario������������������������������������������������������������������������������������������������� 788
Build and Test the Example Scenario���������������������������������������������������������������������������������� 795
Axon 3 CQRS Microservices E-Commerce with BASE Transactions������������������������������������������ 795
Removing the ACID Knot Between the Order and Inventory Domains��������������������������������� 795
Partitioning the Order and Inventory Domains into Separate Microservices����������������������� 808
Sagas for Deterministic Eventual Consistency�������������������������������������������������������������������� 809
Configure the E-Commerce Microservice Application��������������������������������������������������������� 810
Build and Run the E-Commerce Microservice Application�������������������������������������������������� 810
Command and Event Handling in the Same JVM Using Axon 4������������������������������������������������ 811
Distributed Command and Event Handling Using Axon 4���������������������������������������������������������� 811
Summary���������������������������������������������������������������������������������������������������������������������������������� 812

Appendix A: Install, Configure, and Run MongoDB����������������������������������������������� 813


Introducing MongoDB��������������������������������������������������������������������������������������������������������������� 813
The MongoDB Document����������������������������������������������������������������������������������������������������� 814
Install and Configure MongoDB������������������������������������������������������������������������������������������������ 814
Download MongoDB Community Edition����������������������������������������������������������������������������� 814
Install and Configure MongoDB������������������������������������������������������������������������������������������� 815

xvii
Table of Contents

Start Using MongoDB���������������������������������������������������������������������������������������������������������������� 816


Start and Connect to MongoDB������������������������������������������������������������������������������������������� 817
Execute Basic Data Manipulations with MongoDB�������������������������������������������������������������� 818
Robomongo, A GUI for MongoDB����������������������������������������������������������������������������������������������� 822
Download and Install Robomongo Community Edition�������������������������������������������������������� 822
Start and Connect to MongoDB Using Robomongo������������������������������������������������������������� 823
Execute Basic Data Manipulation with MongoDB���������������������������������������������������������������� 824
Summary���������������������������������������������������������������������������������������������������������������������������������� 825

Appendix B: Install, Configure, and Run RabbitMQ Cluster���������������������������������� 827


Introducing RabbitMQ��������������������������������������������������������������������������������������������������������������� 827
Set Up RabbitMQ����������������������������������������������������������������������������������������������������������������������� 828
Download and Install Erlang������������������������������������������������������������������������������������������������ 828
Install and Configure RabbitMQ������������������������������������������������������������������������������������������� 829
Start Using RabbitMQ���������������������������������������������������������������������������������������������������������������� 829
Enable Management Plugin������������������������������������������������������������������������������������������������� 830
Start RabbitMQ Server��������������������������������������������������������������������������������������������������������� 830
View RabbitMQ Management Console�������������������������������������������������������������������������������� 831
Set Up a RabbitMQ Cluster�������������������������������������������������������������������������������������������������������� 832
Configure RabbitMQ Cluster������������������������������������������������������������������������������������������������ 832
Bring Up the RabbitMQ Cluster�������������������������������������������������������������������������������������������� 834
Restart a RabbitMQ Cluster������������������������������������������������������������������������������������������������� 840
Connect to a RabbitMQ Cluster from a Client���������������������������������������������������������������������� 841
Summary���������������������������������������������������������������������������������������������������������������������������������� 841

Appendix C: Install, Configure, and Run Nginx Reverse Proxy���������������������������� 843


Install Nginx������������������������������������������������������������������������������������������������������������������������������ 843
Start Using Nginx���������������������������������������������������������������������������������������������������������������������� 844
Start Using Nginx as Reverse Proxy������������������������������������������������������������������������������������������ 844
Configure HTTP Reverse Proxy�������������������������������������������������������������������������������������������� 845
Configure TCP Reverse Proxy���������������������������������������������������������������������������������������������� 845
Summary���������������������������������������������������������������������������������������������������������������������������������� 846

xviii
Table of Contents

Appendix D: cURL and Postman���������������������������������������������������������������������������� 847


cURL Operations for HTTP��������������������������������������������������������������������������������������������������������� 847
HTTP GET to Retrieve an Entity�������������������������������������������������������������������������������������������� 848
HTTP POST to Create an Entity�������������������������������������������������������������������������������������������� 849
HTTP PUT to Replace an Entity�������������������������������������������������������������������������������������������� 851
HTTP PATCH to Modify an Entity������������������������������������������������������������������������������������������ 853
HTTP DELETE to Delete an Entity����������������������������������������������������������������������������������������� 854
Postman for HTTP Operations��������������������������������������������������������������������������������������������������� 855
HTTP GET Using Postman to Retrieve an Entity������������������������������������������������������������������� 855
Summary���������������������������������������������������������������������������������������������������������������������������������� 855

Appendix E: Apache TCPMon�������������������������������������������������������������������������������� 857


Install TCPMon�������������������������������������������������������������������������������������������������������������������������� 857
Start Using TCPMon������������������������������������������������������������������������������������������������������������������ 858
Set Up TCPMon as a Proxy�������������������������������������������������������������������������������������������������������� 858
Summary���������������������������������������������������������������������������������������������������������������������������������� 860

Appendix F: ActiveMQ������������������������������������������������������������������������������������������� 861


Install and Configure ActiveMQ������������������������������������������������������������������������������������������������� 861
Start Using ActiveMQ���������������������������������������������������������������������������������������������������������������� 862
View ActiveMQ Management Console��������������������������������������������������������������������������������������� 864
Configure ActiveMQ������������������������������������������������������������������������������������������������������������������� 865
Summary���������������������������������������������������������������������������������������������������������������������������������� 867

Appendix G: Derby������������������������������������������������������������������������������������������������ 869


Install and Configure Derby������������������������������������������������������������������������������������������������������� 869
Start and Stop Derby Server in Network Mode������������������������������������������������������������������������� 870
Create a New Derby Database�������������������������������������������������������������������������������������������������� 871
Execute Basic Commands in Derby Database�������������������������������������������������������������������������� 874
Summary���������������������������������������������������������������������������������������������������������������������������������� 876

xix
Table of Contents

Appendix H: MySQL����������������������������������������������������������������������������������������������� 877


Install MySQL���������������������������������������������������������������������������������������������������������������������������� 877
Initialize the Data Directory������������������������������������������������������������������������������������������������������� 878
Start MySQL Server������������������������������������������������������������������������������������������������������������������� 879
Connect to MySQL Server��������������������������������������������������������������������������������������������������������� 879
Test the MySQL Server Installation������������������������������������������������������������������������������������������� 881
Disconnect from MySQL Server������������������������������������������������������������������������������������������������ 881
Create and Select a Database��������������������������������������������������������������������������������������������������� 881
Create Tables���������������������������������������������������������������������������������������������������������������������������� 883
Add User Accounts to MySQL Server���������������������������������������������������������������������������������������� 884
Stop MySQL Server������������������������������������������������������������������������������������������������������������������� 884
Summary���������������������������������������������������������������������������������������������������������������������������������� 884

Index��������������������������������������������������������������������������������������������������������������������� 885

xx
Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
About the Author
Binildas Christudas provides technical architecture
consultancy for IT solutions. He has over 20 years of IT
experience, mostly in Microsoft and Oracle technologies.
Distributed computing and service-oriented integration
are his main skills, with extensive hands-on experience
in Java and C# programming. A well-­known and highly
sought-after thought leader, Binil has designed and built
many highly scalable middle-tier and integration solutions for several top-notch
clients including Fortune 500 companies. He has been employed by multiple IT
consulting firms including Infosys and Tata Consultancy Services and currently works
for IBS Software Private Limited as the Chief Architect. In his role as VP and Head of
Technology, he leads technology and architecture strategies for IBS’s product portfolio.
Binil is a Sun Certified Programmer (SCJP), Developer (SCJD), Business Component
Developer (SCBCD), and Enterprise Architect (SCEA), Microsoft Certified Professional
(MCP), and Open Group (TOGAF8) Certified Enterprise Architecture Practitioner. He
is also a Licensed Zapthink Architect (LZA) in SOA. Binil has his B.Tech. in Mechanical
Engineering from the College of Engineering, Trivandrum (CET) and MBA in Systems
from the Institute of Management Kerala (IMK). Binil was the captain of the Kerala
University Power Lifting team and was the national champion during his university
studies. IBS has applied for his proposal titled “A Method and a System for Facilitating
Multitenancy of Services” to be a patent with the USPTO. Binil can be contacted through
www.linkedin.com/in/binildasca/ or www.facebook.com/binildas.christudas.

xxi
About the Technical Reviewer
Arun Prasanth has 12 years of experience as a hands-on
software architect involved in the architecture, design,
coding, and implementation of Java/J2EE-based
microservices architecture and service-oriented architecture.
He is currently working as senior technical architect in IBS
software services in Japan. Previously, he worked in the
banking domain at Societe Generale Global Solutions.

xxiii
Acknowledgments
A big thanks to Apress Media for having trust in me and giving me the opportunity to write
this book. Nikhil Karkal and Divya Modi from Apress have been very helpful in making
the process seamless and quick for me. I want to thank Siddhi Chavan for collaborating
with me and providing detailed instructions on how to make the content even better. I also
thank Matthew Moodie for providing the shape of this book through the initial chapters.
The tech-friendly workplace at IBS Software has been a boon for me. Many thanks to
Mr. V. K. Mathews, Executive Chairman, IBS Group, for consistent motivation throughout
my literary journey. I also need to thank Mr. Arun Hrishikesan, Chief Technology Officer,
IBS, for his constant reminders and support for completing this book, especially in
providing his broader views on technology areas, which has influenced the content and
style of this book to a great extent.
I thank Dr. Schahram for the many hours of interactions where he shared his views
on CAP theorem and its implications in practical software architectures.
Special thanks are due to Mr. Allard Buijze, CTO & Founder at AxonIQ, who extended
all support in completing this book.
My note of thanks to Dr. Guy Pardon, PhD, Global Solutions Architect at Atomikos,
for providing his insights into my book proposal and contents. Guy kept us honest,
picking up technical errors and ambiguities. The complete weekend dedicated to
making the chapters on transactions so detailed was invaluable, and I am so thankful.
Arun Prasanth made sure all the examples within this book were working as
expected. I thank him for reviewing the code content and also for doing the technical
review for the book.
Finally, special thanks to my wife, Sowmya Hubert, who knows how strong my
passion for technology is and who never complains about the time I spend writing.
I would like to thank my daughters, Ann S. Binil and Ria S. Binil, who were way too
understanding and supportive over the last many months while I was locked away
with my laptop instead of spending time with them. A huge thanks is due to my father,
Christudas Y., and mother, Azhakamma J., for their selfless support, which helped
me reach where I am today. Also my note of thanks to my in-laws, Hubert Daniel and
Pamala Percis. Finally, thanks to my sister, Dr. Binitha, her husband, Dr. Segin Chandran,
and their daughter, Aardra.
xxv
Foreword
This book you currently hold in your hands is clearly the result of many years of hands-­on
experience of a software engineer and architect. Binildas Christudas has written a
comprehensive volume guiding software engineers and software architects through the
jungle of conceptual decisions to be made in the realm of distributed systems architectures.
The chapters are structured in a logical manner so that the reader is guided through
a set of important questions that need to be asked in all large-scale distributed systems
projects. In particular, it deserves to be highlighted that the author spends a good
amount of the book explaining in detail all questions software architects and software
engineers need to ask before embarking on projects considering the use of microservices
and architecting the transition from monolithic architectures towards microservices-­
based architectures. Furthermore, this book also discusses issues related to cloud
deployments, which constitutes a significant aspect of such systems.
The set of exciting and advanced issues discussed in this book covers a range of
topics from fundamentals of microservices to questions related to transactions, eventual
consistency, cloud deployments, and CAP theorem-related issues.
This volume can serve as a guiding book on all matters related to microservices. It’s a
step-by-step manual on which questions to ask and subsequently which steps to take in
order to implement microservices-based distributed systems.
Thank you.

Schahram Dustdar
Fellow, IEEE, & Head, Distributed Systems Group
TECHNISCHE UNIVERSITAT, WEIN (Vienna University of Technology)

xxvii
Foreword

The domain of software engineering is evolving rapidly. Enterprises are continuously


challenged by newcomers in the market and by changes in legislation and customer
expectations. Startups evolve quickly and are challenged to handle the increasing
demand for their services when they become successful. These challenges require a
thorough review of how we design and build software. The microservices architecture
provides a good foundation for systems that face these demands.
However, microservices come with challenges of their own.
Binildas did a good job combining his extensive hands-on experience in software
development with an open mind towards new techniques and architectural styles.
Throughout this book, Binildas takes a practical approach to introducing different
architectural patterns relevant for microservices systems, describing both well-­
established, common patterns as well as some emerging patterns, such as CQRS.
If you wish to embark on the microservices journey, this book is your travel guide.

Allard Buijze
CTO & Founder of AxonIQ
Creator of Axon Framework

xxviii
Foreword

Microservices are all the news these days, just like SOA was a few years ago. Some people
say that microservices are just SOA done right. Instead of heavy WS-* standards, we now
have REST. Instead of the ESB, we have a lightweight broker like ActiveMQ. What about
transactions? In the following of industry giants like Amazon, we don’t necessarily use
(nor recommend) global ACID transactions that span all our microservices. Instead, it’s
all about BASE and Sagas these days.
BASE means: not a giant ACID transaction across all microservices (with one
enormous commit), but instead multiple, smaller ACID transactions that ripple through
the system - so it becomes consistent, eventually. Messaging is crucial for this.
Each of these smaller ACID transactions can be controlled with proven technologies
like XA, so they are really ACID - even when things go wrong.
Unfortunately, BASE is all too often just a misleading excuse used by modern
frameworks or technologies / platforms that lack XA support. The way BASE is
implemented is key, and without XA it is very hard to do it right - unless you don’t care
about duplicate processing or lost messages.
Duplicates may give issues sooner or later and get addressed with ad-hoc fixes. Lost
messages may never be detected at all except via data inconsistency in the longer term -
where the root cause will be extremely hard to find. You can have issues with both at the
consumer side, but also at the sender side.
A simple and safe way of doing BASE is shown in Figure 13-3 of Chapter 13. Unless
you feel adventurous, I recommend that you stick to this kind of style. If you’re in
financial services, you’ll probably appreciate the strong guarantee offered by XA, with
additional code simplicity as a free bonus.
As Chapter 14 shows, it takes a lot of extra coding and testing to mimic the
guarantees that come out of the box with XA transactions. Most of the tweaking in
Chapter 14 goes well beyond my own comfort zone, but Binildas has done a great job
of pointing out how much needs to be taken into account. It’s not a walk in the park; far
from it.
Advanced coding as with Sagas (Chapter 15) can introduce a different
level of transactions where you give up isolation and have to cope with
compensation yourself. At Atomikos, we have a somewhat similar model

xxix
Foreword

called Try-Confirm/Cancel (TCC for short; see www.atomikos.com/Blog/


TCCForTransactionManagementAcrossMicroservices). The concept is great, although
many people we talked to don’t like it very much because the burden of rollback lies with
them (compensation must be programmed).

Guy Pardon, PhD


Founder
atomikos.com

xxx
Introduction
We have been developing and deploying distributed applications for about two decades,
and microservices lays down architectural principles and patterns using many shortfalls
in developing, deploying, and maintaining distributed applications can be dealt with.
Microservices, also known as the microservice architecture, is an architectural style that
structures an application as a collection of loosely coupled, independently deployable
services that are highly maintainable and testable and are organized around business
capabilities. Practical Microservices Architectural Patterns is a practical introduction to
writing microservices in Java using lightweight and common technologies like Spring
Boot, Spring Cloud and Axon. I present the material in a way that will enable you to use
what you learn right away. To that end, I include code samples for all main concepts and
show you exactly how to build and execute them.
The book exposes many architectural complexities you will deal with when
designing microservices, and it uses code samples in solving challenging scenarios.
Practical Microservices Architectural Patterns is an architect’s book first, but
developers and technical managers can benefit from it too. I wrote it keeping in mind
Java architects who want to build serious distributed server-side applications in general
and microservices in particular. Focus is on what an architect should be aware of on
aspects like event-based systems, transactional integrity, data consistency, and so on;
developers too will find the exhaustive code useful in their everyday work. Working
knowledge of Java, Spring, and a bit of HTTP is assumed to get the samples up and
running quickly. If you do not have background in Java and Spring, still the utility build
scripts and step-by-step instructions should help you. Further, even though the samples
are in Java, all the architectural aspects and many of the chapters are not specific to
Java, hence architects with any technology background dealing with distributed systems
should benefit from this book.
The book introduces a complete microservices sample e-commerce application.
The readers can straightaway use it as a template to start building their production
systems. Of all the books available in the Java world, this is the first one exclusively
demonstrating by simulation all success and failure scenarios of a two-phase commit
transaction leveraging an XA transaction manager and two different XA transactional

xxxi
Introduction

resources, with complete code. Having shown the XA transaction in detail, the book
next covers with code, techniques available to attain (eventual) transactional integrity
by confining ACID-style transactions to within partitions and domains to adopt what is
called a BASE transaction across partitions and domains. The book has working samples
for Saga, one of the most well-known patterns for BASE-style distributed transactions.
The book also covers high availability, security, and performance of microservices. Many
of the mantras depicted here are only available with experienced architects; they’re not
available elsewhere in the public domain, but they’re now condensed in the form of this
book.

xxxii
Other documents randomly have
different content
reached the outer clew before the yard was down, and were seldom
in from it till the sail was half-way up. Loss of life occasionally
resulted, but the spirit of emulation always produced successors for
the dangerous task.

H.M.S. QUEEN IN PLYMOUTH SOUND, 1852

In 1853 I saw this operation, which was not directly useful when
completed in such haste, for the greater the speed the more
ineffective was the reefing, done many times in 63 seconds; but in
1851 the Queen’s men did it more than once in 59 seconds. Such
almost incredible rapidity was in a measure due to the Captain, a
man under whose command I now came for a few weeks. He was a
strongly-built, active man, much feared, and still more disliked, by all
hands on account of his severity. Nevertheless, he was respected for
his activity, indomitable courage, and practical seamanship. His face
was scarred by powder marks, a Marine having fired at him close up,
when defending a position at Malta, which the Captain attacked at
the head of a landing party.
Before H.M.S. Queen left the Mediterranean, one morning a
treble-reefed topsail broke loose in a gale of wind, and the mass of
canvas, flapping with violence, daunted the topsail yardmen, who
feared they would be knocked off the yard, on which they hesitated
to venture, till the Captain reached them from the deck, and “laying
out,” passed a rope round the sail and secured it. A few days after I
joined, when we were weighing anchor from St. Helen’s, Isle of
Wight, and had got the stock of our best bower anchor awash, the
9
forecastle man, whose duty it was to shin down the cable and pass
a rope through the ring on the stock, to run a hawser in order to
“cat” the anchor, twice went half-way down and then climbed back,
fearing to be washed off the stock, for the ship’s bow rising and
falling quickly, gave but little time to pass the rope, and each time
the bow fell, the stock went out of sight under water. The Captain,
who was as usual dressed in loose frock coat and gold-band cap,
cursing the sailor for “a lubberly coward,” slid down the chain cable
with the rope in his hand on to the stock, and went with it right
under water, but when he reappeared he had passed the rope end
through the ring.
On the 24th May 1852, H.M.S. Queen was lying moored to the
Dockyard wall. Now, some fifty years later, attendant tugs are in
readiness for outgoing ships, and in those days Captains preferred to
have the assistance of a steamer when passing through the narrow
exit of the harbour. Our man, however, disdained all such aid. Due
honours to the Sovereign’s birthday having been paid, at high tide
we set sail, and, casting off, proceeded to Spithead, where, as was
then the custom, all the heavy guns, and water for the cruise, were
shipped. The Queen passed so close to the northern shore that it
was necessary to run in our flying-jib boom to save the windows of
the “Quebec Hotel,” which has since disappeared. Most Captains
would have been sufficiently preoccupied with the ship’s safety to
disregard a small boy. Not so, however, was our Chief. His eye rested
on me, standing with hands in both pockets. “What are you doing,
sir, with hands in pockets? Aft here, sail-maker’s mate, with needle
and tar.” A big hairy seaman came aft, with his needle and tar
bucket. “Sew this young gentleman’s hands up in his pockets.” I was
seized, but as the first stitch was put in the Captain said, “Not this
time, but if I see your hands there again, there they’ll be for a
week.” Ten days later, when we were lying inside Plymouth
Breakwater, I was ordered to the Captain’s cabin. He was writing
when the Marine sentry ushered me in, and did not look up.
Presently he glanced at me, and said, “Youngster, your uncle,
Captain Michell, writes asking me to see after you,” and then went
on writing. I stood silent, respectful, cap in hand, till raising his head
he shouted, “Well, get out of the cabin.”
Orders were issued to “pay down” the ship’s company, but they
had served long enough with their Chief, and the whole crew of
Bluejackets, about 770, the 200 Marines standing aloof, came aft in
a body, and demanded to be “paid off.” When asked for their
reasons, they said anything but what they meant, but gained their
point, and were by orders of the Admiralty “paid off” on the 2nd
July. When nearly all the men had landed, the Captain “called” his
gig, and ordered the coxswain to pull for Mutton Cove. Robert
Cowling, his coxswain, when the boat was opposite to Drake’s
Island, said, “Beg your pardon, your honour, but might I be allowed
10
to land you at Mount Wise?” The Captain growled, “Mutton Cove.”
After another quarter-mile, Cowling began again: “Your honour,
might we land you this last time at Mount Wise? There are a good
many waiting for you at the Cove ——” “Curse you, do you hear
me?” And the boat went on. There was a large crowd of men just
paid off, of wives lawful as well as temporary, whose demeanour and
language indicated their hostile intentions. Undaunted, the Captain
shouted, as he jumped on to the slimy stone step, “Put the women
back, and I’ll fight the d——d lot of you, one after the other.” Then
the Bluejackets, who had been waiting to throw him into the water,
ran at him in a body, and raising him shoulder high, carried him, the
centre of a cheering mob, to his hotel.
The pennant having been hauled down on the 2nd July, was
rehoisted next day by my mother’s elder brother, Captain Frederick
Michell, a man differing in all characteristics from his predecessor,
except that each was courageous, had a strong sense of duty as
understood, and possessed a consummate knowledge of
seamanship.
My uncle, born A.D. 1788, was in his sixty-fourth year, of middle
height, and slight in figure. A courteous, mild manner hid great
determination and force of character. In his earlier service he had
repeatedly shown brilliant dash, and had been awarded by the
Patriotic Fund a Sword of Honour and a grant of a hundred guineas,
for gallantry in a boat attack, when he was wounded; and was
warmly commended in despatches for the remarkable determination
he had shown in the attack on Algiers in 1816. When re-employed in
1852 he had been living at Totnes, Devon, for many years, his last
command having been H.M.S. Inconstant, paid off in 1843. His
influence in the little borough where he lived in an unostentatious
manner, befitting his means, was unbounded. He paid his household
bills weekly, never owed a penny, was universally respected, and had
been twice Mayor.
A vacancy for the Parliamentary representation, impending for
some time, occurred within a few weeks of Michell’s re-employment.
Every voter but the Captain knew, and had told the election agents
who solicited the electors, mostly shopkeepers, for their votes and
interest, that they “would follow the Captain.”
On the morning of the polling-day, Captain Michell called on the
Port Admiral and asked for a day’s leave to record his vote. The
Admiral said somewhat shortly, “I do not like officers asking for leave
often; pray when did you have leave last?” “Well, sir, Lord
Collingwood gave me six weeks’ leave in 1806.” This settled the
question. My uncle went to Totnes, plumped against the Government
candidate, and then returned to his ship. The bulk of the electors
had waited for him, and the Government candidate was badly
defeated. Within a few days Captain Michell received an indignant
letter from a Secretary in Whitehall to the effect, “My Lords were
astonished at his ingratitude.” My uncle, the most simple-minded of
men, was painfully affected. He had imagined that he owed his
appointment to his merits, and to the consideration that the troubled
Political horizon necessitated the nomination of tried seamen to
command. He wrote officially to the Admiralty, stating that unless
the Secretary’s letter was repudiated, he must resign, and ask for a
Court of Inquiry. In replying, “My Lords much regretted the entirely
unauthorised and improper letter,” etc.
Captain Michell had the reputation of being strict and autocratic
with relatives, and my messmates in the gunroom concurred in
advising me to ask for a transfer to another ship, so I asked to be
sent to H.M.S. Spartan, then in the Sound; but another cadet was
selected. Later, when two cadets were required for H.M.S.
Melampus, bound for the Cape of Good Hope, I volunteered; but
two boys junior to me were chosen. If I had gone to the Cape, I
should have missed the Crimea. My uncle asked me why I had
volunteered, and I said frankly mainly to get away from him.
When Michell took command, the crew consisted of a draft of
Seamen-gunners and 200 Marines, and his task was to train the
large numbers of West Country lads who made up the balance of
970, all told. Very patient, methodical, and precise in all his ways, he
always put back every serious case, which might take a prisoner to
11
the gratings, for twenty-four hours’ consideration. Some weeks
after he joined, overhearing me speak of the third cutter as “My
boat,” he called me up and rebuked me, saying, “You mean, sir, Her
Majesty’s boat you have the honour to command.”
The Commander of the ship was very different in disposition,
manners, and temperament. A Scotchman, with a high sense of
duty, he was much feared by those inclined to indulge in alcohol.
Drinking to excess was common, and the Midshipmen sent
below in the middle watch to mix the tumbler of spirits and water
(gin being then the favourite beverage) of the officers in charge of
the watch, used to bet who would put in most spirit and least water.
In my first year’s service two of our officers died from alcoholism.
Our Commander, naturally of a choleric though kindly
disposition, was severely tried by some of the older officers in the
gunroom, two of whom he often “Proved,” when they returned on
board from shore leave. He occasionally lost his temper when
answered, as he was on many occasions by a hard-drinking officer.
One day giving an answer which was deemed to be unsatisfactory,
he was greeted by an outburst of passion. “I’ll bring your nose to
the grindstone; I’ll reduce you to a gooseberry.” My messmate
calmly replied, in the slow, solemn manner of a man who is
conscious of having drunk too much, “You cannot, sir, bring my nose
to a grindstone, and to reduce me to a gooseberry is a physical
impossibility.” However, sometimes the Commander won in these
wordy contests.
One of our officers, tried in Queenstown Harbour for
drunkenness, was defended by a Cork attorney as his “next friend,”
who thus attempted to trip up the Commander’s evidence:—“You
say, sir, the prisoner was drunk. I suppose you have had much
experience? Yes. Well, kindly define what you mean by being drunk.”
“A man may be drunk—very drunk—or beastly drunk. Your client was
beastly drunk.” This settled the case, and the prisoner was dismissed
the Service.
The First Lieutenant knew his duty and did it, but amongst men
of marked characteristics attracted but little notice. Many of the
younger officers were above the average in ability and efficiency, the
most striking personality being a Mate, named Hugh (commonly
called Billy) Burgoyne, a son of the Field Marshal whose statue
stands in Waterloo Place. Mr. Burgoyne was as brave as a lion, as
active as a cat, and a very Mark Tapley in difficulties.
We were intimate, for I worked under his orders for some
months in the maintop, of which I was Midshipman, and he Mate,
and I admired him with boyish enthusiasm for his remarkable
courage and endurance of pain, of which I was an eye-witness. In
1852 we were at sea in a half gale of wind increasing in force, and
the ship rolling heavily, the topmen of the watch went aloft to send
down the topgallant-mast.
I presume that most of my readers are aware that the tall
tapering poles which they see in the pictures of sailing ships were
not all in one piece, but for the sake of those who are unacquainted
with nautical terms I explain that the lower mast has a head which
supports the top-mast, which in its turn supports the topgallant-
mast, and at the head of the topgallant-mast is similarly fixed a
royal-mast. When sailors speak of sending up a topgallant-mast, it
means that the mast is placed alongside the top-mast, and pulled up
into position by a rope which, passing over a pulley in the top of the
top-mast, is then fixed in its position by a wedge-shaped piece of
iron called a “Fid,” which being pushed in a hole in the top of the
top-mast, receives and supports the weight of the topgallant-mast.
When it is desired to “house” or send down the topgallant-mast,
the man at the top-masthead pulls out the fid on which the
topgallant-mast rests. The fid is composed of wood, shod with iron
in parts, and for the purpose of extraction is fitted with a “grummet”
of rope, or hemp handle. In ordinary weather there is not much
difficulty in extracting the fid, and most Able-seamen, holding on
with their legs, manage to get both hands on to the grummet and
pull out the fid; on this occasion, however, continuous rain had
caused the mast to swell, and the fid was embedded tightly; as the
ship rolled heavily in the trough of the sea, the man at the top-
masthead did not care to trust to his legs, and therefore put only
one hand on the fid-grummet. We were losing time, and Burgoyne,
with strong language at the man for his want of courage, ran
smartly aloft, and pushing him aside, put both hands on to the fid
and attempted to withdraw it; at first he failed, for the swollen wood
defeated his efforts.
MR. E. WOOD, R.N., 1852

The Marines on deck, who had the weight of the mast on their
arms during the several minutes which elapsed while the Bluejacket
was making half-hearted efforts with one hand, had got tired of
supporting three-quarters of a ton of dead weight, and thus it
happened that just as Burgoyne, getting his fingers inside the hole,
had slightly moved the fid, the Marines “coming up”—that is,
slacking their hold—let the topgallant-mast down on Burgoyne’s
hand, which was imprisoned by the tips of the fingers.
He felt his hand could not be extricated until the weight was off
it; if he had screamed, the fifty men on the topgallant-fall, i.e. the
hoisting-rope, would have looked up, and he would have remained
with his hand still imprisoned. With extraordinary fortitude and self-
command, Burgoyne putting his disengaged hand to his mouth,
hailed the deck, making himself heard above the gale. “On deck
there.” “Ay, ay.” “Sway again.” The Marines throwing all their weight
on the rope, lifted the mast, Burgoyne withdrew his hand, and then
becoming unconscious, we sent him down in the bight of a rope.
12
It is curious that he and two others of our Mess were lost
when in command.
CHAPTER III
1853–4—LIFE ON BOARD A MAN OF WAR

Her Majesty Queen Victoria with a steam fleet defeats a


squadron of sailing line-of-battle ships—Rough
weather in the Channel—Ship nearly wrecked in
Grecian Archipelago—My first command—At Sinope
—Captain Michell’s seamanship—I become a
Midshipman—William Peel—Cholera in the Fleet—
Reconnaissance of the Crimea.

T HE young Bluejackets of H.M.S. Queen, trained under zealous


and efficient officers, improved rapidly in seamanship, and on
the 11th August 1853, did well in a Royal Review off the Isle of
Wight.

Her Majesty’s ships Prince Regent and Queen with three


steamers represented an enemy cruising off St. Helen’s, and Her
Majesty the Queen, in the Victoria and Albert, led nineteen men-of-
war steamers to attack us.
The British fleet advanced in a crescent formation and nearly
surrounded their opponents, the Commanders of which, after
expending a quantity of blank ammunition, struck their colours in
obedience to a signal from the Senior officer, when Her Majesty
going on board the tender Fairy passed round the captured vessels.
The Fleet dispersed a few days later, and our young crew was
severely tested, H.M.S. Queen being caught in a heavy gale, which
after tossing us about under close-reefed topsails, which were on
two occasions blown away, obliged us to run for shelter into Torbay.
During the gale the ship’s bow and stern rose alternately high out of
the water, as she pitched in a choppy sea, and a wave striking the
rudder violently, made the wheel revolve with such force as to throw
two of the helmsmen right over it, one being severely injured. The
wheels on the upper and main deck were then double manned, but
it was necessary to control the swaying tiller in the gunroom with
steadying tackles, in all thirty-two men being employed for some
hours in steering the ship.
The temptations of Plymouth were too much for the probity of
our Mess, and Wine caterers, a Clerk, and a Master’s Assistant, who
misappropriated over £200. Three months later they were tried by
Court Martial in the Bosphorus, and dismissed the Service, the one
who was the more guilty getting six months’ imprisonment; but the
money had to be repaid, and in the gunroom our bill of fare up to
and including Christmas Day varied only to the extent, say Sundays
salt pork and plain duff with sugar, Mondays salt beef and pease
pudding, while we had to continue paying our usual Mess bills, those
of a Midshipman being limited to 30s. per mensem, and a wine bill
not exceeding 7s. 6d.
Tourists who steam past Cape Matapan, the southern point of
Greece, in a few hours, may find it difficult to realise that H.M.S.
Queen, although an unusually good sailer, took seven days to round
that promontory. We were nearly wrecked in trying to beat through
the Doro Channel. The passage lies between the islands of
Negropont and Andros, the most northerly of the Cyclades, there
being about six miles from land to land. The wind was north-east,
blowing freshly, and dead against us; we were, however, nearly
through, but just before dark on the 9th November, when the helm
was put down in our last tack, which would have taken us clear, the
jib halliards carried away, and the ship missing stays, gathered stern
way. We drifted so close to the rocky cliffs of Andros that one might
have thrown a biscuit on shore. A staysail brought the ship’s head
round in time, however, and “wearing,” we lay for the night under
the lee of the island. Next day the breeze increased to a gale, and
the ship was kept under reefed courses, till the mainsail splitting,
was replaced by the fore staysail. On the 11th December the Captain
bore up, and ran back to Milo, there to remain till the gale blew itself
out.
The harbour being landlocked, the sea was calm, as we duly
saluted His Excellency the Governor, who came on board. Some
hours later he returned to complain that one of the Midshipmen, in
practising with his new pistol, had shot the Governor’s donkey. His
Excellency was well satisfied with twenty dollars, which my
messmate had to pay for his pistol practice.
When we left Milo we had a fair wind up to Constantinople, and
from the Golden Horn on to Beicos Bay, where we joined the Allied
Fleet. We remained for ten days at anchor amidst lovely scenery in
the Strait, which varying from half a mile to two miles, separates
Europe from Asia.
On the 3rd January the combined fleets weighed to proceed to
Sinope, where five weeks earlier a Turkish squadron of seven
frigates had been destroyed by the Russian Fleet. H.M.S. Queen and
two French line-of-battle ships had reached the northern end of the
Strait, when our progress was arrested by signals. The greater part
of the fleets had been less prompt in getting under way and making
sail, and the wind veering to the N.N.W. and bringing with it a fog,
the fleets anchored again in Beicos Bay, the Queen remaining just
inside the Bosphorus.
Next morning both fleets entered the Black Sea with a southerly
wind, and proceeded to Sinope, the Admiral signalling, “The ships
and territories of Turkey throughout the Black Sea are to be
protected, under any circumstances, from all aggression.” We
reached the Bay, which is a fine natural harbour on the northern
extremity of Asia Minor, on the 6th January. The town had suffered
considerably from the Russian shells, two streets being entirely
demolished, and amongst the wrecks of the Turkish squadron
floated corpses of its indomitable crews. Three Russian men-of-war
were off the port on the 4th, forty-eight hours before our arrival, and
so narrowly escaped capture, or destruction.
The town of Sinope, then containing about 10,000 inhabitants, is
beautifully situated, but perhaps its greatest world-wide interest
consists in its being the birthplace of Diogenes. The surrounding
country is fertile, with many wooded valleys, which my messmates
and I explored to our great pleasure on the Governor’s horses,
favoured by summer-like weather, though while at sea we had
suffered from the intense cold. The fleets were back again in Beicos
Bay on the 22nd January, and there remained at anchor for two
months.
I got into trouble at the end of February, the result of obeying
orders. A Greek brig drifting down the Bosphorus, flying signals of
distress, grounded on the Asiatic side, and our Commander sent the
launch with the stream anchor, and the cutter of which I was in
charge, to warp her off shore. This was accomplished after a hard
day’s work. When we were about to return, the Senior officer
wanted a glass of grog, and ordered me to put him on board the
brig, the grateful Captain of which proffered refreshments.
I took the cutter to the gangway, where my Superior could have
ascended on the battens, assisted by a man rope, but he being stout
and inactive, preferred the rope ladder suspended from the stern,
and ordered me to go there. In vain I urged the swirling stream
might cause the cutter’s bow to be injured. He insisted on
obedience, and my fears being realised, we had to go back in the
launch, leaving the cutter with her bow stove in, hauled up on the
beach. On returning on board I was severely reprimanded by the
Commander. In my defence I submitted I was obliged to obey the
order after I had pointed out its risk. He replied, “I don’t care, sir;
you were in charge of the boat, so you are responsible.”
Three months later I was again censured, but this time because
I had tried to assert my command. We were lying at the time in
Kavarna Bay, and the ship’s crew had leave to go on shore by
detachments. In the evening two boats were sent to bring them on
board, a cutter for the officers, and a barge for the Bluejackets. A
Lieutenant ordered me to take into the cutter some of the men. I
paid for extra painting of the boat, and wanting to keep her neat
and clean, begged that the men might go off in the barge, but was
told peremptorily to obey orders. While we were pulling out to the
ship, about two and a half miles off, some of the men became noisy,
and the Lieutenant ordered me to keep them quiet. I replied to the
effect it was useless to talk to drunken men, and when we got on
board was reported for hesitating to obey orders. The Commander
lectured me severely, predicting I should come to the gallows;
nevertheless, I suppose he was generally satisfied with me, for a few
days before we left the Bosphorus again, I got, at the age of
sixteen, my first independent command. Some links in an adjunct to
our chain cable, technically called a “Blake stopper,” had become
strained, and I was ordered to take it to the Turkish dockyard at
Constantinople, to have them put into a furnace and straightened.
This involved absence from the ship for a couple of days, and with
the difficulties of language required some tact, but was successfully
carried out.
I was possibly chosen for this outing because, before we left
England, I had already had some practice in handling a boat, and in
the winter of 1852–53 Captain Michell commended me warmly, for
him a very unusual act. His daughter, who was staying with him on
board the Queen, then lying just inside the breakwater which
shelters Plymouth Sound, was expecting her son, eight years old,
now a distinguished Judge, Sir George Farwell, for a visit. When I
left the ship for Mount Wise there was a fresh westerly wind
blowing, which before we started to return had increased
considerably, and no shore boat ventured to put out to the Sound.
We pulled the cutter out to Redding Point, under shelter of Mount
Edgcumbe, and then, having close-reefed the sail, stood out till we
were under lee of the ship, which was lying head to wind, and got
the future Judge up the stern ladder in safety. Indeed, I became so
fond of being away in boats, and thus escaping lessons under the
Naval Instructor, that he felt bound, as I see by my letters, to get me
relieved for a short time, to ensure my passing the two-yearly
examination, which I did in due course two years after entering the
Service, and thus was enabled to have my jacket adorned with the
Midshipman’s white patch.
The Allied fleets weighed anchor again on the 24th March to
enter the Black Sea, and, as a fleet, there remained for over two
years. The start was unfortunate. One of the French men-of-war ran
aground. The English flagship collided with two vessels in
succession, and this enabled our Captain to prove his seamanship
and local knowledge. Fifteen years earlier he had commanded a
corvette, and later a frigate, which were often in the Bosphorus, and
seeing the misfortunes around him decided to sail up, although the
wind was not favourable. He ordered the towing hawser to be let go,
and hailing H.M.S. Furious, desired the Captain to offer help to the
Admiral.
We made all plain sail: the Captain knew the soundings and
currents thoroughly, and stood so close in to the shore at Therapia,
before he put the ship about, as to startle his crew. The Admiral,
generous in his appreciation of the seamanship shown, signalled
“Well done, Queen,” a signal repeated at least twice within the next
few months. No other line-of-battle ship went up the Bosphorus that
day under sail, and the Queen had to make five tacks ere she
entered the Euxine. Our Captain’s nerve was as good at sixty-five as
it was at Algiers in 1816. We cruised for some days, and then
anchored in the Bay opposite to the little town of Baljic, about
twenty-five miles north of Varna. Our life on board ship was
enlivened by frequent competitions in the Fleet; H.M.S. Queen,
called a Symondsite, built after the design of Sir William Symonds,
was only 247 feet in length, with 50 feet beam. She was the fastest
sailer of all the line-of-battle ships, when beating to windward, and
was excelled only by H.M.S. Agamemnon, when sailing with the wind
abaft the beam.
The men were always eager and excited when the signal having
been made, “chase to windward,” our ship crossed the bows of all
other line-of-battle ships. As every foot of canvas the spars and stays
would support was spread, the lee guns were always run in, and the
watch on deck ordered to lie down up to windward, to counteract
the heeling over of the ship caused by the pressure on the sails. The
varying speed of ships was found to be inconvenient later, when the
Allied fleets cruised off the Crimea coast, and H.M.S. Queen was
often detached with the fastest French line-of-battle ship, Marengo,
placed temporarily under Captain Michell’s command.
We heard on the 9th April that war was declared, but the French
Admiral for some reason did not get the official news for a week
later, when three cheers given for war by the English Fleet were
repeated by the Allies in unison. On the 17th April we sailed for
Odessa, and anchored four miles off the city on the 21st. Next
morning the steamers circling round in succession, bombarded the
batteries without losing many men, though H.M.S. Terrible was
hulled eleven times, and the Vauban set on fire by a red-hot shot.
Indeed, the Russian gunners were not sufficiently well trained to
make the contest equal, and after four of their magazines had been
exploded their guns were silenced.
H.M.S. Arethusa, a 50-gun frigate, engaged a battery five miles
off the city in the style of our grandfathers’ actions. She was under
all plain sail, employed to intercept merchant ships trying to escape
along the coast, when the Russians’ battery opened fire, and for half
an hour an animated fight was maintained by the frigate as she
tacked in towards, and out from the land. The Admiral’s signal
“Recall” was disregarded, until he ordered, “Arethusa’s Captain,
come on board.” This brought the frigate out, but having dropped
the Captain into his gig the First Lieutenant took the ship back, and
recommenced the action, when a more peremptory signal,
emphasised by the firing of a gun, ensured obedience.
The young generation of Captains had never been in action, and
were naturally eager to smell powder. A steamer bringing despatches
arrived during the bombardment, and crossing the Admiral’s bows
went in to take part with the other steamers in the operations
against the batteries, but was soon recalled in terms admitting of no
evasion. I was away all day in a boat intercepting small vessels, and
as most of them were laden with oranges, our Mess was well
supplied for some time.
Three weeks later, while the Allied fleets were cruising off
Sevastopol, H.M.S. Tiger ran ashore in a dense fog near the spot
where H.M.S. Arethusa engaged the battery. Captain Giffard
behaved with great gallantry, but was severely wounded, and with
his crew became prisoners of war. The officers liberated on parole
were well rationed and lodged, and the Governor’s wife sent dishes
from her kitchen daily for the wounded. The Bluejackets were less
well housed, and disliked the Russian ration, ¾ lb. black bread and 4
oz. indifferent meat.
While we were cruising off the Crimea we were enveloped by a
fog for six days early in May, and hearing guns signalling as we
thought an order to anchor, we let go our stream anchor in 89
13
fathoms. We rang bells and fired muskets every half-hour, but it
was so calm that there was little danger of a collision even to ships
under way. The dense fog caused much trouble and perplexity to
feathered creatures, and our decks and rigging became for forty-
eight hours the resting-place for numbers of pretty horned owlets.
They were so exhausted as to allow anyone to pick them up, and
many Midshipmen and sailors tried, though I believe ineffectually, to
tame them.
One of my messmates died at this time from erysipelas in the
face. Three nights before his death I stopped him going overboard,
when he tried in a fit of delirium to drown himself. He had sent for
me previously in the middle watch to tell me to make his coffee,
which I had been in the habit of doing at two o’clock in the morning.
We were friends in spite of a punishment he gave me, the marks of
which I carry now, fifty years after the event. When we were on our
passage from England to the East, I remarked on one of his
unpleasant habits at table, which all the youngsters in the gunroom
—about twenty-five in number—resented; I was, I admit, very
impertinent. He came round to my side of the table, and lifting me
from the seat, put me on the stern-sheets locker; then, sitting on my
chest, he took my hand, and bent the tip of the little finger nail
down till the nail bled copiously at the root.
On the 6th July, the cutter of which I had charge won a race
open to the Fleet. When we were practising for the race, I removed
one of the men, a weak oar, replacing him by a spare number. The
man resented my action, and a few days later got me severely
punished. There was a Fleet Order that officers in charge of boats
would, while waiting near the shore, keep the crew in the boat. The
intention of the order was to guard against trouble with the
inhabitants; but at Baljic, after the first week, it was so universally
disregarded that the men were always allowed on shore, and were
not ordered back even if we saw a Senior officer approaching. At the
appointed hour the crew of the boat returned with exception of the
aggrieved sailor, and I found him in a Greek wineshop fighting with
some of the inhabitants. Four men carried him down, struggling, to
the beach, and put him somewhat roughly into the boat. He jumped
out, and started, as he said, to swim to the ship, but was soon
sufficiently sobered to shout for help. After we took him in, he was
so violent that it became necessary to lash him to the bottom of the
boat, and he volunteered the information that his main pleasure in
getting drunk was to spite me for taking him out of the boat before
the race. When I reported, on going on board, the Captain
sentenced the sailor to ten days’ imprisonment, and directed the
Commander to give me a severe punishment. He complied
conscientiously, and I got “Watch and watch,” including confinement
to the ship. “Watch and watch” meant four hours on, four off, in the
twenty-four hours, and as the culprit’s hammock was taken on deck
daily at 6.30 a.m. and he was not excused any duties which came
round in his turn below, the process resembled that by which the
14
“Lion King,” many years ago, tamed his wild beasts.
The punishment was remitted after three weeks, I believe on the
recommendation of the doctor in charge of the ship. If, however, it
affected my health, it did not depress my spirits, and I joined every
evening in skylarking with my messmates, though I admit now, as I
did at the time, I feared doing many of the monkey-tricks which
some of us achieved, rather than be deemed to be less courageous
than my comrades. The game may be briefly described as that of
Follow-my-Leader. Now, I have always been giddy when on a height,
and one evening nearly fell from the main truck, which is the flat or
slightly round piece of wood crowning the top of the royal-mast, in
H.M.S. Queen 147 feet in height. The cap or truck is about the size
of a dinner-plate, and my shoes being larger than it, protruded over
its edges. I held on to the lightning conductor, which reached my
waistband, being so nervous as to want to be sick, and at one
moment almost let go my hold. It has always puzzled me why some
of us are giddy, while others have no nervous apprehension of
falling. When Her Majesty the Queen passed through the Fleet off St
Helen’s, on the 4th August 1853, and the ship’s company having
“manned yards” were cheering, I saw Private Buckle, Royal Marine
Light Infantry, remove the fore royal-mast lightning conductor, and
with folded arms balance on his head on the truck.
When we were at anchor in Baljic Bay, I fell overboard one
evening when acting as the “Leader” in one of these games. I had
come down from the main yardarm, on the brace, and was resting
on the brace block, level with the poop, when an officer trying to
startle me opened a “quarter gallery” window suddenly, with a
shout. He succeeded, for I let go, and falling fortunately immediately
between two lower deck ports which were open, reached the water
after turning over twice in the air. I made my shins bleed by striking
the bulging outside of the ship, but was able to swim to the boats
made fast astern. Had I fallen on a port—and there was little space
between them—I must have been killed.
On the 20th July, General Sir George Brown, who commanded
the Light Division, and General Canrobert having embarked in our
flagship, H.M.S. Britannia, the Fleet stood across the Black Sea,
heaving to, off Fort Constantine, while we counted the Russian ships
in the harbour of Sevastopol, and tried to estimate the value of the
defensive works. Our steamers went in close enough to draw fire,
but H.M.S. Fury was the only one hit. We remained on the coast a
week, between Sevastopol and Balaklava. After cruising for some
days, H.M.S. Queen was detached with the Marengo, and our
frigates, and Captain Michell as Commodore signalling H.M.S.
Diamond to take letters into Varna for the English mail, William Peel,
her Captain, came on board for orders. All our officers were anxious
to see him, for he had already a Service reputation as one of the
best, though the youngest Post Captain. He was the third son of that
great Minister of whom the Duke of Wellington said, “Of all the men
I ever knew he had the greatest regard for truth.” Sir Robert had
died four years earlier, being mortally injured when his horse fell
with him on Constitution Hill.
William entering the Navy in 1838, had seen service on the
Syrian Coast and in the China War. He had passed such a brilliant
examination after six years’ service as to gain promotion at once,
and two years later became a Commander. After he became a Post
Captain, when in command of H.M.S. Diamond, Peel was sitting one
day in the stern cabin reading, dressed in frock coat and epaulets,
when hearing a shout of “Man overboard,” he ran to the stern
window in time to see a Bluejacket under the water; without a
moment’s hesitation the Captain dived, but the man had sunk, and
was not recovered.
When I first saw this striking-looking man I had no idea that I
was to spend some months with such a highly-strung, nervous,
gallant gentleman, and whom I learned to love and esteem more
and more daily, as “the bravest of the brave.” In 1855, eight months
later, I became his Aide-de-Camp, and we were constantly together
until the 18th June, when we were both wounded and invalided to
England. I was evidently much struck with Captain Peel’s appearance
and manners, for I recorded in boyish language, “Captain Peel, very
intelligent, sharp as a needle; I never saw a more perfect
gentleman.”
His looks and bearing were greatly in his favour, for both in face
and figure there was an appearance of what sporting men, in
describing well-bred horses, call “quality.” He was about medium
height, with head gracefully set on broad, well-turned shoulders,
light in lower body, and with a dignified yet easy carriage; his dark
brown wavy hair was generally carefully brushed back, showing an
oval face, high square forehead, and deep blue-grey eyes, which
flashed when he was talking eagerly, as he did when excited. His
face when in repose had a somewhat austere look, with smooth and
chiselled outline, a firm-set mouth which was the more noticeable
because of his being clean-shaved. I do not know that I have ever
met so brave a man and yet one who felt so acutely every shot
which passed close to him.
When we returned to Baljic Bay, early in August, cholera had
broken out in the British camps near Varna. In addition to the 600
men who died, each Division had a number of men equal to about a
battalion, who required change of air, and these were sent down to
the Bosphorus, while the physical efficiency of many of those who
remained at duty was seriously impaired, a fact which was not
realised by those who criticised the apparent slowness of the
advance, and lack of enterprise after the victory, on the Alma, six
weeks later.
15
Cholera soon reached the Fleet. As I showed in The Crimea in
1854-’94, the troops were insufficiently supplied with medical
equipment, but this could not be alleged as regards the sailors.
Indeed, one great advantage in the Naval Service lies in the fact that
a crew virtually goes on active service each time a ship leaves
harbour. Nevertheless, although we were amply supplied with every
requisite, our casualties were greater, because the men were
concentrated in one place. The French flagship lost 140, of whom 40
died the first night; our flagship lost about one-tenth of the ship’s
company; and none escaped except H.M. ships London and Queen.
THE BLACK SEA

The screams of a sufferer when seized with cramp often brought


on other seizures, and the scenes on a middle or lower deck were
trying even to strong nerves. We went to sea to try and shake off
the disease. A few days later, so many men were enfeebled by
intestinal complaints, that some of the ships, carrying crews of 700
to 1000 men, had not sufficient Effectives to work the sails; and
when we returned to our anchorage, and the Admiral wanted his
boat, officers had to prepare it. I was sent on board the flagship
with a party to furl sails, and while the epidemic lasted we went at
sunrise and sunset daily, to bury her dead.
While the fleets were cruising in the Black Sea, the Allied
Generals in the Caradoc, escorted by H.M.S. Agamemnon,
reconnoitred the bays and mouths of rivers in the Crimea, from
Eupatoria on the north to Balaklava on the south.
Lieutenant-General Sir George Brown wished to land the troops
on the Katcha River, but Lord Raglan and his colleagues considered
this was undesirable owing to the proximity of the fortress, troops
from which might interrupt the disembarkation, and his Lordship
chose Kalamita Bay, six miles north of the Bulganac stream.
With one very important exception, the scarcity of potable water,
the spot selected was perfect. There was a long, low strip of shingly
beach rising gradually 200 yards from the shore, and immediately
behind the beach was a lake of brackish water, extending a mile
from north to south, and half a mile from west to east.
CHAPTER IV
1854—INVASION OF THE CRIMEA

The Allied Armies re-embarking from Varna, land in the


Crimea—The Alma as seen from the masthead of
H.M.S. Queen—Selecting a Naval Brigade—Balaklava
Harbour—The Upland—The English position—First
bombardment—Erroneous forecasts of siege—Able-
Seaman Elsworthy—A Midshipman’s daily prayers.

T HE British troops began to re-embark on the 29th August,


weakened by cholera not only in numbers, many having been
sent to the Bosphorus for change of air, but also by the enfeebled
condition of the men, several falling out as they marched down to
the Bay. Sailors do not like many passengers on fighting ships, but
H.M.S. Bellerophon and Vengeance were obliged to receive a
battalion from a transport on which the epidemic had reappeared,
carrying off its Captain with others.

On the 4th September the British transports assembled in Baljic


Bay, where the French and Turkish troops embarked. A head wind
blew on the 6th, but on the morning of the 7th the Allied fleets
sailed for the point of assembly, off the mouth of the Danube. Each
British steamer towed two sailing transports, the whole moving in
columns, the front and flank covered by men-of-war. There were 37
line-of-battle ships, 100 frigates and smaller men-of-war, 200 steam
and sailing transports, making a total of over 600 vessels.
The British ships anchored first off the mouth of the Danube, but
though the speed rate had been fixed at 4½ knots, too low to be
convenient to our steamers, it was too high for our Allies, whose
soldiers were mostly carried in sailing transports, which dropped
astern on the afternoon of the 11th, when some squalls rippled the
hitherto smooth sea. They were out of sight on the 12th, and
reached the point of concentration, forty miles west of Cape Tarkan,
on the afternoon of the 13th September, though the distance in a
straight line is only 300 miles.
The disembarkation was arranged on the model of that followed
by Sir Ralph Abercromby, when he landed in March 1801, in Aboukir
Bay. On the 14th September 1854, the men-of-war’s boats left their
ships, fully armed and provisioned with water and food for three
days, and we did not get back until 11.30 that night. All the boats
loaded with human freight were drawn up in one long line at 8.15
a.m., when the Captain, superintending from a fast pulling gig in the
centre, waved his flag as a signal for the line to advance. In one
hour the seven battalions composing the Light Division were on
shore, and by 3 p.m. we had landed 14,000 Infantry and two
batteries; nor were our Allies less expeditious, for they claimed to
have put 6000 on shore in less than 25 minutes.
Our Bluejackets were very careful of their brothers, and where
the plank was not long enough to ensure their landing with dry feet,
in most cases they were carried ashore in a sailor’s arms. We had
had an object lesson from a painful loss the French suffered; for in
Varna Bay, twenty Zouaves in heavy marching order were stepping
on a pontoon, which capsized, and all of them went to the bottom.
The officers landed in full dress, carrying sword, revolver, with
greatcoat rolled horseshoe fashion over the shoulder, some spirits in
the wooden water-bottle, then called a canteen, three days’ boiled
salt pork, and three days’ biscuit. The Rank and File being weak,
many still suffering with intestinal complaints, it was decided to
leave their knapsacks on board, and they were sent to Scutari. Each
soldier carried fifty rounds of ammunition, three days’ rations,
greatcoat and blanket in which was rolled a pair of boots, socks and
forage cap, of the curious pork-pie shape to which the Army clung
until a few years ago. It was a useless article, but not so
inconvenient as the handsome head-dress which our Generals liked,
but which the men discarded at the first opportunity. In the following
winter I saw battalions throwing away their full head-dress as they
left Balaklava.
Some horses were hoisted out of the ships into barges, others
were lowered into the sea, and the supporting sling being detached
by a tripping line, one or more horses were attached to the stern of
a boat, which, being rowed slowly to the shore, was followed by the
other horses. All reached land except three of Lord Raglan’s, which
on being lowered into the water swam out to sea, and were
drowned. At sunset a heavy ground swell broke up the rafts, and
obliged us to land all articles by passing them from man to man
standing in the water; but we continued to work till 11.30 p.m., re-
embarking in our boats on the Bluejackets’ shoulders some sick
soldiers.
It rained dismally that night, and the consequent discomfort and
recurrence of cholera induced an order for the tents to be landed,
but as we had invaded the Crimea without transport, the sailors had
to re-ship the tents again four days later. On the 15th, 16th, and
17th the Bluejackets were at work from daylight till dark, landing
Cavalry, Artillery, and ammunition. Before the 19th, we had taken
back to the ships 1500 men who were unable to march. Many of
these were stricken with cholera and must have suffered acutely, for
after they were on board the engines of the ship carrying them to
the Bosphorus broke down, and we had to tranship the unfortunate
men to another vessel.
The Sister Services saw a great deal of each other in those days,
and it was obvious to me then, as it is now, that in similar matters
there is much advantage in such association. No sailor would have
thought of putting away a part of his kit without a tally or mark on
the bag, but there were very few of the soldiers’ knapsacks sent to
Scutari which could be readily distinguished by any outward sign.
While we were landing the troops on the 14th September, H.M.S.
Vesuvius and Sampson, standing in to the mouth of the Bulganac
stream, shelled a Russian camp, and obliged the enemy to move it
inland. Rain fell steadily in the evening, and, lasting all night, when
day broke, came down so heavily as to cause great discomfort, and
added considerably to the number of the sick.
On the 19th September the armies moved southwards towards
Sevastopol, distant about twenty-five miles. The British force
consisted of 1000 sabres, 26,000 Infantry, and 60 guns. The French
had no Cavalry, 28,000 Infantry, and 68 guns, and their Commander,
Marshal Arnaud, had 7000 Turks under his orders. The troops, after
marching some six miles, bivouacked on the southern bank of the
Bulganac stream; next morning the troops “Stood to Arms” early, but
did not move till nine o’clock.
In a book published ten years ago, I described the battles of
Alma, Balaklava, and Inkerman. The first, on the 20th September, I
witnessed from the crosstrees of H.M.S. Queen, anchored off the
mouth of the river. The two Cavalry actions fought in the Tchernaya
Valley, on the 25th October 1854, though within two miles of our
camp, being below the plateau on which the Infantry camps were
pitched, were out of our sight. Captain Peel rode over and saw the
charges, but all those of us who were not in the batteries “Stood to
Arms” in camp. I refer to Inkerman farther on, but say no more
about the above battles than to show how their results, affected the
Naval Brigade.
The British casualties at the Alma numbered 2000 of all ranks.
That evening I took the Commander and some of the officers on
shore in the cutter, and saw as much as I could of the battleground
before my superiors returned from it. Before the action was over, we
had been ordered by the Admiral to have our surgeons ready for the
shore, and carrying parties of sailors had already relieved the
soldiers to some extent of the duty of transporting the sick on
stretchers to the beach. They had no transport, and therefore could
not move their sick or wounded, and it appeared to us it would have
been far better for the Army to have marched on the 21st, and have
left the entire work of collecting the sick and wounded and burying
the dead to the Navy. The troops did not move forward till the 23rd,
when we had buried over 700 bodies in and around the breastwork,
where the most determined struggle occurred.
The general impression in the Fleet was one of admiration for
certain battalions, but the hero of the battle was Lieutenant-General
Sir George Brown, then sixty-six years of age. We were told that he
rode in front of his Division. He distinguished himself forty years
earlier, when leading a section of the “Forlorn Hope” into the great
breach at Badajos. Though the Army smiled at his decided
conservative views, expressed generally in emphatic language,
everyone from Colonels to Buglers admired his courage.
During the night of the 22nd the Russians blocked the entrance
to the harbour of Sevastopol by sinking several of their ships in the
fairway. We lost sight of the armies when they returned inland on
the 25th September, to move round by Mackenzie’s farm to
Balaklava, which was taken over from the Commandant and a few
invalids.
On Sunday, the 1st October, I was Signal Midshipman of the
watch, and took over a message, “Line-of-battle ships will send 140
men and proportion of officers for service with land forces.” While
Captain Michell was discussing the details of the detachment, the
Commander sent me on board the ship of the Acting Commodore to
ask in what uniform the officers were to land. As I stood on the
quarterdeck, bare-headed, the Acting Commodore emerged from his
cabin, with a large prayer-book in hand. The ship’s company were
aft for Divine service, as in respectful tones I delivered my message.
He answered my question in emphatic language, which cannot be
repeated, but was to the effect that he did not care a —— if the
officers painted their bodies black and went naked. Now, if I had
repeated the very words, I should never have got on shore; for the
manners of the two captains were as distinct as possible, and yet
Michell had great admiration for his Superior, as is evident from one
of his letters to his wife I have recently had an opportunity of
perusing. It was written after he had returned from a Court Martial,
which sat to try the Acting Commodore for having run his ship
aground during the bombardment of the forts a month later, and is
warm in his expressions of admiration for the way in which the ship
was handled, and the courage, skill, and determination of the
Captain.
I paraphrased the order: “The Commodore’s compliments, and
he does not attach any importance to the question of uniform.”
When I delivered this message, our Captain and the Commander
were standing on the poop ladder, and grouped around were some
of the fortunate officers who had been chosen—the Commander, the
Lieutenant Gunnery Instructor, and another senior Lieutenant,
Lieutenant Douglas, and Mr. Sanctuary, a Mate, who was the only
gunroom officer then selected. I trembled with excitement as I saw
the Commander’s eye turn towards me, and then pass on towards
the next Midshipman. In those days we generally worked by
seniority, but the senior Midshipman had recently been in trouble for
having muttered when the Commander vituperated him for some
fault, real or imaginary. The next Midshipman, who knew his work,
had too high a wine bill to satisfy either the Commander or Captain.
They had no proof against him of taking too much alcohol, but their
suspicions were not without foundation; indeed, one or more suits of
his clothes passed to me in the guise of my wine bill, for though he
would not accept money he let me have them for the amount I was
allowed to expend on my monthly wine bill. Now the Captain, in
spite of his quiet, gentle, dignified manners, was one of the most
determined fire-eaters I ever met. He had always been much more
severe towards me, his nephew, than to my messmates, and had a
month earlier punished me for what was at the worst only an error
of judgment. I had received two verbal orders at the same moment;
the first man said, “You are to board—and ask——” while the second
man said, “You are to wait on the Captain.” When I did so, he
ordered me “Watch and watch” for not having gone to his cabin
before I obeyed the other order. Nevertheless, he was fond of me,
and in his letters to his sister, while he admits the propriety of a
Senior officer, Captain (afterwards Sir) Stephen Lushington, being
sent on shore, he adds, “As I could not go myself, I was determined
that our family should be represented;” and turning to the
Commander he asked, “Which Midshipman will you take?” “I am
thinking, sir.” “Then take young Wood.” “Oh, but he is too young, sir;
it will kill him.” “No, I think not; but I will answer for that.” And the
rugged Commander said, “Well, youngster, you shall go.”
The selected detachments went on board H.M.S. Firebrand for
passage to Balaklava, which is a curious inlet from the sea. When
the armies moving round from the north side of Sevastopol, having
crossed the Tchernaya Valley, looked down on their objective, they
saw below a little pool of water overshadowed east and west by
cliffs, from 500 to 600 feet high. The harbour is indeed small,—
about 300 yards wide,—but there is anchorage for half a mile, with
depth of water for even larger ships than we possessed in 1854, and
being landlocked the water is as smooth as an inland lake.
The historian, Mr. Kinglake, aptly named the treeless elevated
plateau on which England’s Army fought and won, but suffered and
starved for months, “The Upland.” The highest part of the crest is
500 feet above the Tchernaya Valley, and the plateau extends in a
straight line from north to south eight miles, if we reckon in the
elevated ground, Balaklava, and Sevastopol harbour. It is also nearly
eight miles from west to east, measuring from Kamiesh Bay, to the
height overlooking Tractir Bridge, on the Tchernaya River. For
practical purposes we may say the extent of ground over which the
British Army worked for nine months was in straight lines eight miles
by four.
The geological formation is peculiar. The elevated ground, or
Upland, being bounded by a cliff-like formation 800 feet high, which
runs generally, from the head of Sevastopol harbour on the north,
six miles south, and then trends away to the south-west, and
passing a mile north-west of Balaklava, joins the cliffs on the sea-
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like