ok
- - -- - - -
diff --git a/docs/bpmnDsl.html b/docs/bpmnDsl.html index cbd9cb05..d6344dd2 100644 --- a/docs/bpmnDsl.html +++ b/docs/bpmnDsl.html @@ -75,16 +75,21 @@
@@ -95,46 +100,118 @@This DSL will bring your domain into your BPMN-Process.
-Its elements are more or less constructors with the same structure:
-BPMN_ELEMENT(
- id: String,
- in: Input,
- out: Output,
- descr: Optable[String]
-)
+ As the pattern is always the same, we can setup each BPMN Element in the same way.
+object BpmnElement extends CompanyBpmn<Element>Dsl:
+
+ val processName = "mycompany-myproject-myelement" // depending on the element this can be different
+ lazy val descr = "my element..."
+
+ case class In(...)
+ object In:
+ given ApiSchema[In] = deriveApiSchema
+ given InOutCodec[In] = deriveInOutCodec
+
+ case class Out(...)
+ object Out:
+ given ApiSchema[Out] = deriveApiSchema
+ given InOutCodec[Out] = deriveInOutCodec
+
+ lazy val example = <bpmnElement>(
+ In(),
+ Out(),
+ )
+end BpmnElement
So each BPMN Element has:
processName
, messageName
etc.If you have an Enum as an In or Out class, you need to define the example like this:
+
+lazy val example = <bpmnElement>(
+ In.CaseA(),
+ Out.CaseA(),
+ ).withEnumInExamples(In.CaseB())
+ .withEnumOutExamples(Out.CaseB())
+ We support the following elements:
+ +The Process is the main element of a BPMN. + It is the most complex element and looks like this:
+object MyProcess extends CompanyBpmnProcessDsl:
+
+ val processName = "mycompany-myproject-myprocess"
+ lazy val descr = "my process..."
+
+ case class In(
+ ...
+ inConfig: Option[InConfig] = None
+ ) extends WithConfig[InConfig]
+
+ object In:
+ given ApiSchema[In] = deriveApiSchema
+ given InOutCodec[In] = deriveInOutCodec
+
+ case class InConfig(
+ // Process Configuration
+ ...
+ // Mocks
+ ... )
+ object InConfig:
+ given ApiSchema[InConfig] = deriveApiSchema
+ given InOutCodec[InConfig] = deriveInOutCodec
+
+ case class InitIn(...)
+ object InitIn:
+ given ApiSchema[InitIn] = deriveApiSchema
+ given InOutCodec[InitIn] = deriveInOutCodec
+
+ case class Out(...)
+ object Out:
+ given ApiSchema[Out] = deriveApiSchema
+ given InOutCodec[Out] = deriveInOutCodec
+
+ lazy val example = process(
+ In(),
+ Out(),
+ InitIn()
+ )
+end MyProcess
+ Next to the In and Out classes we have an InitIn- and InConfig class.
+ +Each process has an InitWorker that is the first worker that is called when the process is started.
+Use this class to:
+These are technical Process Variables, like:
+Here is an example:
-process(
- id = InvoiceReceiptPIdent,
- descr = "This starts the Invoice Receipt Process.",
- in = InvoiceReceipt(),
- out = InvoiceReceiptCheck() // just for testing
-)
- The element is a process with its inputs and outputs. As we also want to test its execution, - we defined also an output, also the process does not have one.
If your element has no Input and/or Output, just leave it empty, as this is the default case.
-process(
- id = MyDoItItselfProcess
-)
+ The InitWorker will automatically put these variables on the process. + That means you can override them for example in Postman
+inConfig
object is not needed).We only support elements you can interact with. The next subchapters describe them with an example.
- -We already showed a process example above. Here the sub process Review Invoice:
-process(
- id = "example-invoice-c7-review",
- descr = "This starts the Review Invoice Process.",
- in = InvoiceReceipt(),
- out = InvoiceReviewed()
-)
We support only Decision DMNs. @@ -159,7 +236,6 @@
This is a single result with one simple value.
singleEntry(
- decisionDefinitionKey = "singleEntry",
in = Input("A"),
out = 1
)
@@ -167,7 +243,6 @@ This is a single result with more than one value (domain object).
singleResult(
- decisionDefinitionKey = "singleResult",
in = Input("A"),
out = ManyOutResult(1, "🤩")
)
@@ -175,7 +250,6 @@ This is a list of simple values.
collectEntries(
- decisionDefinitionKey = "collectEntries",
in = Input("A"),
out = Seq(1, 2)
)
@@ -183,47 +257,178 @@ This is a list of domain objects.
resultList(
- decisionDefinitionKey = "resultList",
in = Input("A"),
out = List(ManyOutResult(1, "🤩"), ManyOutResult(2, "😂"))
)
A User Task describes its form values that it offers and the values it must be completed with.
-userTask(
- id = "ApproveInvoiceUT",
- descr = "Approve the invoice (or not).",
- in = InvoiceReceipt(),
- out = ApproveInvoice()
- )
+ object MyUserTask extends CompanyBpmnUserTaskDsl:
+
+ val name = "mycompany-myproject-myusertask"
+ val descr: String = "my user task..."
+
+ case class In(...)
+ object In:
+ given ApiSchema[In] = deriveApiSchema
+ given InOutCodec[In] = deriveInOutCodec
+
+ case class Out(...)
+ object Out:
+ given ApiSchema[Out] = deriveApiSchema
+ given InOutCodec[Out] = deriveInOutCodec
+
+ lazy val example = userTask(
+ In(),
+ Out()
+ )
+end MyUserTask
+ name
is the name of the user task, be aware at the moment this is only for documentation.In
object are the input variables you expect for the UI-Form of the UserTask.Out
object are the process variables, the UI-Form sends, when it completes the UserTask.An External Task describes a worker. + We distinguish different types of Tasks, which are described in the next subchapters.
+### Custom Task
+A _Custom Task_ is a description for a worker that does some business logic, like mapping.
+
+In General, you can do whatever you want with a _Custom Task_. See also _CustomWorker_.
+
+```scala
+object MyCustomTask extends CompanyBpmnCustomTaskDsl:
+
+ val topicName = "mycompany-myproject-myprocessV1.MyCustomTask"
+ val descr: String = "my custom task..."
+
+ case class In(...)
+ object In:
+ given ApiSchema[In] = deriveApiSchema
+ given InOutCodec[In] = deriveInOutCodec
+
+ case class Out(...)
+ object Out:
+ given ApiSchema[Out] = deriveApiSchema
+ given InOutCodec[Out] = deriveInOutCodec
+
+ lazy val example = customTask(
+ In(),
+ Out()
+ )
+end MyCustomTask
+
+ An Init Task is a description for a worker that initializes a Process.
+In General, you map the In
object to the InitIn
object like init process variables.
+ See also InitWorker.
So no extra BPMN Element is needed for this, it is automatically defined by the Process.
+object MyProcess extends CompanyBpmnProcessDsl:
+ ...
+ case class In(
+ ...
+ inConfig: Option[InConfig] = None
+ ) extends WithConfig[InConfig]
+ ...
+ case class InitIn(...)
+ ...
+end MyProcess
+
+ A Service Task is a description for a worker that provides a REST API request.
+See also ServiceWorker.
+object MyServiceTask extends CompanyBpmnServiceTaskDsl:
+
+ val topicName = "mycompany-myproject-myservicetask"
+ val descr: String = "my service task..."
+ val path = "POST: /myService"
+
+ type ServiceIn = MyServiceBody
+ type ServiceOut = NoOutput
+ lazy val serviceInExample = MyServiceBody()
+ lazy val serviceMock = MockedServiceResponse.success204
+
+ case class In(...)
+ object In:
+ given ApiSchema[In] = deriveApiSchema
+ given InOutCodec[In] = deriveInOutCodec
+
+ case class Out(...)
+ object Out:
+ given ApiSchema[Out] = deriveApiSchema
+ given InOutCodec[Out] = deriveInOutCodec
+
+ lazy val example = serviceTask(
+ In(),
+ Out(),
+ serviceMock,
+ serviceInExample
+ )
+end MyServiceTask
+ This task is more specific, and so we need to define
+At the moment we only support these 3 types of External Tasks. + Depending on the use case we can add more types.
+A Receive Message Event represents a catching message event. The input defines the message you expect. This works only as intermediate event. As we don't support throwing Message events we can simplify this to messageEvent:
-lazy val messageExample = messageEvent(
- "message-for-example",
- in = MessageExampleIn(),
-)
+ object MyMessageEvent extends CompanyBpmnMessageEventDsl:
+
+ val messageName = "mycompany-myproject-mymessage"
+ val descr: String = "my message..."
+
+ case class In(...)
+ object In:
+ given ApiSchema[In] = deriveApiSchema
+ given InOutCodec[In] = deriveInOutCodec
+
+ lazy val example = messageEvent(In())
+end MyMessageEvent
+ messageName
is the name of the message you expect.
+ The correlation can be the business key or the process instance id.
+ In the Simulation we will use the processInstanceId.In
object.A Receive Signal Event represents a catching signal event. The input defines the signal you expect. This works only as intermediate event. As we don't support Throwing Signal events we can simplify this to signalEvent:
-lazy val signalExample = signalEvent(
- "signal-for-example",
- in = SignalExampleIn(),
-)
-
- A Timer Event represents a timer event. - There is no input needed, you can use it to describe the timers in your API doc, or using them in the Simulations to execute the job of the timer immediately. - This works only as intermediate event.
-lazy val timerExample = timerEvent(
- "timer-for-example",
-)
+ object MySignalEvent extends CompanyBpmnSignalEventDsl:
+
+ val messageName = "mycompany-myproject-mysignal-{processInstanceId}"
+ val descr: String = "my signal..."
+
+ case class In(...)
+ object In:
+ given ApiSchema[In] = deriveApiSchema
+ given InOutCodec[In] = deriveInOutCodec
+
+ lazy val example = signalEvent(In())
+end MySignalEvent
+ messageName
is the name of the signal you expect.
+ To correlate the signal to a certain process instance, you can use the {processInstanceId}
as a part in the signal name.
+ This will be replaced in the Simulation with the actual processInstanceId.In
object.