diff --git a/Sources/SwiftKafka/KafkaProducer.swift b/Sources/SwiftKafka/KafkaProducer.swift index e398048d..8969fd90 100644 --- a/Sources/SwiftKafka/KafkaProducer.swift +++ b/Sources/SwiftKafka/KafkaProducer.swift @@ -373,7 +373,7 @@ extension KafkaProducer { logger: Logger ) /// The ``KafkaProducer`` has been shut down and cannot be used anymore. - case shutDown + case finished } /// The current state of the StateMachine. @@ -416,7 +416,7 @@ extension KafkaProducer { fatalError("\(#function) invoked while still in state \(self.state)") case .started(let client, _, _, _, _): return .poll(client: client) - case .shutDown: + case .finished: return .killPollLoop } } @@ -443,7 +443,7 @@ extension KafkaProducer { } else { return .createTopicHandle(client: client, topic: topic) } - case .shutDown: + case .finished: throw KafkaError.connectionClosed(reason: "Tried to create topic handle on closed connection") } } @@ -466,7 +466,7 @@ extension KafkaProducer { topicHandles: topicHandles, logger: logger ) - case .shutDown: + case .finished: throw KafkaError.connectionClosed(reason: "Tried to create topic handle on closed connection") } } @@ -502,7 +502,7 @@ extension KafkaProducer { client: client, newMessageID: newMessageID ) - case .shutDown: + case .finished: throw KafkaError.connectionClosed(reason: "Tried to produce a message with a closed producer") } } @@ -530,13 +530,13 @@ extension KafkaProducer { case .uninitialized: fatalError("\(#function) invoked while still in state \(self.state)") case .started(let client, _, let source, let topicHandles, _): - self.state = .shutDown + self.state = .finished return .shutdownGracefullyAndFinishSource( client: client, source: source, topicHandles: topicHandles ) - case .shutDown: + case .finished: return nil } }