Commit ae88fda4 authored by Alzhan Turlybekov's avatar Alzhan Turlybekov
Browse files

update 12 tutorial readme

parent 05817f17
......@@ -2,48 +2,43 @@
## Workflow Steps
```php
const steps = (
"class:BasicsChangeOrderStatusToInProgress:1.0",
(
"class:BasicsSendMoneyToBank:1.0",
("class:BasicsSendMoneyToUser:1.0", "class:BasicsSendEmailToUser:1.0"),
),
"class:BasicsChangeOrderStatusToCompleted:1.0",
);
```yaml
steps:
[
"BasicsChangeOrderStatusToInProgress:1.0",
"BasicsSendMoneyToBank:1.0",
"BasicsSendMoneyToUser:1.0",
"BasicsSendEmailToUser:1.0",
"BasicsChangeOrderStatusToCompleted:1.0"
]
```
![alt-text](img/1.png)
This workflow consists of 5 steps:
+ The first step **BasicsChangeOrderStatusToInProgress** changes order status to in progress. This step uses the **changeStatus()** method of the **BasicsChangeOrderStatus** class, which will be loaded into the workflow's Program space once the workflow is loaded to Qorus. This class is defined in the workflow definition file as following:
```php
"classes" : ("BasicsChangeOrderStatus",),
+ The first step **BasicsChangeOrderStatusToInProgress** changes order status to in progress. This step uses the **changeStatus()** method of the **BasicsChangeOrderStatus** class, which will be loaded into the workflow's program space once the workflow is loaded to Qorus. This class is defined in the workflow definition file as following:
```yaml
classes:
- BasicsChangeOrderStatus
```
+ The second step **BasicsSendMoneyToBank** is executed in parallel with the third step. This step simulates money transaction to bank. It calculates amount that should be sent based on given exchange rates when order was created.
+ The second step **BasicsSendMoneyToBank** simulates money transaction to bank. It calculates amount that should be sent based on given exchange rates when order was created.
+ The third step **BasicsSendMoneyToUser** just logs the amount user wanted to buy intially.
+ The fourth step **BasicsSendEmailToUser** is executed when the **BasicsSendMoneyToUser** step is finished and in the same thread. This step uses SmtpClient module to send a notification email to a user. [SmtpClient](https://qoretechnologies.com/manual/qorus/latest/qore/modules/SmtpClient/html/class_smtp_client_1_1_smtp_client.html) object is obtained by [**getUserConnection()**](https://qoretechnologies.com/manual/qorus/latest/qorus/classOMQ_1_1UserApi_1_1UserApi.html#a6b6cf455c01fc92c3176074faa85a202) method. The name of the user connection is [**smtp-email**](#smtp-email-user-connection) (setup is described below).
+ The fifth **BasicsChangeOrderStatusToCompleted** is called once **BasicsSendMoneyToBank** and **BasicsSendEmailToUser** steps are in completed state. This step also uses **changeStatus()** method of the **BasicsChangeOrderStatus** class to change the status of orders to completed.
+ The fourth step **BasicsSendEmailToUser** uses the SmtpClient module to send a notification email to a user. [SmtpClient](https://qoretechnologies.com/manual/qorus/latest/qore/modules/SmtpClient/html/class_smtp_client_1_1_smtp_client.html) object is obtained by [**getUserConnection()**](https://qoretechnologies.com/manual/qorus/latest/qorus/classOMQ_1_1UserApi_1_1UserApi.html#a6b6cf455c01fc92c3176074faa85a202) method. The name of the user connection is [**smtp-email**](#smtp-email-user-connection) (setup is described below).
## Workflow Design
Please note that this workflow is only for training purposes showing the basics of Qorus and how to use parallel steps. But in real-world cases you should use [array step](https://www.qoretechnologies.com/manual/qorus/latest/qorus/designimplworkflows.html#arraysteps) which should be used when a step needs to repeat its action more than once. But this topic is more advanced and will be covered in the advanced training.
+ The fifth **BasicsChangeOrderStatusToCompleted** is called once the **BasicsSendEmailToUser** step is in completed state. This step also uses **changeStatus()** method of the **BasicsChangeOrderStatus** class to change the status of orders to completed.
## Smtp Email User Connection
Setup the emal user connection as in the screenshot below or deploy the *smtp-email.qconn* file to Qorus:
![alt-text](img/2.png)
**URL string**:
```php
esmtptls://test.qorus:Atb12345@smtp.gmail.com
Add the emal user connection to Qorus using the *smtp-email.qconn.yaml* file:
```yaml
type: connection
name: smtp-email
desc: SMTP email connection
url: esmtptls://test.qorus:QQQ1234qqq!!!@smtp.gmail.com
```
The url is in the following format:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment