Skip to content

Add annotations like @StreamId and @StreamVersion as a compliment to EventMetadata #190

@johanhaleby

Description

@johanhaleby

When using the @Subscription annotation (https://occurrent.org/documentation#spring-boot-annotations) you can specify EventMetadata from which you can get all metadata including stream id and version:

@Component
class Example {
    
    @Subscription(id = "printAllDomainEvents")
    fun printAllDomainEvents(e: DomainEvent, metadata: EventMetadata) {
        val streamId: String = metadata.streamId
        val streamVersion: Long = metadata.streamVersion
        val myCustomValue: Any? = metadata["MyCustomValue"]
        // ...
    }
}

However, it would be nice to selectively just get the scream id and/or version directly:

@Component
class Example {
    
    @Subscription(id = "printAllDomainEvents")
    fun printAllDomainEvents(e: DomainEvent, @StreamId streamId : String, @StreamVersion streamVersion : Long) {
        // ...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions