Skip to content

Commit

Permalink
Merge branch 'master' into update/sbt-microsites-1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
geirolz authored Sep 6, 2024
2 parents 4df587f + a11fd63 commit ab85ee0
Show file tree
Hide file tree
Showing 98 changed files with 2,381 additions and 934 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,58 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4
- uses: olafurpg/setup-scala@v10
- uses: actions/checkout@v4
- uses: coursier/setup-action@v1

- name: Starting up RabbitMQ
run: docker-compose up -d
run: docker compose up -d

- name: Cache Coursier dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-${{ github.ref }}-coursier
restore-keys: |
${{ runner.os }}-${{ github.ref }}-coursier
path: ~/.cache/coursier
key: ${{ runner.os }}-${{ github.ref }}-coursier
restore-keys: |
${{ runner.os }}-${{ github.ref }}-coursier
- name: Cache Ivy dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-${{ github.ref }}-ivy2
restore-keys: |
${{ runner.os }}-${{ github.ref }}-ivy2
${{ runner.os }}-${{ github.ref }}-ivy2
- name: Tests
run: sbt -J-Xms4G -J-Xmx4G buildFs2Rabbit

- name: Shutting down RabbitMQ
run: docker-compose down
run: docker compose down

migration-check:
runs-on: ubuntu-latest

needs: [build]

steps:
- uses: actions/checkout@v2.3.4
- uses: olafurpg/setup-scala@v13
- uses: actions/checkout@v4
- uses: coursier/setup-action@v1

- name: Cache Coursier dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-${{ github.ref }}-coursier
restore-keys: |
${{ runner.os }}-${{ github.ref }}-coursier
path: ~/.cache/coursier
key: ${{ runner.os }}-${{ github.ref }}-coursier
restore-keys: |
${{ runner.os }}-${{ github.ref }}-coursier
- name: Cache Ivy dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-${{ github.ref }}-ivy2
restore-keys: |
${{ runner.os }}-${{ github.ref }}-ivy2
${{ runner.os }}-${{ github.ref }}-ivy2
- name: Tests
run: sbt -J-Xms4G -J-Xmx4G +mimaReportBinaryIssues
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
jobs:
build:
name: Publish
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: "actions/[email protected]"
- name: java 11 setup
uses: "olafurpg/setup-scala@v13"
with:
java-version: '11'
- uses: "olafurpg/setup-gpg@v3"
- uses: actions/checkout@v4
- name: java setup
uses: coursier/setup-action@v1

- uses: olafurpg/setup-gpg@v3
- env:
PGP_PASSPHRASE: "${{ secrets.PGP_PASSPHRASE }}"
PGP_SECRET: "${{ secrets.PGP_SECRET }}"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ out
metals.sbt

