https://github.com/tvanhens/onyx-core-async
Onyx plugin for core.async
https://github.com/tvanhens/onyx-core-async
Last synced: 3 months ago
JSON representation
Onyx plugin for core.async
- Host: GitHub
- URL: https://github.com/tvanhens/onyx-core-async
- Owner: tvanhens
- License: epl-1.0
- Created: 2015-01-24T21:06:41.000Z (over 11 years ago)
- Default Branch: 0.5.x
- Last Pushed: 2015-01-24T22:34:33.000Z (over 11 years ago)
- Last Synced: 2025-03-11T08:18:06.335Z (over 1 year ago)
- Language: Clojure
- Homepage:
- Size: 274 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## onyx-core-async
Onyx plugin providing read and write facilities for Clojure core.async.
#### Installation
In your project file:
```clojure
[com.mdrogalis/onyx-core-async "0.5.0"]
```
In your peer boot-up namespace:
```clojure
(:require [onyx.plugin.core-async])
```
#### Catalog entries
##### read-from-chan
```clojure
{:onyx/name :in
:onyx/ident :core.async/read-from-chan
:onyx/type :input
:onyx/medium :core.async
:onyx/consumption :concurrent
:onyx/batch-size batch-size
:onyx/max-peers 1
:onyx/doc "Reads segments from a core.async channel"}
```
##### write-to-chan
```clojure
{:onyx/name :out
:onyx/ident :core.async/write-to-chan
:onyx/type :output
:onyx/medium :core.async
:onyx/consumption :concurrent
:onyx/batch-size batch-size
:onyx/max-peers 1
:onyx/doc "Writes segments to a core.async channel"}
```
#### Attributes
This plugin does not use any attributes.
#### Lifecycle Arguments
References to core.async channels must be injected for both the input and output tasks.
##### `read-from-chan`
```clojure
(defmethod l-ext/inject-lifecycle-resources :my.input.task.identity-or-name
[_ _] {:core-async/in-chan (chan capacity})
```
##### `write-to-chan`
```clojure
(defmethod l-ext/inject-lifecycle-resources :my.output.task.identity-or-name
[_ _] {:core-async/out-chan (chan capacity)})
```
#### Functions
##### `take-segments!`
This additional function is provided as a utility for removing segments
from a channel until `:done` is found. After `:done` is encountered, all prior segments,
including `:done`, are returned in a seq.
#### Contributing
Pull requests into the master branch are welcomed.
#### License
Copyright © 2014 Michael Drogalis
Distributed under the Eclipse Public License, the same as Clojure.