Skip to content

Commit

Permalink
Add Producer.withMetrics1/Consumer.withMetrics2 methods for partial b…
Browse files Browse the repository at this point in the history
…inary compatibility [CE2] (#373)

* Add Producer.withMetrics1/Consumer.withMetrics2 methods for partial binary compatibility

* add deprecation
  • Loading branch information
Z1kkurat authored Aug 24, 2023
1 parent 21f6f2c commit 53ea686
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,17 @@ object Consumer {
}
}

/** The sole purpose of this method is to support binary compatibility with an intermediate
* version (namely, 11.15.1) which had `withMetrics1` method using `MeasureDuration` from `smetrics`
* and `withMetrics2` using `MeasureDuration` from `cats-helper`.
* This should not be used and should be removed in a reasonable amount of time.
*/
@deprecated("Use `withMetrics1`", since = "11.16.1")
def withMetrics2[E](
metrics: ConsumerMetrics[F]
)(implicit F: MonadError[F, E], measureDuration: MeasureDuration[F], clock: Clock[F]): Consumer[F, K, V] =
withMetrics1(metrics)

def withLogging(log: Log[F])(implicit F: Monad[F], measureDuration: MeasureDuration[F]): Consumer[F, K, V] = {
ConsumerLogging(log, self)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,18 @@ object Producer {
Producer(self, metrics)
}

/** The sole purpose of this method is to support binary compatibility with an intermediate
* version (namely, 11.15.1) which had `withMetrics` method using `MeasureDuration` from `smetrics`
* and `withMetrics1` using `MeasureDuration` from `cats-helper`.
* This should not be used and should be removed in a reasonable amount of time.
*/
@deprecated("Use `withMetrics`", since = "11.16.1")
def withMetrics1[E](
metrics: ProducerMetrics[F]
)(implicit F: MonadError[F, E], measureDuration: MeasureDuration[F]): Producer[F] = {
withMetrics(metrics)
}

def mapK[G[_]: Functor](fg: F ~> G, gf: G ~> F)(implicit F: Monad[F]): Producer[G] = new MapK with Producer[G] {

def initTransactions = fg(self.initTransactions)
Expand Down

0 comments on commit 53ea686

Please sign in to comment.