Skip to content

Commit

Permalink
Merge branch 'master' into issue-988
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvanoosten authored Oct 11, 2023
2 parents 0f28272 + f068456 commit 083ebf9
Show file tree
Hide file tree
Showing 27 changed files with 888 additions and 530 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Scala Steward: Reformat with scalafmt 3.7.10
a8871d8d1aaea8d735d126676077829c3b3073a0

# Scala Steward: Reformat with scalafmt 3.7.14
021c238deea31b591ea19cfb5187666acebc5456
5 changes: 4 additions & 1 deletion .github/workflows/benchs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- master
pull_request:
types: [ opened, reopened, synchronize ]
branches-ignore:
- gh-pages

permissions:
# deployments permission to deploy GitHub pages website
Expand All @@ -17,13 +19,14 @@ jobs:
benchmark: # See https://github.com/marketplace/actions/continuous-benchmark
name: Run benchmark
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }} # comes from https://github.com/orgs/community/discussions/25217#discussioncomment-3246904
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.12.0
with:
distribution: temurin
java-version: 17
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
name: CI
env:
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -Xms6G -Xmx6G -Xss4M -XX:+UseG1GC
JVM_OPTS: -XX:+PrintCommandLineFlags -Xms6G -Xmx6G -Xss4M -XX:+UseG1GC
'on':
workflow_dispatch: {}
release:
Expand All @@ -14,25 +13,26 @@ env:
branches:
- master
- series/0.x
pull_request: {}
create: {}
pull_request:
branches-ignore:
- gh-pages
jobs:
build:
name: Build
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Git Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.0
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.13.0
with:
distribution: temurin
java-version: '8'
distribution: corretto
java-version: '17'
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
Expand All @@ -48,16 +48,16 @@ jobs:
continue-on-error: false
steps:
- name: Git Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.0
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.13.0
with:
distribution: temurin
java-version: '8'
distribution: corretto
java-version: '17'
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
Expand All @@ -73,22 +73,22 @@ jobs:
fail-fast: false
matrix:
java:
- '8'
- '11'
- '17'
- '21'
steps:
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.13.0
with:
distribution: temurin
distribution: corretto
java-version: ${{ matrix.java }}
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Git Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.0
with:
fetch-depth: '0'
- name: Test
Expand All @@ -100,16 +100,16 @@ jobs:
if: ${{ github.event_name == 'push' }}
steps:
- name: Git Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.0
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.13.0
with:
distribution: temurin
java-version: '8'
distribution: corretto
java-version: '17'
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
Expand All @@ -129,7 +129,7 @@ jobs:
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request
id: cpr
uses: peter-evans/[email protected].0
uses: peter-evans/[email protected].2
with:
body: |-
Autogenerated changes after running the `sbt docs/generateReadme` command of the [zio-sbt-website](https://zio.dev/zio-sbt) plugin.
Expand Down Expand Up @@ -174,16 +174,16 @@ jobs:
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Git Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.0
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.13.0
with:
distribution: temurin
java-version: '8'
distribution: corretto
java-version: '17'
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
Expand All @@ -203,16 +203,16 @@ jobs:
if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }}
steps:
- name: Git Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.0
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.13.0
with:
distribution: temurin
java-version: '8'
distribution: corretto
java-version: '17'
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
Expand All @@ -234,7 +234,7 @@ jobs:
if: ${{ (github.event_name == 'release') && (github.event.action == 'published') }}
steps:
- name: Git Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.0
with:
fetch-depth: '0'
- name: notify the main repo about the new release of docs package
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ jobs:
benchmark:
name: Profile benchmarks
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }} # comes from https://github.com/orgs/community/discussions/25217#discussioncomment-3246904
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v3.12.0
with:
distribution: temurin
java-version: 17
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/scala-steward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ jobs:
name: Scala Steward
steps:
- name: Scala Steward
uses: scala-steward-org/[email protected]
uses: scala-steward-org/[email protected]
with:
github-app-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_ID }}
github-app-installation-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_INSTALLATION_ID }}
github-app-key: ${{ secrets.SCALA_STEWARD_GITHUB_APP_PRIVATE_KEY }}
github-app-auth-only: true
53 changes: 5 additions & 48 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,10 @@
# Created by https://www.gitignore.io/api/sbt,scala,intellij+all
# Edit at https://www.gitignore.io/?templates=sbt,scala,intellij+all

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# Manually edited since.

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

Expand All @@ -54,21 +17,12 @@ out/
# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# JetBrains templates
**___jb_tmp___

Expand Down Expand Up @@ -113,4 +67,7 @@ project/plugins/project/

# End of https://www.gitignore.io/api/sbt,scala,intellij+all

