Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Jun 25, 2023
1 parent f30b4d6 commit 93e94e8
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ package zio.kafka.producer
import org.apache.kafka.clients.producer.ProducerConfig
import zio._

sealed abstract case class TransactionalProducerSettings private (
producerSettings: ProducerSettings
)
final case class TransactionalProducerSettings private (producerSettings: ProducerSettings)

object TransactionalProducerSettings {
def apply(producerSettings: ProducerSettings, transactionalId: String): TransactionalProducerSettings =
new TransactionalProducerSettings(
TransactionalProducerSettings(
producerSettings.withProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, transactionalId)
) {}
)

def apply(bootstrapServers: List[String], transactionalId: String): TransactionalProducerSettings =
new TransactionalProducerSettings(
TransactionalProducerSettings(
ProducerSettings(
bootstrapServers,
30.seconds,
4096,
Map(ProducerConfig.TRANSACTIONAL_ID_CONFIG -> transactionalId)
)
) {}
)

def apply(
bootstrapServers: List[String],
Expand All @@ -30,12 +28,12 @@ object TransactionalProducerSettings {
transactionalId: String,
sendBufferSize: Int
): TransactionalProducerSettings =
new TransactionalProducerSettings(
TransactionalProducerSettings(
ProducerSettings(
bootstrapServers,
closeTimeout,
sendBufferSize,
properties.updated(ProducerConfig.TRANSACTIONAL_ID_CONFIG, transactionalId)
)
) {}
)
}

0 comments on commit 93e94e8

Please sign in to comment.