Hello,
I’m new to Elixir and kind of new to the whole architecture of separate applications communicating together.
I’m working on a Crawler of some webpages, I need to scan whole web and store results into database.
I have this architecture right now
Crawler->start()
|- UrlManager.start_link()
|- QueueManager.start_link()
|- Fetcher.start_link() // 2x
`- ResultsManager.start_link()
Crawler->crawl("https://www.somedomain.com")
|
v
+--------------+ +--------------------------+
| Url Mangager | ---> | Queue Manager / Producer |
+--------------+ +--------------------------+
^ |
| v
| +--------------------+
`------------------| Fetcher / Consumer |
+--------------------+
|
v
+-----------------------+
| Results Manager / DB |
+-----------------------+
Currently one process calling another process and assuming there is a process name based on a module.
Now the question is, what’s better approach if I need crawl mutiple domains.
I wanted to create instances of all apps and pass these
domain = "https://www.somedomain.com"
{:ok, results_manager} = ResultsManager.start_link()
{:ok, fetcher} = Fetcher.start_link(results_manager)
{:ok, queue_manager} = QueueManager.start_link(fetcher)
{:ok, url_manager} = UrlManager.start_link(queue_manager, domain)
The problem is that there is cyclic dependency of Url Manager, Queue Manager and Fetcher, so this approach isn’t probably good one.
Is there any best practice how to do similar architecture in Elixi? How to scope a flow through multiple apps?
Sorry for newbie question …