Skip to content

Commit cbc4bd5

Browse files
committed
Release 1.0.3
1 parent c98eaa3 commit cbc4bd5

File tree

8 files changed

+30
-10
lines changed

8 files changed

+30
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ preserving developer-friendly stack traces, and without compromising performance
2121
To use Ox, add the following dependency, using either [sbt](https://www.scala-sbt.org):
2222

2323
```scala
24-
"com.softwaremill.ox" %% "core" % "1.0.2"
24+
"com.softwaremill.ox" %% "core" % "1.0.3"
2525
```
2626

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

2929
```scala
30-
//> using dep "com.softwaremill.ox::core:1.0.2"
30+
//> using dep "com.softwaremill.ox::core:1.0.3"
3131
```
3232

3333
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).

generated-doc/out/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Safe direct-style streaming, concurrency and resiliency for Scala on the JVM. Requires JDK 21+ & Scala 3.
44

5-
To start using Ox, add the `com.softwaremill.ox::core:1.0.2` [dependency](info/dependency.md) to your project.
5+
To start using Ox, add the `com.softwaremill.ox::core:1.0.3` [dependency](info/dependency.md) to your project.
66
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!
77

88
In addition to this documentation, ScalaDocs can be browsed at [https://javadoc.io](https://www.javadoc.io/doc/com.softwaremill.ox).

generated-doc/out/info/dependency.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ To use ox core in your project, add:
44

55
```scala
66
// sbt dependency
7-
"com.softwaremill.ox" %% "core" % "1.0.2"
7+
"com.softwaremill.ox" %% "core" % "1.0.3"
88

99
// scala-cli dependency
10-
//> using dep com.softwaremill.ox::core:1.0.2
10+
//> using dep com.softwaremill.ox::core:1.0.3
1111
```
1212

1313
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.

generated-doc/out/integrations/cron4s.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "cron" % "1.0.2"
6+
"com.softwaremill.ox" %% "cron" % "1.0.3"
77
```
88

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

generated-doc/out/integrations/kafka.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "kafka" % "1.0.2"
6+
"com.softwaremill.ox" %% "kafka" % "1.0.3"
77
```
88

99
`Flow`s which read from a Kafka topic, mapping stages and drains which publish to Kafka topics are available through

generated-doc/out/integrations/mdc-logback.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "mdc-logback" % "1.0.2"
6+
"com.softwaremill.ox" %% "mdc-logback" % "1.0.3"
77
```
88

99
Ox provides support for setting inheritable MDC (mapped diagnostic context) values, when using the [Logback](https://logback.qos.ch)

generated-doc/out/integrations/otel-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "otel-context" % "1.0.2"
6+
"com.softwaremill.ox" %% "otel-context" % "1.0.3"
77
```
88

99
When using the default OpenTelemetry context-propagation mechanisms, which rely on thread-local storage, the context

generated-doc/out/streaming/flows.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,26 @@ As part of the callback, you can create [supervision scopes](../structured-concu
6060

6161
Any asynchronous communication should be best done with [channels](channels.md). You can then manually forward any elements received from a channel to `emit`, or use e.g. `FlowEmit.channelToEmit`.
6262

63+
Alternatively, flows can be created by providing a function that receives a `Sink` (channel):
64+
65+
```scala
66+
import ox.flow.Flow
67+
import ox.{fork, supervised}
68+
69+
supervised:
70+
Flow.usingChannel: sink =>
71+
sink.send(1)
72+
fork:
73+
sink.send(2)
74+
sink.send(3)
75+
sink.send(4)
76+
// TODO: transform the flow further & run
77+
```
78+
79+
Unlike `usingEmit`, the `Sink` instance can be safely shared across threads, as channels are thread-safe. The provided function is run asynchronously in a forked task. The flow completes when the function completes and the sink is automatically closed. If the function throws an exception, it is propagated as a flow error.
80+
81+
Note that `Flow.usingChannel` must be run within a concurrency scope, as it creates a fork to run the provided function.
82+
6383
## Transforming flows: basics
6484

6585
Multiple transformation stages can be added to a flow, each time returning a new `Flow` instance, describing the extended pipeline. As before, no elements are emitted or transformed until the flow is run, as flows are lazy. There's a number of pre-defined transformation stages, many of them similar in function to corresponding methods on Scala's collections:
@@ -171,7 +191,7 @@ To obtain a `org.reactivestreams.Publisher` instance, you'll need to add the fol
171191
bring the `toReactiveStreamsPublisher` method into scope:
172192

173193
```scala
174-
// sbt dependency: "com.softwaremill.ox" %% "flow-reactive-streams" % "1.0.2"
194+
// sbt dependency: "com.softwaremill.ox" %% "flow-reactive-streams" % "1.0.3"
175195

176196
import ox.supervised
177197
import ox.flow.Flow

0 commit comments

Comments
 (0)