Skip to content

Commit

Permalink
started documenting building blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
lwluc committed Mar 27, 2024
1 parent f46b959 commit b1cc624
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ You want to contribute 🌱? Please read the [Contribution Guidelines](CONTRIBUT
* [Camunda 8](#camunda-8)
* [Camunda 7](#camunda-7)
* 📈 [Reporting Carbon Reduction via Camunda Optimize](#reporting-carbon-reduction-via-camunda-optimize)
* [🏗️ Building Blocks](#building-blocks)
* 📚 [Releases](#releases)
* 📆 [Publications](#publications)
* 📨 [Contact](#contact)
Expand Down Expand Up @@ -75,6 +76,19 @@ we visualized the results for out example process and it looks like the followin

The exported Dashboard Definition could be found [here](assets/optimize-dashboard-definition.json).

# 🏗️Building Blocks

![Building Block View Level 0 Camunda Carbon Reductor](assets/diagram/generated/building-block-view-level-0.png)

| Element | Description |
|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [Carbon Reductor Core](./carbon-reductor-core/README.md#building-blocks) | Core module which calculates the possible time shifting base on data it fetches from the external systems. |
| Carbon Aware API | Custom Client to connect to the Carbon Aware SDK. |
| Carbon Aware Computing API | Custom Client to connect to the Carbon Aware Computing API. |
| [Camunda Carbon Reductor C8](./camunda-carbon-reductor-c8/README.md#building-blocks) | Camunda 8 Job Worker. |
| [Camunda Carbon Reductor C7](./camunda-carbon-reductor-c7/README.md#building-blocks) | Camunda 7 External Task Worker. |


# 📚Releases

The list of [releases](https://github.com/envite-consulting/camunda-carbon-reductor/releases) contains a detailed changelog.
Expand Down
32 changes: 32 additions & 0 deletions assets/diagram/building-block-view-level-0.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@startuml

component "Camunda Carbon Reductor" {
portin "Camunda 7"
portin "Camunda 8"

component "Carbon Reductor Core" <<Maven Module>>
component "Camunda Carbon Reductor C7" <<Maven Module>>
component "Camunda Carbon Reductor C8" <<Maven Module>>

component API <<Maven Module>> {
component "Carbon Aware API" <<Maven Module>>
component "Carbon Aware Computing API" <<Maven Module>>
}

portout "Carbon Aware SDK \n (WattTime | ElectricityMaps)" as CarbonAwareSDK
portout "Carbon Aware Computing"

"Camunda 7" --> "Camunda Carbon Reductor C7"
"Camunda 8" --> "Camunda Carbon Reductor C8"

"Camunda Carbon Reductor C7" --> "Carbon Reductor Core"
"Camunda Carbon Reductor C8" --> "Carbon Reductor Core"

"Carbon Reductor Core" --> "Carbon Aware API"
"Carbon Reductor Core" --> "Carbon Aware Computing API"

"Carbon Aware API" --> CarbonAwareSDK
"Carbon Aware Computing API" --> "Carbon Aware Computing"
}

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@startuml

component "Camunda Carbon Reductor C7" <<Maven Module>> {
portin "Camunda 7"

component CarbonReductorTaskHandler

component CarbonReductorVariableMapper

portout "Carbon Reductor Core" <<Maven Module>>

"Camunda 7" <-- CarbonReductorTaskHandler : import
"Carbon Reductor Core" --> CarbonReductorTaskHandler : use

CarbonReductorTaskHandler -> CarbonReductorVariableMapper : use
CarbonReductorVariableMapper -> "Carbon Reductor Core" : import
}

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml

component "Camunda Carbon Reductor C8" <<Maven Module>> {
portin "Camunda 8"

component CarbonReductorWorker

component CarbonReductorVariableMapper
component CarbonReductorInputVariable
component CarbonReductorOutputVariable

portout "Carbon Reductor Core" <<Maven Module>>

"Camunda 8" <-- CarbonReductorWorker : import
"Carbon Reductor Core" --> CarbonReductorWorker : use

CarbonReductorWorker --> CarbonReductorVariableMapper : use
CarbonReductorVariableMapper --> "Carbon Reductor Core" : import

CarbonReductorVariableMapper --> CarbonReductorInputVariable : import
CarbonReductorVariableMapper --> CarbonReductorOutputVariable : import
}

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@startuml

component "Carbon Reductor Core" <<Maven Module>> {
portin "Camunda Carbon Reductor C7" <<Maven Module>>
portin "Camunda Carbon Reductor C8" <<Maven Module>>

' Usecase
component DelayCalculator <<Usecase_ In>>
component CarbonEmissionQuery <<Usecase: Out>>

' Domain
component DelayCalculatorService <<DomainService>>

component CarbonReduction <<Domain Model: Aggregate>>
component CarbonReductorConfiguration <<Domain Model: Aggregate>>

' Adapter
component CarbonAwareSdkClient <<Adapter>>
component CarbonAwareComputingApiClient <<Adapter>>

portout "Carbon Aware API" <<Maven Module>>
portout "Carbon Aware Computing API" <<Maven Module>>


DelayCalculatorService --> CarbonReduction : use
DelayCalculatorService --> CarbonReductorConfiguration : use

DelayCalculator <-- DelayCalculatorService : implements
CarbonEmissionQuery <-- CarbonAwareSdkClient : implements
CarbonEmissionQuery <-- CarbonAwareComputingApiClient : implements

DelayCalculatorService --> CarbonEmissionQuery : use


"Camunda Carbon Reductor C7" --> DelayCalculator
"Camunda Carbon Reductor C8" --> DelayCalculator

CarbonAwareSdkClient --> "Carbon Aware API"
CarbonAwareComputingApiClient --> "Carbon Aware Computing API"
}

@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions camunda-carbon-reductor-c7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Provides also a Service Task Template for configuration ([carbon-reductor.json](
* [Adding the element template to the modeler](#adding-the-element-template-to-the-modeler)
* [Configuring the element template](#configuring-the-element-template)
* [🖐🏼 Manual Override](#-manual-override)
* [🏗️ Building Blocks](#building-blocks)

# 🚀Getting Started

Expand Down Expand Up @@ -99,3 +100,11 @@ There are 2 options:

![Attached Error Event in the process model](../docs/error-handling/error-handling-c7-process.png)

# 🏗️Building Blocks

![Building Block View Level 1 Camunda Carbon Reductor C7](../assets/diagram/generated/building-block-view-level-1-camunda-carbon-reductor-c7.png)

| Element | Description |
|------------------------------|---------------------------------------------------------------------------------------|
| CarbonReductorTaskHandler | `ExternalTaskHandler` which connects to the model element and does the time shifting. |
| CarbonReductorVariableMapper | Maps the process data to the internal configuration model. |
14 changes: 13 additions & 1 deletion camunda-carbon-reductor-c8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ implementation of the Carbon Redcutor.
* [Adding the element template to the modeler](#adding-the-element-template-to-the-modeler)
* [Configuring the element template](#configuring-the-element-template)
* [🖐🏼 Manual Override](#-manual-override)
* [🏗️ Building Blocks](#building-blocks)

# 🗒️Notes

Expand Down Expand Up @@ -144,4 +145,15 @@ There are 2 options:
* On Exceptions a BPMN Error will be thrown that can be caught in the process model.
* The process model needs to catch the thrown BPMN Error with the name **carbon-reductor-error**

![Attached Error Event in the process model](../docs/error-handling/error-handling-c8-process.png)
![Attached Error Event in the process model](../docs/error-handling/error-handling-c8-process.png)

# 🏗️Building Blocks

![Building Block View Level 1 Camunda Carbon Reductor C8](../assets/diagram/generated/building-block-view-level-1-camunda-carbon-reductor-c8.png)

| Element | Description |
|------------------------------|-----------------------------------------------------------------------------|
| CarbonReductorWorker | `JobWorker` which connects to the model element and does the time shifting. |
| CarbonReductorVariableMapper | Maps the process data to the internal configuration model. |
| CarbonReductorInputVariable | Object representing the input data from the process. |
| CarbonReductorOutVariable | Object representing the data which is written back to the process. |
13 changes: 13 additions & 0 deletions carbon-reductor-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,23 @@ Uses the [Carbon Aware API](../api/api-carbon-aware/README.md).
# Table of Contents

* [🔧️Configuration](#configuration)
* [🏗️ Building Blocks](#building-blocks)

# 🔧️Configuration

The environmental variable `CARBON-REDUCTOR_CARBON-AWARE-API_BASE-PATH` allows you to set the URL of the Carbon Aware API.
Default is `http://localhost:8090`.

Or you can override all properties in the [application.yaml](./src/main/resources/application.yaml) by applying e.g. a custom one.


# 🏗️Building Blocks

![Building Block View Level 1 Carbon Reductor Core](../assets/diagram/generated/building-block-view-level-1-carbon-reductor-core.png)

| Element | Description |
|------------------------------|-----------------------------------------------------------------------------|
| CarbonReductorWorker | `JobWorker` which connects to the model element and does the time shifting. |
| CarbonReductorVariableMapper | Maps the process data to the internal configuration model. |
| CarbonReductorInputVariable | Object representing the input data from the process. |
| CarbonReductorOutVariable | Object representing the data which is written back to the process. |

0 comments on commit b1cc624

Please sign in to comment.