In a blog application developed using domain driven design a Post entity has a related collection of tag entities.
On creating the post (e.g populating the object from the UI) i would like to call a third party API via REST which takes the content of the post and extracts semantic tags (link text) for association.
Main Question : What is the best way to design this...
Is it best designed so that the Post entity would call a domain service such as PostServices.GetTags(Postcontent) passing its content and retrieving back a list of tags.?
** PostServices.GetTags would then inteface with the REST API via a further wrapper class.
Or should the third party API be wrapped as a repository?
Should the function Post.GenerateTags(), should not exist within the domain entity at all?
Further questions :
1 : I have also read that it is not good practice to have a domain entity converse with a domain service. Is this true?
2 : Is it ok to get a reference to the PostServices domain service via a factory creation method. e.g...
IPostService PostService = ServiceUtil.GetPostService(); return PostService.GetTags(Post.content);
3 : Is it acceptable to have the domain service coupled to a third party api?
4 : Should the domain entity simply just know how to deal with the tags received via the application layer which has called the REST API.
Slowly trying to get my head around DDD, however I can t seem to find any examples of how to implement this sort of thing.