-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95960ef
commit e76d1d5
Showing
1 changed file
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
module Kafka.Admin where | ||
|
||
|
||
import Control.Monad | ||
import Control.Monad.IO.Class | ||
|
||
import Kafka.Internal.RdKafka | ||
import Kafka.Internal.Setup | ||
|
||
import Kafka.Types | ||
import Kafka.Admin.AdminProperties | ||
|
||
data KAdmin = KAdmin { | ||
adminKafka :: !Kafka | ||
, adminKafkaConfig :: !KafkaConf | ||
} | ||
|
||
{- | ||
-newKAdmin :: MonadIO m | ||
newKAdmin :: MonadIO m | ||
=> AdminProperties | ||
-> m (Either KafkaError KafkaAdmin) | ||
- | ||
- -} | ||
-> m (Either KafkaError KAdmin) | ||
newKAdmin properties = liftIO $ do | ||
kafkaConfig@(KafkaConf kafkaConf' _ _) <- kafkaConf ( KafkaProps $ adminProps properties) | ||
maybeKafka <- newRdKafkaT RdKafkaProducer kafkaConf' | ||
case maybeKafka of | ||
Left err -> pure $ Left $ KafkaError err | ||
Right kafka -> pure $ Right $ KAdmin (Kafka kafka) kafkaConfig | ||
|