O'Reilly logo

Mastering ServiceStack by Andreas Niedermair

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Intercepting requests and responses

A very basic scenario that is perfectly applicable amongst multiple services in a distributed environment is the need for a global identifier that travels from top to bottom of every request. This is often needed to determine which request to one API caused which request to another API; for example, to trace all the operations caused by a certain button-click in the UI.

This can be achieved by generating an identifier in the first service call and storing it along with the request. Whenever a service boundary is crossed, for example by forwarding the request to another service, the current identifier needs to be injected into that call.

First, we will define an interface that can be implemented by requests and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required