Skip to content

Instantly share code, notes, and snippets.

View geomagilles's full-sized avatar

Gilles Barbier geomagilles

View GitHub Profile
<?php
use Zenaton\Interfaces\WorkflowInterface;
use Zenaton\Traits\Zenatonable;
use Zenaton\Tasks\Wait;
class NotifyEtaWorkflow implements WorkflowInterface
{
use Zenatonable;
// inform user # seconds before ETA
<?php
use Zenaton\Interfaces\WorkflowInterface;
use Zenaton\Traits\Zenatonable;
use Zenaton\Tasks\Wait;
class NotifyEtaWorkflow implements WorkflowInterface
{
use Zenatonable;
// inform user # seconds before ETA
<?php
use Zenaton\Interfaces\WorkflowInterface;
use Zenaton\Tasks\Wait;
use Zenaton\Traits\Zenatonable;
class RequestManagementWorkflow implements WorkflowInterface
{
use Zenatonable;
<?php
...
public function handle()
{
...
// select a set of providers for this request
$providers = (new SelectProvidersForRequest($this->request))->execute();
<?php
...
public function handle()
{
...
// wait for at most 3 providers quotation, 3 days maximum
$event = (new Wait(ProvidersQuotationGatheredEvent::class))->days(3)->execute();
<?php
...
public function handle()
{
...
// if no response received in 3 days
if (0 == count($this->quotations)) {
<?php
use Zenaton\Interfaces\WorkflowInterface;
use Zenaton\Tasks\Wait;
use Zenaton\Traits\Zenatonable;
class RequestManagementWorkflow implements WorkflowInterface
{
use Zenatonable;
const { Workflow, Task, Wait } = require("zenaton");
// start child workflow
let StartChildWorkflow = Task("StartChildWorkflow", {
init(users, id) {
this.users = users;
this.id = id;
},
handle: async function() {
await new ChildWorkflow(this.user, this.id).dispatch()
@geomagilles
geomagilles / hello_world.js
Created November 19, 2019 15:53
Hello World Zenaton
function hello(name) {
console.log('Hello world ' + name)
}
@geomagilles
geomagilles / hello_world.js
Created November 19, 2019 15:54
Hello World Zenaton
function hello(name) {
console.log('Hello world ' + name)
}