Skip to content

Commit f1ccd0b

Browse files
committed
docs: target systems update
1 parent c16b2dd commit f1ccd0b

File tree

10 files changed

+143
-110
lines changed

10 files changed

+143
-110
lines changed

docs/flamingock-library-config/context-and-dependencies.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ MongoSyncTargetSystem mongoTarget = new MongoSyncTargetSystem("user-db")
5353
.withMongoClient(client); // MongoDB-specific method
5454
```
5555

56-
**Generic methods** - All target systems (including DefaultTargetSystem) support generic dependency injection:
56+
**Generic methods** - All target systems (including NonTransactionalTargetSystem) support generic dependency injection:
5757
```java
58-
DefaultTargetSystem kafkaTarget = new DefaultTargetSystem("events")
58+
NonTransactionalTargetSystem kafkaTarget = new NonTransactionalTargetSystem("events-id")
5959
.addDependency(kafkaProducer)
6060
.addDependency("notification-service", notificationService)
6161
.setProperty("batch.size", 1000);
6262
```
6363

64-
This flexibility allows DefaultTargetSystem to inject any dependencies needed for non-transactional systems, while specialized target systems provide convenience methods for their common dependencies.
64+
This flexibility allows NonTransactionalTargetSystem to inject any dependencies needed for non-transactional systems, while specialized target systems provide convenience methods for their common dependencies.
6565

6666
### Global dependencies
6767

docs/frameworks/springboot-integration/enable-flamingock-setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ With automatic setup, Flamingock needs access to your target systems and (for Co
6868
Example target system bean registration:
6969
```java
7070
@Bean
71-
public DefaultTargetSystem redisTargetSystem() {
72-
return new DefaultTargetSystem("redis-cache");
71+
public NonTransactionalTargetSystem redisTargetSystem() {
72+
return new NonTransactionalTargetSystem("redis-cache-id");
7373
}
7474
```
7575

docs/overview/quick-start.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,32 @@ annotationProcessor("io.flamingock:flamingock-processor:$flamingockVersion")
7979

8080

8181

82-
## 2. Define your first Changes
82+
## 2. Create target systems
8383

84-
Each Change represents a single change.
84+
Target systems represent the external systems Flamingock will apply your changes to.
85+
They are configured in the builder and shared across Changes.
86+
87+
For our example:
88+
- A MySQL database (`mysql-inventory`)
89+
- An S3 bucket service (`aws-s3`)
90+
- A Kafka cluster (`kafka`)
91+
92+
```java
93+
SqlTargetSystem sql = new SqlTargetSystem("mysql-inventory").withDatasource(ds);
94+
NonTransactionalTargetSystem s3 = new NonTransactionalTargetSystem("aws-s3-id");
95+
NonTransactionalTargetSystem kafka = new NonTransactionalTargetSystem("kafka-id");
96+
```
97+
98+
See [Target systems](../target-systems/introduction.md) for more details.
99+
100+
101+
## 3. Define your first Changes
102+
103+
Each Change represents a single change.
85104
For our example, we'll define three:
86105

87106
- **MySQL**: Add a column `category` to products
88-
- **S3**: Create a `product-images` bucket
107+
- **S3**: Create a `product-images` bucket
89108
- **Kafka**: Create a `stock-updates` topic
90109

91110
Changes can be:
@@ -141,25 +160,6 @@ public class _002_CreateS3Bucket {
141160
For more details, see [Core concepts](core-concepts.md).
142161

143162

144-
## 3. Create target systems
145-
146-
Target systems represent the external systems Flamingock will apply your changes to.
147-
They are configured in the builder and shared across Changes.
148-
149-
For our example:
150-
- A MySQL database (`mysql-inventory`)
151-
- An S3 bucket service (`aws-s3`)
152-
- A Kafka cluster (`kafka`)
153-
154-
```java
155-
SqlTargetSystem sql = new SqlTargetSystem("mysql-inventory").withDatasource(ds);
156-
DefaultTargetSystem s3 = new DefaultTargetSystem("aws-s3");
157-
DefaultTargetSystem kafka = new DefaultTargetSystem("kafka");
158-
```
159-
160-
See [Target systems](../target-systems/introduction.md) for more details.
161-
162-
163163
## 4. Configure stages
164164

165165
Flamingock organizes your changes in stages.

docs/target-systems/couchbase-target-system.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Couchbase
3-
sidebar_position: 5
3+
sidebar_position: 6
44
---
55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
@@ -43,11 +43,15 @@ implementation("com.couchbase.client:java-client:3.6.0")
4343
Configure the target system:
4444

4545
```java
46-
CouchbaseTargetSystem couchbaseTarget = new CouchbaseTargetSystem("user-database", cluster, bucket);
46+
CouchbaseTargetSystem couchbaseTarget = new CouchbaseTargetSystem("user-database-id", cluster, bucket);
4747
```
4848

4949
The constructor requires the target system name, Couchbase cluster, and bucket. Optional configurations can be added via `.withXXX()` methods.
5050

51+
:::info Register Target System
52+
Once created, you need to register this target system with Flamingock. See [Registering target systems](introduction.md#registering-target-systems) for details.
53+
:::
54+
5155
## Target System Configuration
5256

5357
The Couchbase target system uses Flamingock's [split dependency resolution architecture](introduction.md#dependency-injection) with separate flows for target system configuration and change execution dependencies.
@@ -61,11 +65,11 @@ These dependencies must be provided at target system creation time with **no glo
6165
| `Cluster` | `cluster` | Couchbase cluster connection - **required** for both target system configuration and change execution |
6266
| `Bucket` | `bucket` | Target bucket instance - **required** for both target system configuration and change execution |
6367

64-
### Dependencies Available to Changes
68+
## Dependencies Available to Changes
6569

6670
Changes can access dependencies through [dependency injection with fallback](../changes/anatomy-and-structure.md#method-parameters-and-dependency-injection):
6771

68-
1. **Target system context** (highest priority) - `Cluster`, `Bucket`, `AttemptContext`, plus any added via `.addDependency()`
72+
1. **Target system context** (highest priority) - `Cluster`, `Bucket`, `TransactionAttemptContext`, plus any added via `.addDependency()`
6973
2. **Target system additional dependencies** - added via `.addDependency()` or `.setProperty()`
7074
3. **Global context** (fallback) - shared dependencies available to all target systems
7175

@@ -93,7 +97,7 @@ Flamingock.builder()
9397
**Change dependency resolution for Changes in "user-database":**
9498
- **Cluster**: From target system context (`productionCluster`)
9599
- **Bucket**: From target system context (`userBucket`)
96-
- **AttemptContext**: From target system context (created by Flamingock)
100+
- **TransactionAttemptContext**: From target system context (created by Flamingock)
97101
- **AuditService**: From target system additional dependencies
98102
- **EmailService**: From global context (fallback)
99103
- **LogService**: From global context (fallback)
@@ -102,18 +106,18 @@ This architecture ensures explicit target system configuration while providing f
102106

103107
## Transactional support
104108

105-
For a Change to leverage Couchbase's transactional capabilities, it must use the `AttemptContext` parameter. Flamingock uses the injected `Cluster` and `Bucket` dependencies to create and manage this context's lifecycle - creating the transaction context before execution, committing on success, and rolling back on failure.
109+
For a Change to leverage Couchbase's transactional capabilities, it must use the `TransactionAttemptContext` parameter. Flamingock uses the injected `Cluster` and `Bucket` dependencies to create and manage this context's lifecycle - creating the transaction context before execution, committing on success, and rolling back on failure.
106110

107111
> For detailed information on transaction handling, see [Transactions](../changes/transactions.md).
108112
109113
```java
110-
@TargetSystem("user-database")
114+
@TargetSystem("user-database-id")
111115
@Change(id = "create-users", order = "001")
112116
public class CreateUsers {
113117

114118
@Apply
115-
public void apply(Cluster cluster, Bucket bucket, AttemptContext txContext) {
116-
// AttemptContext is required for transactional execution
119+
public void apply(Cluster cluster, Bucket bucket, TransactionAttemptContext txContext) {
120+
// TransactionAttemptContext is required for transactional execution
117121
// Flamingock uses the target system's Cluster and Bucket to handle transaction operations
118122
// and manages transaction start, commit, and rollback automatically
119123
Collection collection = bucket.defaultCollection();
@@ -130,13 +134,13 @@ public class CreateUsers {
130134
You can also work with the Cluster and Bucket directly without transactions:
131135

132136
```java
133-
@TargetSystem("user-database")
137+
@TargetSystem("user-database-id")
134138
@Change(id = "update-configs", order = "002")
135139
public class UpdateConfigs {
136140

137141
@Apply
138142
public void apply(Cluster cluster, Bucket bucket) {
139-
// Operations without AttemptContext won't participate in transactions
143+
// Operations without TransactionAttemptContext won't participate in transactions
140144
Collection collection = bucket.defaultCollection();
141145

142146
JsonObject config = JsonObject.create()
@@ -149,15 +153,15 @@ public class UpdateConfigs {
149153
```
150154

151155
**How transactions work:**
152-
1. **Context creation**: Flamingock uses the target system's `Cluster` to create an `AttemptContext` for transaction management
156+
1. **Context creation**: Flamingock uses the target system's `Cluster` to create an `TransactionAttemptContext` for transaction management
153157
2. **Transaction management**: The same `Cluster` and `Bucket` handle transaction operations and coordinate with the context
154158
3. **Lifecycle**: Flamingock automatically creates the transaction context, commits on success, or rolls back on failure
155159

156-
Without the `AttemptContext` parameter, operations will execute but won't participate in transactions.
160+
Without the `TransactionAttemptContext` parameter, operations will execute but won't participate in transactions.
157161

158162
## Available dependencies in Changes
159163

160-
Your Changes can inject Couchbase-specific dependencies like `Cluster`, `Bucket`, and `AttemptContext` (for transactions), but are not limited to these. The target system provides these dependencies through its context, and you can add additional dependencies via `.addDependency()` that take precedence over global dependencies.
164+
Your Changes can inject Couchbase-specific dependencies like `Cluster`, `Bucket`, and `TransactionAttemptContext` (for transactions), but are not limited to these. The target system provides these dependencies through its context, and you can add additional dependencies via `.addDependency()` that take precedence over global dependencies.
161165

162166
For comprehensive details on change dependency resolution, see [Change Anatomy & Structure](../changes/anatomy-and-structure.md).
163167

docs/target-systems/dynamodb-target-system.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: DynamoDB
3-
sidebar_position: 4
3+
sidebar_position: 5
44
---
55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
@@ -43,11 +43,15 @@ implementation("software.amazon.awssdk:dynamodb-enhanced:2.12.0")
4343
Configure the target system:
4444

4545
```java
46-
DynamoDBTargetSystem dynamoTarget = new DynamoDBTargetSystem("inventory-database", dynamoDbClient);
46+
DynamoDBTargetSystem dynamoTarget = new DynamoDBTargetSystem("inventory-database-id", dynamoDbClient);
4747
```
4848

4949
The constructor requires the target system name and DynamoDB client. Optional configurations can be added via `.withXXX()` methods.
5050

51+
:::info Register Target System
52+
Once created, you need to register this target system with Flamingock. See [Registering target systems](introduction.md#registering-target-systems) for details.
53+
:::
54+
5155
## Target System Configuration
5256

5357
The DynamoDB target system uses Flamingock's [split dependency resolution architecture](introduction.md#dependency-injection) with separate flows for target system configuration and change execution dependencies.
@@ -60,7 +64,7 @@ These dependencies must be provided at target system creation time with **no glo
6064
|------------|----------------------|-------------|
6165
| `DynamoDbClient` | `dynamoDbClient` | AWS DynamoDB client - **required** for both target system configuration and change execution |
6266

63-
### Dependencies Available to Changes
67+
## Dependencies Available to Changes
6468

6569
Changes can access dependencies through [dependency injection with fallback](../changes/anatomy-and-structure.md#method-parameters-and-dependency-injection):
6670

@@ -104,7 +108,7 @@ For a Change to leverage DynamoDB's transactional capabilities, it must use the
104108
> For detailed information on transaction handling, see [Transactions](../changes/transactions.md).
105109
106110
```java
107-
@TargetSystem("inventory-database")
111+
@TargetSystem("inventory-database-id")
108112
@Change(id = "update-inventory", order = "001")
109113
public class UpdateInventory {
110114

docs/target-systems/introduction.md

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ title: Introduction
33
sidebar_position: 0
44
---
55

6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
69
# Target systems
710

811
Target systems are the real-world systems where your business changes are applied.
@@ -64,82 +67,69 @@ mongoTarget.withWriteConcern(WriteConcern.MAJORITY)
6467
**No global context fallback** - target system configuration must be explicit and complete.
6568

6669

67-
## Dependency injection
68-
69-
Dependency injection is the mechanism used for **change execution**, providing the dependencies that Changes need to perform their operations. Each target system exposes specific dependencies required by its Changes:
70-
71-
- A MongoDB target system provides a `MongoDatabase`, `ClientSession`
72-
- A Kafka target system provides a `KafkaTemplate`
73-
- A SQL target system provides a `Connection` or `DataSource`
74-
75-
Flamingock uses a **flexible, multi-source approach** with fallback hierarchy for change execution:
76-
77-
1. **Target system context** (highest priority) - includes configuration parameters from constructor + `.withXXX()` methods
78-
2. **Target system additional dependencies** - added via `.addDependency()` or `.setProperty()`
79-
3. **Global context** (fallback) - shared dependencies available to all target systems
80-
81-
:::info
82-
Target system configuration parameters (from **constructor** and `.withXXX()` methods) are automatically available as change dependencies with highest priority.
83-
:::
84-
85-
For comprehensive details on change dependency resolution, see [Change Anatomy & Structure](../changes/anatomy-and-structure.md).
70+
## Registering target systems
8671

72+
Target systems are registered at runtime. You can define and register as many as you need:
8773

88-
## Registering target systems
74+
<Tabs groupId="registration">
75+
<TabItem value="builder" label="Flamingock Builder" default>
8976

90-
Target systems are registered at runtime with the Flamingock builder. You can define and register as many as you need:
77+
Use the Flamingock builder for standalone applications:
9178

9279
```java
80+
SqlTargetSystem mysql = new SqlTargetSystem("mysql-inventory-id", dataSource);
9381

94-
SqlTargetSystem mysql = new SqlTargetSystem("mysql-inventory", dataSource);
95-
96-
DefaultTargetSystem s3 = new DefaultTargetSystem("aws-s3");
82+
NonTransactionalTargetSystem s3 = new NonTransactionalTargetSystem("aws-s3-id");
9783

98-
DefaultTargetSystem kafka = new DefaultTargetSystem("kafka-stock");
84+
NonTransactionalTargetSystem kafka = new NonTransactionalTargetSystem("kafka-stock-id");
9985

10086
Flamingock.builder()
10187
.setAuditStore(new MongoSyncAuditStore(mongoClient, mongoDatabase))
10288
.addTargetSystems(mysql, s3, kafka)
10389
.build()
10490
.run();
105-
10691
```
10792

10893
At startup, Flamingock automatically injects the right dependencies from the corresponding target system into each Change.
10994

110-
### Spring Boot Integration
111-
For Spring Boot applications, target systems are configured as beans:
95+
</TabItem>
96+
<TabItem value="springboot" label="Spring Boot">
97+
98+
For Spring Boot applications, register target systems as beans:
11299

113100
```java
114101
@Bean
115102
public SqlTargetSystem sqlTargetSystem(DataSource dataSource) {
116-
return new SqlTargetSystem("mysql-inventory", dataSource);
103+
return new SqlTargetSystem("mysql-inventory-id", dataSource);
117104
}
118105

119106
@Bean
120107
public MongoSyncTargetSystem mongoTargetSystem(MongoClient mongoClient) {
121-
return new MongoSyncTargetSystem("user-database", mongoClient, "userDb")
108+
return new MongoSyncTargetSystem("user-database-id", mongoClient, "userDb")
122109
.withWriteConcern(WriteConcern.MAJORITY);
123110
}
124111

125112
@Bean
126-
public DefaultTargetSystem kafkaTargetSystem() {
127-
return new DefaultTargetSystem("kafka-stock");
113+
public NonTransactionalTargetSystem kafkaTargetSystem() {
114+
return new NonTransactionalTargetSystem("kafka-stock-id");
128115
}
129116
```
130117

131118
Spring Boot's auto-configuration will automatically register these target systems with Flamingock.
132119

133120
For more details, see [Spring Boot Integration](../frameworks/springboot-integration/introduction.md).
134121

122+
</TabItem>
123+
</Tabs>
124+
135125

136126

137127
## Linking Changes to target systems
138128

139129
When defining Changes, you specify which target system they belong to using the `@TargetSystem` annotation:
140130

141131
```java
142-
@TargetSystem("mysql-inventory")
132+
@TargetSystem("mysql-inventory-id")
143133
@Change(id = "add-category", order = "001", author = "team")
144134
public class _001_AddCategory {
145135
//...
@@ -148,6 +138,27 @@ public class _001_AddCategory {
148138

149139

150140

141+
## Dependency injection
142+
143+
Dependency injection is the mechanism used for **change execution**, providing the dependencies that Changes need to perform their operations. Each target system exposes specific dependencies required by its Changes:
144+
145+
- A MongoDB target system provides a `MongoDatabase`, `ClientSession`
146+
- A Kafka target system provides a `KafkaTemplate`
147+
- A SQL target system provides a `Connection` or `DataSource`
148+
149+
Flamingock uses a **flexible, multi-source approach** with fallback hierarchy for change execution:
150+
151+
1. **Target system context** (highest priority) - includes configuration parameters from constructor + `.withXXX()` methods
152+
2. **Target system additional dependencies** - added via `.addDependency()` or `.setProperty()`
153+
3. **Global context** (fallback) - shared dependencies available to all target systems
154+
155+
:::info
156+
Target system configuration parameters (from **constructor** and `.withXXX()` methods) are automatically available as change dependencies with highest priority.
157+
:::
158+
159+
For comprehensive details on change dependency resolution, see [Change Anatomy & Structure](../changes/anatomy-and-structure.md).
160+
161+
151162
## Cloud Edition visibility
152163

153164
In the Cloud Edition, target systems become a first-class part of the dashboard:
@@ -184,7 +195,7 @@ These target systems provide optimized handling for specific technologies:
184195
### Universal fallback
185196
For any system that doesn't require specialized handling:
186197

187-
- [Default target system](../target-systems/default-target-system.md) - The fallback choice for any system without a dedicated implementation (Kafka Schema Registry, S3, REST APIs, file systems, etc.)
198+
- [Non-transactional target system](../target-systems/non-transactional-target-system.md) - The fallback choice for any system without a dedicated implementation (Kafka Schema Registry, S3, REST APIs, file systems, etc.)
188199

189200
**Future extensibility**: The Flamingock ecosystem may expand with more specialized target systems as specific needs are identified. These can be implemented by the Flamingock team, community contributions, or custom implementations by users.
190201

0 commit comments

Comments
 (0)