eventium-core 0.3.1 → 0.3.2
raw patch · 4 files changed
+14/−13 lines, 4 files
Files
- eventium-core.cabal +1/−1
- src/Eventium/ProcessManager.hs +3/−2
- src/Eventium/Store/Class.hs +4/−4
- src/Eventium/Store/Types.hs +6/−6
eventium-core.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: eventium-core-version: 0.3.1+version: 0.3.2 synopsis: Core module for eventium description: Eventium-core provides the core abstractions and utilities for building event sourcing systems in Haskell. It includes event store interfaces, command handlers, projections, event handlers, event publishers,
src/Eventium/ProcessManager.hs view
@@ -57,8 +57,9 @@ -- data type — it describes /what/ should happen, not /how/. -- -- Each constructor carries a 'MetadataEnricher' so the saga can inject--- application-level metadata (e.g. @occurredAt@) into events produced by the--- dispatched command. Use 'id' when no enrichment is needed.+-- saga-level fields (e.g. @correlationId@, @causationId@) from the ambient+-- message context into events produced by the dispatched command. Use 'id'+-- when no enrichment is needed. data ProcessManagerEffect command = -- | Issue a command to a specific aggregate (identified by 'UUID'). IssueCommand UUID command MetadataEnricher
src/Eventium/Store/Class.hs view
@@ -185,8 +185,8 @@ -- writer that accepts domain events. Each event is encoded and tagged -- with metadata (event type name derived from 'Typeable', current -- UTC timestamp). The supplied 'MetadataEnricher' is applied to the--- generated metadata before writing — use this to inject application-level--- fields such as @occurredAt@.+-- generated metadata before writing — use this to inject saga-level+-- fields such as @correlationId@ and @causationId@. metadataEnrichingEventStoreWriterWithEnricher :: (MonadIO m, Typeable event) => MetadataEnricher ->@@ -200,7 +200,7 @@ map ( \e -> TaggedEvent- (enricher (EventMetadata (T.pack . show $ typeOf e) Nothing Nothing (Just now) (Just now)))+ (enricher (EventMetadata (T.pack . show $ typeOf e) Nothing Nothing (Just now))) (codec.encode e) ) events@@ -217,7 +217,7 @@ tagEvents codec now = map $ \e -> TaggedEvent- (EventMetadata (T.pack . show $ typeOf e) Nothing Nothing (Just now) (Just now))+ (EventMetadata (T.pack . show $ typeOf e) Nothing Nothing (Just now)) (codec.encode e) -- | Like 'codecEventStoreWriter' but uses a 'TypeEmbedding' instead of
src/Eventium/Store/Types.hs view
@@ -41,8 +41,7 @@ { eventType :: !Text, correlationId :: !(Maybe UUID), causationId :: !(Maybe UUID),- createdAt :: !(Maybe UTCTime),- occurredAt :: !(Maybe UTCTime)+ createdAt :: !(Maybe UTCTime) } deriving (Show, Eq, Generic) @@ -55,13 +54,14 @@ -- | Construct 'EventMetadata' with only an event type name. emptyMetadata :: Text -> EventMetadata-emptyMetadata et = EventMetadata et Nothing Nothing Nothing Nothing+emptyMetadata et = EventMetadata et Nothing Nothing Nothing -- | Builder function for customizing event metadata. ----- Used to inject application-level metadata (e.g. 'occurredAt') into events--- at write time. The enricher is applied after the base metadata is generated.--- Use 'id' when no enrichment is needed.+-- Used to inject saga-level fields (e.g. 'correlationId', 'causationId') from+-- the ambient message context into events at write time. The enricher is+-- applied after the base metadata is generated. Use 'id' when no enrichment+-- is needed. type MetadataEnricher = EventMetadata -> EventMetadata -- | An event paired with pre-computed metadata. Used to thread metadata