Abstract

In this chapter, we present a new model of middleware for multi-micro-agent distributed systems. The proposed model is based on event-driven architecture using event sourcing and CQRS patterns. In this architecture the agent communication model uses a couple of buses. The command bus is used to dispatch commands intended to change the state of the agent, and the query bus is used dispatch queries intended to poll the agent domain state. This mechanism allows separating completely the read and the write sides of each micro-agent. The agent’s environment is managed in an aggregate component where command handlers perform the business logic intended to change the agent domain state. The command handling process is translated by firing a set of events across the event bus, which leads them to be stored in a distributed event store with different implementations. Accordingly, all other agents can subscribe to specific focused events, using event handlers to trigger the event processing, where each event’s data are projected into the agent reading repository. Thanks to those events, each agent can build its own independent environment representation using its appropriate data model. The goal is to eliminate interactions with other agents while reasoning at the runtime. The event bus model of this framework provides both the pub/sub and the polling patterns. So, we can use any broker to manage the event bus and the event store. In the current implementation the KAFKA broker is used as the distributed event bus and distributed event store. To perform distributed transactions, agents can use the mechanism of the SAGA pattern provided as a building block of the proposed framework. In this chapter, we will present the main components of the model architecture and highlight the strengths and weaknesses of the proposed model compared to existing solutions. To prove the performance of the proposed model, we have implemented a sample blockchain application based on this model and some stress tests have been performed.

Citation

M. Youssfi, F. Ezzahra Ezzrhari, Y. Hajoui, O. Bouattane, V. Kaburlasos, “Multi-micro-agent system middleware model based on event sourcing and CQRS patterns”. In: Smart Trajectories: Metamodeling, Reactive Architecture for Analytics, and Smart Applications, A. Boulmakoul, L. Karim, B. Bhushan (Eds.), chapter 2, pp. 25-46, 2022. CRC Press, Taylor & Francis Group: Florida, USA. eBook ISBN 9781003255635, DOI: 10.1201/9781003255635-2