Skip to content

Commit 01a318c

Browse files
committed
Update configs files and readme
1 parent 6f2cfdb commit 01a318c

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

.styleci.yml

-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,3 @@ php:
99
not-name:
1010
- index.php
1111
- server.php
12-
js:
13-
finder:
14-
not-name:
15-
- webpack.mix.js
16-
css: true

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ The project is composed of 4 resources:
163163

164164
### Transactors
165165

166-
At the moment the application uses two transactors/vendors for delivering emails
167-
(in this order):
166+
An implementation of `MailerTransactor`. At the moment the application uses two
167+
transactors/vendors for delivering emails (in this order):
168168

169169
- **Mailjet**
170170
- **Sendgrid**
@@ -183,9 +183,10 @@ on it (which are used by the tests).
183183

184184
### Worker
185185

186-
The email worker implements the Chain of Responsibility pattern
187-
when attempting to deliver emails. It tries to send an email through a given vendor,
188-
if it doesn't work then it tries with the next one and so on.
186+
The email worker has an array of `MailerTransactors` and it tries to send an email
187+
through each one, in case of one failing then it goes to the next,
188+
in case of success it finishes the worker with a boolean `true`, making it clear
189+
the email was sent. If none vendor worked, then the worker finishes with a `false`.
189190

190191
In case of being needed to add a new vendor then these are the steps required:
191192

@@ -194,12 +195,9 @@ In case of being needed to add a new vendor then these are the steps required:
194195
- Create a connector class for the new vendor service
195196
- Example: the `Mailjet` connector creates an instance of a `Mailjet Client` (third-party vendor).
196197
- Create a **singleton** instance for the new connector created (in `EmailServiceProvider`).
197-
- Create a transactor class for the new vendor service. This transactor will be responsible
198-
for preparing the payload, sending the email and calling the trigger
199-
(to call the next transactor in case of failure).
200-
- Update the last transactor already created by injecting the new transactor as a dependency.
201-
- Update the last transactor `sendTrigger` method to call the new transactor
202-
(just like it's done in `MailjetTransactor` class, in `sendTrigger` method).
198+
- Create a transactor class for the new vendor service. This transactor will be responsible for
199+
sending the email only. This transactor must implements `MailerTransactor` interface.
200+
- Add the new transactor to the `AppServiceProvider`, as a dependency in the `EmailWorker` bind.
203201

204202
### Queue
205203

@@ -294,6 +292,8 @@ $ docker-compose -f infrastructure/docker-compose.yml up --scale email=2 --scale
294292
- Create a frontend application to list the messages based on endpoint created above
295293
- Create a form in the frontend in order to also create new emails
296294
- Add Swagger for API documentation
295+
- Add a repository for the `Queue` entity
296+
- Add Kubernetes to the stateful and stateless resources
297297

298298
## API - Resources
299299

config/app.php

+2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@
177177
App\Providers\EventServiceProvider::class,
178178
App\Providers\RouteServiceProvider::class,
179179
App\Providers\EmailServiceProvider::class,
180+
App\Providers\EmailConsumerServiceProvider::class,
181+
App\Providers\EmailPublisherServiceProvider::class,
180182
AmqpServiceProvider::class,
181183

182184
],

phpunit.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<whitelist processUncoveredFilesFromWhitelist="true">
2424
<directory suffix=".php">./app</directory>
2525
<exclude>
26-
<file>./app/Console/Commands/EmailConsumer.php</file>
26+
<directory suffix=".php">./app/Console/Commands/Consumer</directory>
2727
<directory suffix=".php">./app/Http/Controllers/Auth</directory>
2828
<directory suffix=".php">./app/Http/Middleware</directory>
2929
</exclude>

0 commit comments

Comments
 (0)