Skip to content

Commit

Permalink
Fix MetadataFiller to set producedBy as the service producing the msg (
Browse files Browse the repository at this point in the history
  • Loading branch information
dariacm authored Jun 30, 2024
1 parent 9dec768 commit 243c705
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/core/lib/messages/MetadataFiller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ describe('MetadataFiller', () => {
// Given
const providedMetadata = {
schemaVersion: '2.0.0',
producedBy: 'producer',
originatedFrom: 'source',
correlationId: 'myCorrelationId',
}
Expand All @@ -54,7 +53,7 @@ describe('MetadataFiller', () => {
const metadata = filler.produceMetadata(TEST_MESSAGE, EVENT_DEFINITION, providedMetadata)

// Then
expect(metadata).toEqual(providedMetadata)
expect(metadata).toEqual({ ...providedMetadata, producedBy: SERVICE_ID })
})
})
})
4 changes: 2 additions & 2 deletions packages/core/lib/messages/MetadataFiller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export class CommonMetadataFiller implements MetadataFiller {
produceMetadata(
_currentMessage: PublisherBaseEventType,
eventDefinition: Pick<CommonEventDefinition, 'schemaVersion'>,
precedingMessageMetadata?: MessageMetadataType,
precedingMessageMetadata?: Omit<MessageMetadataType, 'producedBy'>,
): MessageMetadataType {
return {
producedBy: precedingMessageMetadata?.producedBy ?? this.serviceId,
producedBy: this.serviceId,
originatedFrom: precedingMessageMetadata?.originatedFrom ?? this.serviceId,
schemaVersion:
precedingMessageMetadata?.schemaVersion ??
Expand Down

0 comments on commit 243c705

Please sign in to comment.