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

Making the Message Store Aware of Origin Streams

In code/video-tutorials/src/message-store/subscribe.js we wrote getNextBatchOfMessages which retrieves the batches of messages in the category we’re subscribing to. For subscriptions that have an originStreamName, we’ll further filter that query result based on whether or not the messages have that originStreamName in their metadata.

First the filtering function:

1: const​ category = require(​'./category'​)
function​ configureCreateSubscription ({ read, readLastMessage, write }) {
// ...
function​ filterOnOriginMatch (messages) {
5: if​ (!originStreamName) {
return​ messages
}
return​ messages.filter(message => {
10:  ...
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