Structure of the node base file#
ไฟล์ node base จะมีโครงสร้างหลัก ๆ ดังนี้:
- ใส่ import statements.
- สร้าง class สำหรับ node.
- ใน class node ให้สร้าง object ที่ชื่อว่า
description
ซึ่งจะกำหนดรายละเอียดของ node
ถ้าเป็น node แบบ programmatic-style จะต้องมี method execute()
ด้วย ซึ่ง method นี้จะอ่านข้อมูลที่เข้ามาและ parameters แล้วสร้าง request ขึ้นมา ส่วนแบบ declarative จะใช้ key routing
ใน object properties
ที่อยู่ใน descriptions
แทน
Outline structure for a declarative-style node#
โค้ดตัวอย่างนี้เป็นโครงสร้างของ node แบบ declarative
1 2 3 4 5 6 7 8 9 10 |
|
Outline structure for a programmatic-style node#
โค้ดตัวอย่างนี้เป็นโครงสร้างของ node แบบ programmatic
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
ดูรายละเอียด parameters ที่ใช้ได้กับ node ทุกประเภทได้ที่ Standard parameters และสำหรับ programmatic-style nodes ดูที่ Programmatic-style parameters และ Programmatic-style execute method