Skip to main content

ApplyChangesNodeConfiguration2

Namespace: Meshmakers.Octo.MeshAdapter.Nodes.Load

Configuration node object for apply changes to the object in mongodb

public record ApplyChangesNodeConfiguration2 : NodeConfiguration, INodeConfiguration, IEquatable<NodeConfiguration>, IEquatable<ApplyChangesNodeConfiguration2>

Inheritance Object → NodeConfiguration → ApplyChangesNodeConfiguration2
Implements INodeConfiguration, IEquatable<NodeConfiguration>, IEquatable<ApplyChangesNodeConfiguration2>

Properties​

Identity​

Identity this node runs as: Caller (default), ServiceAccount (the pipeline's service account with its full roles, even when a caller is present), or System (unfiltered, bypasses data permissions). A missing value resolves to Caller so existing pipelines are unchanged.

public NodeExecutionIdentity Identity { get; set; }

Property Value​

NodeExecutionIdentity

TargetTenant​

Optional tenant to write into instead of the pipeline's own tenant: the Parent, a Sibling or a Child of the pipeline's tenant in the tenant registry. Without it (the default) the node writes its own tenant exactly as before. Every create, update and delete in the target goes through the cross-tenant guard: the relation is checked on the registry, the node identity must hold a right in the target that the identity service proves (Caller or ServiceAccount; System is always refused), the batch is checked against the target's CK model (MethodOnly attributes, replaced creates and identity associations are always refused there), and a refusal fails the execution with CROSS_TENANT_FORBIDDEN before anything is written. ApplyChanges@1 has no such setting. See docs/cross-tenant-access.md.

public TenantTargetConfiguration TargetTenant { get; set; }

Property Value​

TenantTargetConfiguration

TargetTenants​

Optional one-way master-data sync into the child tenants of the pipeline's tenant: all registered direct children, or the listed ones. Not together with ApplyChangesNodeConfiguration2.TargetTenant. Each entity update of the batch is applied in every target as an idempotent upsert (insert, update or replace) or delete, keyed by the source tenant and the source RtId: the copy in the target keeps the source RtId and carries the System record RtSyncOrigin (source tenant, source RtId, sync time), which only this node sets. An entity of the target without that origin, or with the origin of another tenant, is never changed or deleted. Every target goes through the cross-tenant guard (Caller or ServiceAccount; System refused) and is written in its own transaction; a refused or failed target does not stop the others, and the execution fails afterwards with every failed target named. Association updates and onDuplicateKey: Report are not supported here. See docs/cross-tenant-access.md.

public TenantSetConfiguration TargetTenants { get; set; }

Property Value​

TenantSetConfiguration

EntityUpdatesPath​

The path to the entity update

public string EntityUpdatesPath { get; set; }

Property Value​

String

AssociationUpdatesPath​

The path to the association update

public string AssociationUpdatesPath { get; set; }

Property Value​

String

OnDuplicateKey​

What to do when a unique index refuses the write. Defaults to DuplicateKeyHandling.Throw, which is what the node has always done.

A unique index is the only thing that holds against two callers writing the same natural key at once - a pipeline's own "does it exist yet" lookup reads before it writes, so both callers pass it. DuplicateKeyHandling.Report is for the pipeline that has a sensible answer for the loser of that race: an anonymous HTTP endpoint that would otherwise return a 500, and in a Development environment a stack trace, for what is a routine refusal, or a CK method pipeline that books a slot and answers its declared error CONCURRENT_CHANGE (sample: docs/examples/slot-booking-method.yaml).

Concurrent writers: within one adapter process the node writes one batch at a time. Two adapter replicas do not share that lock; the second writer then meets a MongoDB WriteConflict (112). The node aborts that transaction and retries up to six times with a short jittered backoff (about 0.4 to 0.8 seconds in total). Once the first writer has committed, the retry meets the unique index and is reported as a duplicate. When the conflict outlasts the retries, DuplicateKeyHandling.Report reports it as a conflict (flag true, nothing written) and DuplicateKeyHandling.Throw fails the pipeline - never a silent success.

The unique index belongs to the CK type. Declare it in the type's first version: adding a unique index to an existing type that already holds data is a Major change of the CK model and fails on duplicates already stored.

public DuplicateKeyHandling OnDuplicateKey { get; set; }

Property Value​

DuplicateKeyHandling

DuplicateKeyTargetPath​

Where the outcome is written when ApplyChangesNodeConfiguration2.OnDuplicateKey is DuplicateKeyHandling.Report: true when a unique index refused the write or a write conflict outlasted the retries (nothing was written), false when the write was stored. Required for Report; without it the node throws as with DuplicateKeyHandling.Throw. When the engine reports errors in its operation result (a validation error), the node logs an error, stores nothing and writes no flag, so the value is absent or still the one of an earlier run against the same data document: read only an explicit false as "stored".

public string DuplicateKeyTargetPath { get; set; }

Property Value​

String

Description​

public string Description { get; set; }

Property Value​

String

Constructors​

ApplyChangesNodeConfiguration2()​

public ApplyChangesNodeConfiguration2()