Akka in Action, Second Edition by Francisco Lopez-Sancho Abraham;

Akka in Action, Second Edition by Francisco Lopez-Sancho Abraham;

Author:Francisco Lopez-Sancho Abraham; [Abraham, Francisco López-Sancho]
Language: eng
Format: epub
Publisher: Simon & Schuster
Published: 2023-06-19T22:00:00+00:00


9.3.4 Tagging

When you save to the journal, you usually mark each event so other processes can read the journal by filtering for those marks. After all, the journal is just a table in a database. The tagging is done as follows:

EventSourcedBehavior[Command, Event, State](...) .withTagger( _ => Set("tag1", "tag2")) ❶

❶ Adds these two tags no matter what event

Another typical use case for tagging is to parallelize reading by assigning a set of IDs to a tag so each reader can focus on a particular tag, just like a partition. You can use both in the container to tag specific events and parallelize:

.withTagger{ case event: CargoAdded => Set("container-tag-"+ containerId.toInt % 3, "CargoAdded") ❶ case _ => Set("container-tag-"+ containerId.toInt % 3) ❷ }

❶ Adds these two tags when CargoAdded

❷ Adds only this tag for the rest of the events

These settings allow a maximum parallelism of 3 to read CargoAdded events or the rest of the events as a whole.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Developing Robust Date and Time Oriented Applications in Oracle Cloud by Michal Kvet(6821)
Practical Guide to Azure Cognitive Services by Chris Seferlis & Christopher Nellis & Andy Roberts(5949)
Unity Artificial Intelligence Programming - Fifth Edition by Dr. Davide Aversa(5548)
Serverless ETL and Analytics with AWS Glue by Vishal Pathak Subramanya Vajiraya Noritaka Sekiyama Tomohiro Tanaka Albert Quiroga Ishan Gaur(4698)
Open Source Projects - Beyond Code by John Mertic(3772)
The AI Product Manager's Handbook by Irene Bratsis(3745)
Graph Data Modeling in Python by Gary Hutson and Matt Jackson(3740)
Cloud Auditing Best Practices by Shinesa Cambric & Michael Ratemo(3364)
Aligning Security Operations with the MITRE ATT&CK Framework by Rebecca Blair(3339)
Graph Data Processing with Cypher by Anthapu Ravindranatha;(1538)
Data Literacy in Practice - A complete guide to data literacy and making smarter decisions with data through intelligent actions (2022) by Packt(1517)
Serverless Machine Learning with Amazon Redshift ML: Create, train, and deploy machine learning models using familiar SQL commands by Debu Panda Phil Bates Bhanu Pittampally Sumeet Joshi(1419)
Network Automation with Go by Nicolas Leiva & Michael Kashin(1368)
Data Literacy in Practice by Angelika Klidas Kevin Hanegan(1305)
Applied Machine Learning and High-Performance Computing on AWS by Mani Khanuja | Farooq Sabir | Shreyas Subramanian | Trenton Potgieter(1303)
Graph Data Processing with Cypher by Ravindranatha Anthapu(1292)
Unreal Engine 5 Game Development with C++ Scripting by Zhenyu George Li(1169)
Implementing Multifactor Authentication: Protect your applications from cyberattacks with the help of MFA by Marco Fanti(1163)
Fuzzing Against the Machine: Automate vulnerability research with emulated IoT devices on QEMU by Antonio Nappa Eduardo Blazquez(1157)
The AI Product Manager's Handbook: Develop a product that takes advantage of machine learning to solve AI problems by Irene Bratsis(1016)