如何在具有多个有界上下文的系统中自动(或至少正确地)创建User? [英] How can I atomically (or at least properly) create User in the system with multiple bounded contexts?

查看:95
本文介绍了如何在具有多个有界上下文的系统中自动(或至少正确地)创建User?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在系统中注册用户.没有角色就不能存在用户(没有登录名和密码就一定不能存在用户).管理员应该能够通过选择角色,编写登录名/密码和一些用户信息来添加新用户.登录/密码/安全问题实现为单独的应用程序/BC(身份验证上下文),角色和权限位于授权上下文中,而用户信息位于单独的帐户管理上下文中.如果所有这些上下文理论上都可以部署在单独的计算机上,那么我该如何实现用户注册过程?目前,我正在使用应用程序接口,该接口使用基础结构服务实现将所有需要的命令同步且原子地发送到不同的BC(当前是同一大应用程序).

I need to register user in the system. User cannot exist without a Role (and he surely cannot exist without login and password). Administrator is supposed to be able to add new users by selecting role, writing login/password and some user information. Login/password/security concerns are implemented as separate application/BC (authentication context), roles and permissions are in authorization context and user information is in separate account management context. How can I implement user registration process if all these contexts could be in theory deployed on separate machines? For now I'm using application interface that uses infrastructure service implementation to synchronously and atomically send all needed commands to different BCs (currently it is the same big application).

推荐答案

可能是因为您在有限的上下文中粒度太细.通常,当您所指的概念在多个有界上下文中是完全相同时,就表明了这一点.

It may be that you have gone down to a too fine degree of granularity with your bounded contexts. An indication of this is usually when the concept you are referring is the exact same thing in more than one bounded context.

User管理(注册/身份验证/授权)之类的事情通常由 Identity&访问控制关联上下文.

Things like User management (registration / authentication / authorization) is typically handled by an Identity & Access Control Bounded Context.

在您的下游有限上下文中,User具有不同的含义/概念:作者,主管等.

That User would have different meanings / concepts in your downstream bounded contexts: e.g. Author, Supervisor, etc.

但是,如果您确定想要该级别的粒度,则必须为用户选择一个记录系统,并且 绑定上下文会拥有用户并负责流程经理的状态,并查看注册直至完成;虽然,我通常希望将流程管理本身作为一个受限的上下文,并且 it 可以在其他环境中进行协调.

However, if you are sure that you want that level of granularity then you are going to have to pick a system of record for your user and that bounded context would own the user and be responsible for the process manager state and seeing the registration through to completion; although, I usually like to have my process management as a bounded context in and of itself and it can orchestrate among the others.

至于原子操作……我不知道这样做是否一定很明智:)

As for doing so atomically... I don't know whether this would necessarily be wise to attempt :)

这篇关于如何在具有多个有界上下文的系统中自动(或至少正确地)创建User?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