Skip to content

Commit

Permalink
Release 0.5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Jan 28, 2025
1 parent 5183768 commit b5f27fa
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ the project!
To test Ox, use the following dependency, using either [sbt](https://www.scala-sbt.org):

```scala
"com.softwaremill.ox" %% "core" % "0.5.8"
"com.softwaremill.ox" %% "core" % "0.5.9"
```

Or [scala-cli](https://scala-cli.virtuslab.org):

```scala
//> using dep "com.softwaremill.ox::core:0.5.8"
//> using dep "com.softwaremill.ox::core:0.5.9"
```

Documentation is available at [https://ox.softwaremill.com](https://ox.softwaremill.com), ScalaDocs can be browsed at [https://javadoc.io](https://www.javadoc.io/doc/com.softwaremill.ox).
Expand Down
1 change: 1 addition & 0 deletions generated-doc/out/_static/state-diagram-cb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion generated-doc/out/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Safe direct-style concurrency and resiliency for Scala on the JVM. Requires JDK 21 & Scala 3.

To start using Ox, add the `com.softwaremill.ox::core:0.5.8` [dependency](info/dependency.md) to your project.
To start using Ox, add the `com.softwaremill.ox::core:0.5.9` [dependency](info/dependency.md) to your project.
Then, take a look at the tour of Ox, or follow one of the topics listed in the menu to get to know Ox's API!

In addition to this documentation, ScalaDocs can be browsed at [https://javadoc.io](https://www.javadoc.io/doc/com.softwaremill.ox).
Expand Down Expand Up @@ -75,6 +75,7 @@ In addition to this documentation, ScalaDocs can be browsed at [https://javadoc.
utils/resources
utils/control-flow
utils/actors
utils/circuit-breaker
utils/utility
.. toctree::
Expand All @@ -83,6 +84,7 @@ In addition to this documentation, ScalaDocs can be browsed at [https://javadoc.
integrations/kafka
integrations/mdc-logback
integrations/cron4s
.. toctree::
:maxdepth: 2
Expand Down
4 changes: 2 additions & 2 deletions generated-doc/out/info/dependency.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ To use ox core in your project, add:

```scala
// sbt dependency
"com.softwaremill.ox" %% "core" % "0.5.8"
"com.softwaremill.ox" %% "core" % "0.5.9"

// scala-cli dependency
//> using dep com.softwaremill.ox::core:0.5.8
//> using dep com.softwaremill.ox::core:0.5.9
```

Ox core depends only on the Java [jox](https://github.com/softwaremill/jox) project, where channels are implemented. There are no other direct or transitive dependencies.
Expand Down
67 changes: 67 additions & 0 deletions generated-doc/out/integrations/cron4s.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Cron scheduler

Dependency:

```scala
"com.softwaremill.ox" %% "cron" % "0.5.9"
```

This module allows to run schedules based on cron expressions from [cron4s](https://github.com/alonsodomin/cron4s).

`CronSchedule` can be used in all places that requires `Schedule` especially in repeat scenarios.

For defining `CronExpr` see [cron4s documentation](https://www.alonsodomin.me/cron4s/userguide/index.html).

## Api

The cron module exposes methods for creating `Schedule` based on `CronExpr`.

```scala
import ox.scheduling.cron.*
import cron4s.*

repeat(RepeatConfig(CronSchedule.unsafeFromString("10-35 2,4,6 * ? * *")))(operation)
```

## Operation definition

Methods from `ox.scheduling.cron.CronSchedule` define `Schedule`, so they can be plugged into `RepeatConfig` and used with `repeat` API.

## Configuration

All configuration beyond `CronExpr` is provided by the `repeat` API. If an error handling within the operation
is needed, you can use a `retry` inside it (see an example below) or use `scheduled` with `CronSchedule` instead of `repeat`, which allows
full customization.

## Examples

```scala
import ox.UnionMode
import ox.scheduling.cron.CronSchedule
import scala.concurrent.duration.*
import ox.resilience.{RetryConfig, retry}
import ox.scheduling.*
import cron4s.*

def directOperation: Int = ???
def eitherOperation: Either[String, Int] = ???
def unionOperation: String | Int = ???

val cronExpr: CronExpr = Cron.unsafeParse("10-35 2,4,6 * ? * *")

// various operation definitions - same syntax
repeat(RepeatConfig(CronSchedule.fromCronExpr(cronExpr)))(directOperation)
repeatEither(RepeatConfig(CronSchedule.fromCronExpr(cronExpr)))(eitherOperation)

// infinite repeats with a custom strategy
def customStopStrategy: Int => Boolean = ???
repeat(RepeatConfig(CronSchedule.fromCronExpr(cronExpr), customStopStrategy))(directOperation)

// custom error mode
repeatWithErrorMode(UnionMode[String])(RepeatConfig(CronSchedule.fromCronExpr(cronExpr)))(unionOperation)

// repeat with retry inside
repeat(RepeatConfig(CronSchedule.fromCronExpr(cronExpr))) {
retry(RetryConfig.backoff(3, 100.millis))(directOperation)
}
```
2 changes: 1 addition & 1 deletion generated-doc/out/integrations/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Dependency:

```scala
"com.softwaremill.ox" %% "kafka" % "0.5.8"
"com.softwaremill.ox" %% "kafka" % "0.5.9"
```

`Flow`s which read from a Kafka topic, mapping stages and drains which publish to Kafka topics are available through
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/integrations/mdc-logback.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Dependency:

```scala
"com.softwaremill.ox" %% "mdc-logback" % "0.5.8"
"com.softwaremill.ox" %% "mdc-logback" % "0.5.9"
```

Ox provides support for setting inheritable MDC (mapped diagnostic context) values, when using the [Logback](https://logback.qos.ch)
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/streaming/flows.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ To obtain a `org.reactivestreams.Publisher` instance, you'll need to add the fol
bring the `toReactiveStreamsPublisher` method into scope:

```scala
// sbt dependency: "com.softwaremill.ox" %% "flow-reactive-streams" % "0.5.8"
// sbt dependency: "com.softwaremill.ox" %% "flow-reactive-streams" % "0.5.9"

import ox.supervised
import ox.flow.Flow
Expand Down
Loading

0 comments on commit b5f27fa

Please sign in to comment.