Skip to Content
Practical Microservices
book

Practical Microservices

by Ethan Garofolo
April 2020
Intermediate to advanced
292 pages
6h 50m
English
Pragmatic Bookshelf
Content preview from Practical Microservices

Writing Your First Message

Okay, when we left the record-viewings application, we were in the function that would record that a video was viewed. Here’s where we left off:

 function​ createActions ({
  db
 }) {
 function​ recordViewing (traceId, videoId) {
  }
 
 return​ {
  recordViewing
  }
 }

We decidedhere that we’ll use VideoViewed events to record video views. We’ll write these events to streams of the form viewing-X, where X is the video’s ID. So all we need to do in this function is build the event we’re going to write and then write it to the Message Store:

The Code Directory Has Changed

From this point going forward in the book, the code is in the code/video-tutorials/ folder.

If you’re ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microservices in Action

Microservices in Action

Morgan Bruce, Paulo A Pereira
Microservices: Up and Running

Microservices: Up and Running

Ronnie Mitra, Irakli Nadareishvili
Kubernetes Best Practices

Kubernetes Best Practices

Brendan Burns, Eddie Villalba, Dave Strebel, Lachlan Evenson

Publisher Resources

ISBN: 9781680507782Errata Page