thekid/rfc — Issue #114: RFC 0114: Generic Workflow API
Author: thekid
Created: 2011-10-09 15:11:21+00:00
State: open
Labels: draft, rfc

Scope of Change
====

Rationale
====

Functionality
====

```
(*)
|
|
.----------------------.
| Fetch email address |
| from payload data, |
| lookup if n/a |
'----------------------'
|
|
.----------------------.
| Send email |
| |
| |
'----------------------'
|
|
/ \
/ \ No .-------------.
/ OK? \________________| Error |
\ / | |
\ / '-------------'
\ /
| Yes
|

```

From scratch
----

```php
onCompleted()->add(...);
$workflow->onTerminated()->add(...);

// Path
$initial= $workflow->initial();
$initial->addActivity(new MethodActivity($class->getMethod('aggregateEmail')));
$initial->addActivity(new MethodActivity($class->getMethod('sendEmail')));

// Branching
$initial->addActivity(new IfElseActivity(
$workflow->newBranch(new Condition(...))->addActivity(new TerminateActivity()),
$workflow->newBranch()->addActivity(new TerminateActivity())
));

// Create & run
$instance= $workflow->newInstance();
$instance->setPayload(...);
$instance->start();
?>
```

Security considerations
====

Speed impact
====

Dependencies
====

Related documents
====
- http://www.odetocode.com/Articles/455.aspx
Windows Workflow: The Base Activity Library

Comments
====