Job Seek Development Journal - 3
In last journal, I mainly focused on setting up TDD framework and exploring EF Core. Now, I need to start think in DDD and try to form a simple domain.
Message
Before exploring user search bounded context, some constrains need to be added.
- Message: Messages passed inside Job Seek such as commands and events
// IMessage.cs
public interface IMessage
{ }
- Command: Message that trigger a procedure in Job Seek.
// ICommand.cs
public interface IMessage
{ }
- Event: Message that show things happened in Job Seek.
// IEvent.cs
public interface IEvent
{ }
- Message Bus: Message bus manage all message in Job Seek, such as pub / sub to message, state control and so on.
// IBus.cs
public interface IBus
{ }
User search Bounded Context
To begin with, user search bounded context is the cornerstone of this application. The figure below displays the main process when user try to search jobs by keywords and location.
-
The UI send command to search for eg: ‘developer’ in ‘hobart’. This command will create a query aggregate with it id as hash of keywords, location and time interval (time round down??).
-
The query aggregate will be persisted into database
-
Event query created will be raised and sent to message bus? – global? local?
- Message bus will send command Scrapy jobs according to query aggregate and route to Job aggregate in scrapy context
- scrapy services will be discussed later
-
Job aggregate check if there is is a cache hit
- If not cached scrapy jobs then raise jobs fetched event if cached directly raised
- There are two types of search here: list search and detailed search discussed later
- If cached steps 7 - 9 should be ignored
- If not cached process to detailed Job search which all raise sequence of job fetched events
-
Message bus the send command Tag Job
-
After Tag service tagged job job aggregate will raise job tagged event
- Job aggregate and query aggregate will be updated and persisted