-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from commercetools/site/bootstrap
Bootstrap website
- Loading branch information
Showing
32 changed files
with
715 additions
and
194 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 |
---|---|---|
|
@@ -76,11 +76,11 @@ jobs: | |
|
||
- name: Make target directories | ||
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') | ||
run: mkdir -p project/target | ||
run: mkdir -p unidocs/target project/target | ||
|
||
- name: Compress target directories | ||
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') | ||
run: tar cf targets.tar project/target | ||
run: tar cf targets.tar unidocs/target project/target | ||
|
||
- name: Upload target directories | ||
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') | ||
|
@@ -160,3 +160,53 @@ jobs: | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} | ||
run: sbt tlCiRelease | ||
|
||
site: | ||
name: Generate Site | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
java: [temurin@11] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout current branch (full) | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Java (temurin@8) | ||
id: setup-java-temurin-8 | ||
if: matrix.java == 'temurin@8' | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 8 | ||
cache: sbt | ||
|
||
- name: sbt update | ||
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' | ||
run: sbt +update | ||
|
||
- name: Setup Java (temurin@11) | ||
id: setup-java-temurin-11 | ||
if: matrix.java == 'temurin@11' | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 11 | ||
cache: sbt | ||
|
||
- name: sbt update | ||
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' | ||
run: sbt +update | ||
|
||
- name: Generate site | ||
run: sbt docs/tlSite | ||
|
||
- name: Publish site | ||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | ||
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: site/target/docs/site | ||
keep_files: true |
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
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
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,3 +1,3 @@ | ||
cloud-queues | ||
Copyright 2023 Commercetools GmbH | ||
fs2-queues | ||
Copyright 2024 Commercetools GmbH | ||
Licensed under Apache License 2.0 (see LICENSE) |
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,84 +1,16 @@ | ||
# Common Cloud Client Tools | ||
[![Continuous Integration](https://github.com/commercetools/fs2-queues/actions/workflows/ci.yml/badge.svg)](https://github.com/commercetools/fs2-queues/actions/workflows/ci.yml) | ||
|
||
Aims at providing a unified way of working with cloud queues (SQS, PubSub, Service Bus, ...) across all CT scala services. | ||
Aims at providing a unified way of working with cloud queues (SQS, PubSub, Service Bus, ...). | ||
|
||
## Common queue interface | ||
All the abstractions are defined in the [`core`](core/) module. Other modules implement the abstraction for various queue systems and integration with other libraries. | ||
|
||
The library offers both low and high level possibilities, making it possible to have fine grained control over queue pulling, or just focusing on processing, delegating message management to the library. | ||
For more documentation, head over to the [documentation website](https://commercetools.github.io/fs2-queues). | ||
|
||
The design of the API is the result of the common usage patterns at CT and how the various client SDKs are designed. | ||
There are several views possible on a queue: | ||
- as a `QueuePublisher` when you only need to publish messages to an existing queue. | ||
- as a `QueueSubscriber` when you only need to subscribe to an existing queue. | ||
- as a `QueueAdministration` when you need to manage queues (creation, deletion, ...). | ||
## Development | ||
|
||
The entry point is the `QueueClient` factory for each underlying queue system. | ||
|
||
In the examples below, we will use the following publisher and subscriber streams: | ||
|
||
```scala | ||
import fs2.Stream | ||
import cats.effect.IO | ||
import cats.effect.std.Random | ||
import scala.concurrent.duration._ | ||
|
||
import com.commercetools.queue._ | ||
|
||
def publishStream(publisher: QueuePublisher[IO, String]): Stream[IO, Nothing] = | ||
Stream.eval(Random.scalaUtilRandom[IO]).flatMap { random => | ||
Stream | ||
// repeatedly emit a random string of length 10 | ||
.repeatEval(random.nextString(10)) | ||
// every 100 milliseconds | ||
.metered(100.millis) | ||
// and publish in batch of 10 | ||
.through(publisher.sink(batchSize = 10)) | ||
} | ||
|
||
def subscribeStream(subscriber: QueueSubscriber[IO, String]): Stream[IO, Nothing] = | ||
subscriber | ||
// receives messages in batches of 5, | ||
// waiting max for 20 seconds | ||
// print every received message, | ||
// and ack automatically | ||
.processWithAutoAck(5, 20.seconds)(msg => IO.println(msg.payload)) | ||
// results are non important | ||
.drain | ||
|
||
def program(client: QueueClient[IO]): IO[Unit] = { | ||
val queueName = "my-queue" | ||
// subscribe and publish concurrently | ||
subscribeStream(client.subscribe[String](queueName)) | ||
// concurrently publish messages | ||
.concurrently(publishStream(client.publish[String](queueName))) | ||
.compile | ||
// runs forever | ||
.drain | ||
} | ||
``` | ||
|
||
## Working with Azure Service Bus queues | ||
|
||
```scala | ||
import com.commercetools.queue.azure.servicebus._ | ||
import com.azure.identity.DefaultAzureCredentialBuilder | ||
|
||
val namespace = "{namespace}.servicebus.windows.net" // your namespace | ||
val credentials = new DefaultAzureCredentialBuilder().build() // however you want to authenticate | ||
|
||
ServiceBusClient[IO](namespace, credentials).use(program(_)) | ||
``` | ||
|
||
## Working with AWS SQS | ||
|
||
|
||
```scala | ||
import com.commercetools.queue.aws.sqs._ | ||
import software.amazon.awssdk.regions.Region | ||
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider | ||
|
||
val region = Region.US_EAST_1 // your region | ||
val credentials = DefaultCredentialsProvider.create() // however you want to authenticate | ||
|
||
SQSClient[IO](region, credentials).use(program(_)) | ||
``` | ||
Following commands are useful when developing: | ||
- `sbt compile` compiles all the modules. | ||
- `sbt test` runs all the tests. | ||
- `sbt prePR` prepares the current branch before pushing and opening a PR. It ensures various static checks will pass. | ||
- `sbt docs/tlSitePreview` starts a local server with the built documentation site. |
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
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
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
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
Oops, something went wrong.