Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using ServiceStack.Redis for publish/subscribe


Background processing of the CPU or resource intensive tasks should leverage asynchrony and can add to both scalability and performance when done correctly. Tasks that don't need to be done while the user waits are particularly good candidates for asynchronous execution.

Consider, for instance, a user logging in to a website. It may be true that several systems need to be involved on each login: a security audit, a Big Data sensor, and the actual authentication system with the correct usernames and passwords—a task that fetches the user's preferences concerning e-commerce purchases. You might find that while the authentication system needs to be involved to properly log in a user, several of the other tasks could be processed in the background.

Redis models this with the concepts of channels, publishers, and subscribers. A subscriber, a system that needs to be alerted of events, might create a subscription to a specific channel. Publishers publish...