Mastering ServiceStack
eBook - ePub

Mastering ServiceStack

Andreas Niedermair

Share book
  1. 216 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering ServiceStack

Andreas Niedermair

Book details
Book preview
Table of contents
Citations

About This Book

Utilize ServiceStack as the rock solid foundation of your distributed system

About This Book

  • Take advantage of the various data providers to access authentication and authorization, sessions, cache, and database
  • Leverage asynchronous processing for decoupling components to ease scaling
  • Monitor and tune the performance of your distributed system

Who This Book Is For

Mastering ServiceStack is targeted at developers who have already implemented web services with ASMX, WCF, or ServiceStack and want to gain more insight into the possibilities ServiceStack has to offer to build distributed systems of all scales.

What You Will Learn

  • Design a prudent and resilient API, following the RESTful design
  • Understand the internal processing chain and utilize the provided hooks
  • Incorporate ServiceStack as a full service provider to your existing distributed system
  • Leverage the power of asynchronous processing and add message queues to your architecture
  • Analyze and tune the performance of your service

In Detail

Mastering ServiceStack covers real-life problems that occur over the lifetime of a distributed system and how to solve them by deeply understanding the tools of ServiceStack. Distributed systems is the enterprise solution that provide flexibility, reliability, scaling, and performance. ServiceStack is an outstanding tool belt to create such a system in a frictionless manner, especially sophisticated designed and fun to use.

The book starts with an introduction covering the essentials, but assumes you are just refreshing, are a very fast learner, or are an expert in building web services. Then, the book explains ServiceStack's data transfer object patterns and teach you how it differs from other methods of building web services with different protocols, such as SOAP and SOA. It also introduces more low-level details such as how to extend the User Auth, message queues and concepts on how the technology works.

By the end of this book, you will understand the concepts, framework, issues, and resolutions related to ServiceStack.

Style and approach

A step-by-step approach that follows the natural requirements of a distributed system in a conversational style.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering ServiceStack an online PDF/ePUB?
Yes, you can access Mastering ServiceStack by Andreas Niedermair in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione open source. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781783986583

Mastering ServiceStack


Table of Contents

Mastering ServiceStack
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Distributed Systems and How ServiceStack Jumps in
A message-based service
The processing chains of ServiceStack
HTTP context
Message Queue context
A brief history of distributed systems
The design principles of an API
Usage convenience
Documentation
Consistency
Robustness
Authentication, authorization, and security
Problems with distributed systems
Complexity in design
A broader set of skills
Testing
Rollout
Operating overhead
Tracing
Contracts
Issues at runtime
(Un)atomicity of operations
A shared register
Performance
Summary
2. ServiceStack as Your Unique Point of Access
The IoC container
Registering dependencies
Resolving dependencies
Lifetime of objects
Disposal of objects
Initialization of instances
Custom IoC frameworks
Incorporating the IoC container in your application
The Ticket application
Domain design
The ticket model
The comment model
RESTful design
The TicketService API
The CommentService API
Data access
Functional contract testing
Sessions
Session sharing between your service and a web application
Using the ServiceStack session
Using the ASP.NET session
Cache
Caching session data
Caching responses
Authentication and authorization
Authentication providers
Authentication repository
Limiting access
Processing chain
Adding authentication and authorization to the Ticket application
Extending authentication and authorization
Sliding authentication
Extending the authentication session
Customizing the user entity
Authentication events
Creating a custom authentication provider
Provide credentials in RequestDTOs
Authorization information in the HTTP header
Summary
3. Asynchronous Communication between Components
In Memory MQ
RCON
RedisMQ
Setup
Client managers
Queues
Replying directly back to the producer
Integrate a RedisMQ client into your service
RabbitMQ
Setup
Processing chain
Replying directly back to the producer
Broadcasting a message
Integrate RabbitMQ into your service
Server-sent events
Sending messages from the server
Hooks at the client-side
Subscription events
Receiving messages
Sending messages
Server-side usage of server-sent events
Receiving messages
Sending messages
Configure ServerEventsFeature
Redis server events
Look left and right
Authentication
Filtering requests and responses
Statistics
Summary
4. Analyzing and Tuning a Distributed System
Request logging
Using another data store for your request log entries
Centralizing request logging
Tracking requests of your website
Profiling requests
Profiling self-hosted requests
Profiling database requests
Adding custom steps for fine-grained profiling
Centralizing request profiling
Minimizing the footprint of HTTP requests
Batching requests
Customizing automatic batching
Implementing a RequestDTO to represent a collection
Compressing requests
Compressing responses
Adding MessagePack format
Adding Protobuf format
Accessing information provided by RequestInfoFeature
Summary
5. Documentation and Versioning
Metadata page
Extending the documentation of an operation
Configuring the Metadata page
Customizing templates
HtmlFormat.html
IndexOperations.html
OperationControl.html
Type generator
Querying your service with Swagger
Querying your service with Postman
Versioning requests
Validating your requests
Querying the registered ValdationRules with an API
Summary
6. Extending ServiceStack
Writing your own plugin
Intercepting requests and responses
Registering new services and endpoints
Summary
Index

Mastering ServiceStack

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2015
Production reference: 1211015
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-658-3
www.packtpub.com

Credits

Author
Andreas Niedermair
Reviewers
Stephane Belkheraz
Herdy Handoko
Emad Karamad
Dony Perdana
Cory Taylor
Commissioning Editor
Kunal Parikh
Acquisition Editor
Kevin Colaco
Content Development Editor
Zeeyan Pinheiro
Technical Editor
Saurabh Malhotra
Copy Editor
Sneha Singh
Project Coordinator
Suzanne Coutinho
Proofreader
Safis Editing
Indexer
Priya Sane
Production Coordinator
Nitesh Thakur
Cover Work
Nitesh Thakur

About the Author

Andreas Niedermair is a .NET developer who is rooted in the web fraction (and still affiliated with it). He has worked in numerous enterprise environments building leading industry solutions and has also contributed to the open source community. He is always striving for a deeper understanding of technology to stay on the cutting edge.
He contributed to the ServiceStack 4 Cookbook as a technical revi...

Table of contents