Skip to content

Commit

Permalink
isDeleted
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw committed Nov 26, 2024
1 parent 0366adb commit 380a965
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ final class TestKitEventSourcedEntityCommandContext(
override val commandId: Long = 0L,
override val commandName: String = "stubCommandName",
override val sequenceNumber: Long = 0L,
override val isDeleted: Boolean = false,
override val metadata: Metadata = Metadata.EMPTY)
extends CommandContext
with InternalContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public interface CommandContext extends MetadataContext {
*/
String entityId();

boolean isDeleted();

/** Access to tracing for custom app specific tracing. */
Tracing tracing();
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ private[impl] final class EventSourcedEntitiesImpl(
with CommandContext
with ActivatableContext {
override def tracing(): Tracing = new SpanTracingImpl(span, tracerFactory)
override def isDeleted: Boolean = false // FIXME not supported by old spi
}

private class EventSourcedEntityContextImpl(override final val entityId: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private[impl] object EventSourcedEntityImpl {
override val sequenceNumber: Long,
override val commandName: String,
override val commandId: Long, // FIXME remove
override val isDeleted: Boolean,
override val metadata: Metadata,
span: Option[Span],
tracerFactory: () => Tracer)
Expand Down Expand Up @@ -112,7 +113,7 @@ private[impl] final class EventSourcedEntityImpl[S, E, ES <: EventSourcedEntity[
override def emptyState(entityId: String): SpiEventSourcedEntity.State = {
// FIXME rather messy with the contexts here
val cmdContext =
new CommandContextImpl(entityId, 0L, "", 0, MetadataImpl.of(Nil), None, tracerFactory)
new CommandContextImpl(entityId, 0L, "", 0, false, MetadataImpl.of(Nil), None, tracerFactory)
val context = new EventSourcedEntityContextImpl(entityId)
val router = createRouter(context)
router.entity._internalSetCommandContext(Optional.of(cmdContext))
Expand All @@ -138,7 +139,15 @@ private[impl] final class EventSourcedEntityImpl[S, E, ES <: EventSourcedEntity[
val metadata: Metadata =
MetadataImpl.of(Nil) // FIXME MetadataImpl.of(command.metadata.map(_.entries.toVector).getOrElse(Nil))
val cmdContext =
new CommandContextImpl(entityId, command.sequenceNumber, command.name, 0, metadata, span, tracerFactory)
new CommandContextImpl(
entityId,
command.sequenceNumber,
command.name,
0,
command.isDeleted,
metadata,
span,
tracerFactory)

val context = new EventSourcedEntityContextImpl(entityId)
val router = createRouter(context)
Expand Down

0 comments on commit 380a965

Please sign in to comment.