.vscode
.vscode

# MacOS
.DS_Store
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.7.10
version=3.7.14
project.git = true
maxColumn = 120
align {
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Kafka has a mature Java client for producing and consuming events, but it has a
In order to use this library, we need to add the following line in our `build.sbt` file:

```scala
libraryDependencies += "dev.zio" %% "zio-kafka" % "2.4.1"
libraryDependencies += "dev.zio" %% "zio-kafka-testkit" % "2.4.1" % Test
libraryDependencies += "dev.zio" %% "zio-kafka" % "2.5.0"
libraryDependencies += "dev.zio" %% "zio-kafka-testkit" % "2.5.0" % Test
```

## Example
Expand Down
31 changes: 15 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import sbt.Def

lazy val kafkaVersion = "3.5.1"
lazy val embeddedKafkaVersion = "3.5.0" // Should be the same as kafkaVersion, except for the patch part
lazy val kafkaVersion = "3.6.0"
lazy val embeddedKafkaVersion = "3.6.0" // Should be the same as kafkaVersion, except for the patch part

lazy val kafkaClients = "org.apache.kafka" % "kafka-clients" % kafkaVersion
lazy val scalaCollectionCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.11.0"
lazy val jacksonDatabind = "com.fasterxml.jackson.core" % "jackson-databind" % "2.15.2"
lazy val logback = "ch.qos.logback" % "logback-classic" % "1.3.8"
lazy val logback = "ch.qos.logback" % "logback-classic" % "1.3.11"

enablePlugins(ZioSbtEcosystemPlugin, ZioSbtCiPlugin)

inThisBuild(
List(
name := "ZIO Kafka",
zioVersion := "2.0.15",
scala212 := "2.12.18",
scala213 := "2.13.11",
scala3 := "3.3.0",
crossScalaVersions -= scala211.value,
name := "ZIO Kafka",
zioVersion := "2.0.18",
scala212 := "2.12.18",
scala213 := "2.13.12",
scala3 := "3.3.1",
ciEnabledBranches := Seq("master", "series/0.x"),
useCoursier := false,
Test / parallelExecution := false,
Expand Down Expand Up @@ -146,7 +145,7 @@ lazy val zioKafkaTest =
kafkaClients,
jacksonDatabind,
logback % Test,
"dev.zio" %% "zio-logging-slf4j" % "2.1.13" % Test,
"dev.zio" %% "zio-logging-slf4j" % "2.1.14" % Test,
scalaCollectionCompat
) ++ `embedded-kafka`.value
)
Expand All @@ -169,12 +168,12 @@ lazy val zioKafkaExample =
.settings(run / fork := false)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "2.0.15",
"dev.zio" %% "zio-kafka" % "2.4.1",
"dev.zio" %% "zio-kafka-testkit" % "2.4.1" % Test,
"dev.zio" %% "zio-test" % "2.0.15" % Test,
"ch.qos.logback" % "logback-classic" % "1.4.6",
"dev.zio" %% "zio-logging-slf4j2" % "2.1.13",
"dev.zio" %% "zio" % "2.0.18",
"dev.zio" %% "zio-kafka" % "2.5.0",
"dev.zio" %% "zio-kafka-testkit" % "2.5.0" % Test,
"dev.zio" %% "zio-test" % "2.0.18" % Test,
"ch.qos.logback" % "logback-classic" % "1.4.11",
"dev.zio" %% "zio-logging-slf4j2" % "2.1.14",
"io.github.embeddedkafka" %% "embedded-kafka" % embeddedKafkaVersion
),
// Scala 3 compiling fails with:
Expand Down
2 changes: 2 additions & 0 deletions docs/sharing-consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ Each Stream can have a different lifetime. Subscriptions are tied to their Strea
Consumer sharing is only possible when using the same type of `Subscription`: `Topics`, `Pattern` or `Manual`. Mixing different types will result in a failed stream. Note that every `Topic` subscription can also be written as a `Pattern` subscription, so if you want to mix `Topic` and `Pattern` subscriptions, you can just use `Pattern`.

If your subscriptions overlap, eg `Subscription.topics("topic1", "topic2")` and `Subscription.topics("topic2", "topic3")`, which stream will get the partitions of `topic2` is not deterministic.

Note that upon starting or ending subscriptions, Kafka will also reassign all partitions of the _other_ subscriptions. Record fetching will resume from the last committed offset, so records may be processed twice when not all offsets are committed yet. This works the same as for for regular rebalancing. To minimize this issue, commit frequently.
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.2
sbt.version=1.9.6
Loading

0 comments on commit 083ebf9

Please sign in to comment.