# MacOS
.DS_Store
.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.17"
version = "3.8.3"
style = default
maxColumn = 120
align.preset = most
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@ Check the [official guide](https://fs2-rabbit.profunktor.dev/guide.html) for upd

## Adopters

| Company | Description |
| ------- | ----------- |
| [Cognotekt](http://www.cognotekt.com/en) | Microservice workflow management in Insuretech AI applications. |
| [ITV](https://www.itv.com/) | Internal microservices interaction. |
| [Klarna](https://www.klarna.com/us/) | Microservice for Fintech services. |
| [Philips Lighting](http://www.lighting.philips.com/main/home) | Internal microservices interaction. |
| [Free2Move](https://free2move.com) | Microservice communication. |
| [Descartes Kontainers](https://kontainers.com) | Microservice workflow management - Logistics applications. |
| Company | Description |
|---------------------------------------------------------------|-----------------------------------------------------------------|
| [Cognotekt](http://www.cognotekt.com/en) | Microservice workflow management in Insuretech AI applications. |
| [ITV](https://www.itv.com/) | Internal microservices interaction. |
| [Klarna](https://www.klarna.com/us/) | Microservice for Fintech services. |
| [Philips Lighting](http://www.lighting.philips.com/main/home) | Internal microservices interaction. |
| [Free2Move](https://free2move.com) | Microservice communication. |
| [Descartes Kontainers](https://kontainers.com) | Microservice workflow management - Logistics applications. |
| [Codacy](https://www.codacy.com) | Internal microservices interaction. |
| [Budgetbakers](https://budgetbakers.com) | Internal microservices communication - Fintech |

## Running tests locally

Start a `RabbitMQ` instance using `docker-compose` (recommended):
Start a `RabbitMQ` instance using `docker compose` (recommended):

```bash
> docker-compose up
> docker compose up
> sbt +test
```

Expand Down
27 changes: 10 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import com.scalapenos.sbt.prompt.SbtPrompt.autoImport._
import com.scalapenos.sbt.prompt._
import Dependencies._
import microsites.ExtraMdFileConfig

ThisBuild / name := """fs2-rabbit"""
ThisBuild / scalaVersion := "2.13.12"
ThisBuild / crossScalaVersions := List("2.12.18", "2.13.12", "3.3.1")
ThisBuild / name := "fs2-rabbit"
ThisBuild / scalaVersion := "2.13.14"
ThisBuild / crossScalaVersions := List("2.12.19", "2.13.14", "3.3.3")
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / organization := "dev.profunktor"
ThisBuild / homepage := Some(url("https://fs2-rabbit.profunktor.dev/"))
ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
Expand All @@ -20,13 +19,6 @@ ThisBuild / developers := List(

publish / skip := true

promptTheme := PromptTheme(
List(
text("[sbt] ", fg(105)),
text(_ => "fs2-rabbit", fg(15)).padRight(" λ ")
)
)

def scalaOptions(v: String) =
CrossVersion.partialVersion(v) match {
case Some((2, 13)) => List.empty[String]
Expand Down Expand Up @@ -64,7 +56,7 @@ val commonSettings = List(
libraryDependencies ++= commonDependencies(scalaVersion.value),
resolvers += "Apache public" at "https://repository.apache.org/content/groups/public/",
scalafmtOnCompile := true,
mimaPreviousArtifacts := Set(organization.value %% moduleName.value % "5.0.0")
mimaPreviousArtifacts := previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet
)

def CoreDependencies(scalaVersionStr: String): List[ModuleID] =
Expand Down Expand Up @@ -100,10 +92,11 @@ def TestsDependencies(scalaVersionStr: String): List[ModuleID] =
)

lazy val noPublish = List(
publish := {},
publishLocal := {},
publishArtifact := false,
publish / skip := true
publish := {},
publishLocal := {},
publishArtifact := false,
publish / skip := true,
crossScalaVersions := Nil
)

lazy val `fs2-rabbit-root` = project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,7 +69,7 @@ object ConnectionResource {
_.map(Executors.newFixedThreadPool(numOfThreads, _))
}
.map { es =>
sys.addShutdownHook(es.shutdown())
val _ = sys.addShutdownHook(es.shutdown())
es
}

Expand Down Expand Up @@ -133,6 +133,7 @@ object ConnectionResource {
factory.setConnectionTimeout(conf.connectionTimeout.toMillis.toInt)
factory.setRequestedHeartbeat(conf.requestedHeartbeat.toSeconds.toInt)
factory.setAutomaticRecoveryEnabled(conf.automaticRecovery)
factory.setTopologyRecoveryEnabled(conf.automaticTopologyRecovery)
if (conf.ssl) sslCtx.fold(factory.useSslProtocol())(factory.useSslProtocol)
factory.setSaslConfig(saslConf)
conf.username.foreach(factory.setUsername)
Expand All @@ -150,27 +151,29 @@ object ConnectionResource {

private[fs2rabbit] val acquireConnection: F[AMQPConnection] =
Sync[F]
.delay(connectionFactory.newConnection(addresses.toList.asJava, conf.clientProvidedConnectionName.orNull))
.blocking(
connectionFactory.newConnection(addresses.toList.asJava, conf.clientProvidedConnectionName.orNull)
)
.flatTap(c => Log[F].info(s"Acquired connection: $c"))
.map(RabbitConnection.apply)

private[fs2rabbit] def acquireChannel(connection: AMQPConnection): F[AMQPChannel] =
Sync[F]
.delay(connection.value.createChannel)
.blocking(connection.value.createChannel)
.flatTap(c => Log[F].info(s"Acquired channel: $c"))
.map(RabbitChannel.apply)

override def createConnection: Resource[F, AMQPConnection] =
Resource.make(acquireConnection) { amqpConn =>
Log[F].info(s"Releasing connection: ${amqpConn.value} previously acquired.") *>
Sync[F].delay {
Sync[F].blocking {
if (amqpConn.value.isOpen) amqpConn.value.close()
}
}

override def createChannel(connection: AMQPConnection): Resource[F, AMQPChannel] =
Resource.make(acquireChannel(connection)) { amqpChannel =>
Sync[F].delay {
Sync[F].blocking {
if (amqpChannel.value.isOpen) amqpChannel.value.close()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@ import cats.syntax.flatMap._
import cats.syntax.functor._
import cats.{Applicative, Functor}
import com.rabbitmq.client.{AMQP, Consumer, DefaultConsumer, Envelope, ShutdownSignalException}
import dev.profunktor.fs2rabbit.arguments.{Arguments, _}
import dev.profunktor.fs2rabbit.arguments._
import dev.profunktor.fs2rabbit.model._

import scala.util.{Failure, Success, Try}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 ProfunKtor
* Copyright 2017-2024 ProfunKtor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit ab85ee0

Please sign in to comment.