All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cultureamp.eventsourcing.DomainEventProcessor.kt Maven / Gradle / Ivy

package com.cultureamp.eventsourcing

import java.util.*

interface DomainEventProcessor {
    fun process(event: E, aggregateId: UUID)

    companion object {
        fun  from(process: (E, UUID) -> Any?): DomainEventProcessor {
            return object : DomainEventProcessor {
                override fun process(event: E, aggregateId: UUID) {
                    process(event, aggregateId)
                }
            }
        }
    }
}

interface DomainEventProcessorWithMetadata {
    fun process(event: E, aggregateId: UUID, metadata: M, eventId: UUID)

    companion object {
        fun  from(process: (E, UUID, M, UUID) -> Any?): DomainEventProcessorWithMetadata {
            return object : DomainEventProcessorWithMetadata {
                override fun process(event: E, aggregateId: UUID, metadata: M, eventId: UUID) {
                    process(event, aggregateId, metadata, eventId)
                }
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy