Skip to content

Commit

Permalink
Add assert for new consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
xtremekforever committed Feb 11, 2025
1 parent 828900d commit 73b6f16
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/MassTransit/MassTransitConsumer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public actor MassTransitConsumer: Service {
private func createMessageConsumer<T: MassTransitMessage>(
_: T.Type, messageType: String
) -> AnyAsyncSequence<MassTransitWrapper<T>> {
assert(consumers[messageType] == nil, "Consumer for \(messageType) is already registered!")

// Create a stream + continuation
logger.info("Consuming messages of type \(messageType) on queue \(queueName)...")
let (stream, continuation) = AsyncStream.makeStream(of: MassTransitWrapper<T>.self)
Expand Down

0 comments on commit 73b6f16

Please sign in to comment.