How to model parallel processes (in a Bounded Context) with the same data store?

The situation. Let’s say a background process puts stuff into data containers. It runs all the time, observes system events, and populates the data accordingly.

The user may launch a control panel application. With this application, the user can define new containers, rename or delete old ones. The panel is separated from the actual workhorse process to not accidentally take it down when it crashes.

For the sake of the example, let’s assume the background process increases a counter for each container by 1 every minute. It’s a lifetime counter. It needs to know about the containers. It’s the only process which modifies the counters, though.

The control panel should display a list of containers and the current count. It should update a displayed count when needed (i.e. when the counter changed in the meantime). It needs to read the data but not write it — except maybe for mutating the set of containers.

The question. Both processes operate on a similar domain. Both need to know about containers and counts. They only do different things with them. Now how would you model this in terms of DDD?

I pondered if they were different Bounded Contexts, but since the domain seems to be exactly the same, there’s no indicator that this is necessary. The separation between both is merely technical. Maybe do some kind of RPC?

How should the processes share data? Should the control panel become a read-only process, access the same data store the background process writes to, and delegate container creation to the background process so writing is unified? (Is this CQRS already?)

Use a pub/sub framework like nServiceBus. The control panel can subscribe to update events on the domain model. The background process will emit the update events. When the control panel first starts up, it will send a command to the background process to tell it to send all the info it needs.

Messages will contain serialized domain objects. The framework deals with making sure they get there. For example with nServicebus you can use MSMQ and be on separate machines (of course or the same one but here I’m assuming the control panel is running on a webserver and the update process is running on an app server).

Now for updates, the control panel can send commands via the bus to the update process, reflecting what update is wants. Same idea, serialize some info and put it on the bus. The UI can then block (OK give the poor user a throbber) until the next update message is received. Or, it can have an ‘update pending’ message in the header area that turns into ‘refresh’ or actually has the UI refresh (watch out if the user is onto something else…)

You might not want to throw all these new infrastructure pieces into your shop. But standing up pub/sub (inversion of communications SOA pattern) gives you so many options, you’ll jump for joy.

3

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật