Tutorial: Model a Business Process
Pools, lanes, gateways and a BPMN round-trip
You will build: an order process with pools, lanes and a gateway, export it as BPMN 2.0, and import it back into a fresh canvas. Time: about 20 minutes. Prerequisites: Beep.Skia and Beep.Skia.Business.
Steps
1. Pool and lanes
BpmnPoolNode is the process container; BpmnLaneNode splits it by role.
using Beep.Skia;
using Beep.Skia.Business;
var manager = new DrawingManager();
var pool = new BpmnPoolNode { X = 40, Y = 40, Width = 820, Height = 420, Label = "Order handling" };
manager.AddComponent(pool);
var sales = new BpmnLaneNode { X = 60, Y = 90, Width = 780, Height = 160, Label = "Sales" };
var warehouse = new BpmnLaneNode { X = 60, Y = 260, Width = 780, Height = 160, Label = "Warehouse" };
manager.AddComponent(sales);
manager.AddComponent(warehouse);
2. Events and tasks
var start = new StartEvent { X = 100, Y = 150, Width = 44, Height = 44, Label = "Order received" };
var review = new TaskNode { X = 220, Y = 140, Width = 150, Height = 70, Label = "Review order" };
var pick = new TaskNode { X = 220, Y = 300, Width = 150, Height = 70, Label = "Pick items" };
var end = new EndEvent { X = 700, Y = 310, Width = 44, Height = 44, Label = "Shipped" };
foreach (var node in new SkiaComponent[] { start, review, pick, end })
manager.AddComponent(node);
3. Gateway and flow
var decision = new Gateway { X = 430, Y = 140, Width = 60, Height = 60, Label = "Approved?" };
manager.AddComponent(decision);
manager.ConnectComponents(start, review);
manager.ConnectComponents(review, decision);
manager.ConnectComponents(decision, pick);
manager.ConnectComponents(pick, end);
foreach (var line in manager.GetLines())
line.RoutingMode = LineRoutingMode.Orthogonal;
4. Validate the process
The same validator used by every family catches orphans and dead ends before you export.
var validator = new DiagramValidator();
validator.AddDefaultRules();
var issues = validator.Validate(manager.GetComponents().ToList(), manager.GetLines());
foreach (var issue in issues)
Console.WriteLine($"[{issue.Severity}] {issue.RuleName}: {issue.Message}");
5. Export to BPMN
var exporter = new BpmnExporter();
string xml = exporter.Export(manager.GetComponents(), manager.GetLines(), "Order Handling");
File.WriteAllText("order-process.bpmn", xml);
The result opens in any BPMN 2.0 modeling tool (bpmn.io, Camunda Modeler, Signavio).
6. Import it back
Import into a fresh manager and check the warnings: unsupported constructs are reported rather than dropped silently.
var importer = new BpmnImporter();
var result = importer.Parse(File.ReadAllText("order-process.bpmn"));
Console.WriteLine($"process={result.ProcessName}, nodes={result.Components.Count}, flows={result.Flows.Count}");
foreach (var warning in result.Warnings)
Console.WriteLine($"warning: {warning}");
var roundTrip = new DrawingManager();
importer.LoadInto(roundTrip, File.ReadAllText("order-process.bpmn"));
Next steps
- Business process family — all node types and the rendered grid
- UML tutorial — when you model the system instead of the process
- Workflow engine — execute the process as automation