5.2k sao GitHub và vẫn tăng — reactor/reactor-core là dự án Java mà TopGit đang theo dõi trên nền tảng. Non-Blocking Reactive Foundation for the JVM
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Non-Blocking Reactive Streams Foundation for the JVM both implementing a Reactive Extensions inspired API and efficient event streaming support.
Since 3.3.x, this repository also contains reactor-tools, a java agent aimed at helping with debugging of Reactor code.
Getting it
Reactor 3 requires Java 8 or + to run.
With Gradle from repo.spring.io or Maven Central repositories (stable releases only):
repositories {
mavenCentral()
// Uncomment to get access to Snapshots
// maven { url "https://repo.spring.io/snapshot" }
}
dependencies {
compile "io.projectreactor:reactor-core:3.8.6"
testCompile "io.projectreactor:reactor-test:3.8.6"
// Alternatively, use the following for latest snapshot artifacts in this line
// compile "io.projectreactor:reactor-core:3.8.7-SNAPSHOT"
// testCompile "io.projectreactor:reactor-test:3.8.7-SNAPSHOT"
// Optionally, use `reactor-tools` to help debugging reactor code
// implementation "io.projectreactor:reactor-tools:3.8.6"
}
See the reference documentation
for more information on getting it (eg. using Maven, or on how to get milestones and snapshots).
Note about Android support: Reactor 3 doesn't officially support nor target Android.
However it should work fine with Android SDK 21 (Android 5.0) and above. See the
complete note
in the reference guide.
Trouble building the project?
Since the introduction of Java Multi-Release JAR File
support one needs to have JDK 8, 9, and 21 available on the classpath. All the JDKs should
be automatically detected
or provisioned
by Gradle Toolchain.
However, if you see error message such as No matching toolchains found for requested specification: {languageVersion=X, vendor=any, implementation=vendor-specific} (where
X can be 8, 9 or 21), it means that you need to install the missing JDK:
Installing JDKs with SDKMAN!
In the project root folder run SDKMAN env initialization:
When the installations succeed, try to refresh the project and see that it builds.
Installing JDKs manually
The manual Operation-system specific JDK installation
is well explained in the official docs
Building the doc
The current active shell JDK version must be compatible with JDK17 or higher for Antora to build successfully.
So, just ensure that you have installed JDK 21, as described above and make it as the current one.
Then you can build the antora documentation like this:
./gradlew docs
The documentation is generated in docs/build/site/index.html and in docs/build/distributions/reactor-core-<version>-docs.zip
If a PDF file should also be included in the generated docs zip file, then you need to specify -PforcePdf option:
./gradlew docs -PforcePdf
Notice that PDF generation requires the asciidoctor-pdf command to be available in the PATH.
For example, on Mac OS, you can install such command like this:
brew install asciidoctor
Getting Started
New to Reactive Programming or bored of reading already ? Try the Introduction to Reactor Core hands-on !
If you are familiar with RxJava or if you want to check more detailed introduction, be sure to check
https://www.infoq.com/articles/reactor-by-example !
Flux
A Reactive Streams Publisher with basic flow operators.
Static factories on Flux allow for source generation from arbitrary callbacks types.
Instance methods allows operational building, materialized on each subscription (Flux#subscribe(), ...) or multicasting operations (such as Flux#publish and Flux#publishNext).
Reactor uses a Scheduler as a
contract for arbitrary task execution. It provides some guarantees required by Reactive
Streams flows like FIFO execution.
You can use or create efficient schedulers
to jump thread on the producing flows (subscribeOn) or receiving flows (publishOn):
ParallelFlux can starve your CPU's from any sequence whose work can be subdivided in concurrent
tasks. Turn back into a Flux with ParallelFlux#sequential(), an unordered join or
use arbitrary merge strategies via 'groups()'.
Mono.fromCallable( () -> System.currentTimeMillis() )
.repeat()
.parallel(8) //parallelism
.runOn(Schedulers.parallel())
.doOnNext( d -> System.out.println("I'm on thread "+Thread.currentThread()) )
.subscribe()
Custom sources : Flux.create and FluxSink, Mono.create and MonoSink
To bridge a Subscriber or Processor into an outside context that is taking care of
producing non concurrently, use Flux#create, Mono#create.
Flux.create(sink -> {
ActionListener al = e -> {
sink.next(textField.getText());
};
// without cancellation support:
button.addActionListener(al);
// with cancellation support:
sink.onCancel(() -> {
button.removeListener(al);
});
},
// Overflow (backpressure) handling, default is BUFFER
FluxSink.OverflowStrategy.LATEST)
.timeout(Duration.ofSeconds(3))
.doOnComplete(() -> System.out.println("completed!"))
.subscribe(System.out::println)
The Backpressure Thing
Most of this cool stuff uses bounded ring buffer implementation under the hood to mitigate signal processing difference between producers and consumers. Now, the operators and processors or any standard reactive stream component working on the sequence will be instructed to flow in when these buffers have free room AND only then. This means that we make sure we both have a deterministic capacity model (bounded buffer) and we never block (request more data on write capacity). Yup, it's not rocket science after all, the boring part is already being worked by us in collaboration with Reactive Streams Commons on going research effort.
What's more in it ?
"Operator Fusion" (flow optimizers), health state observers, helpers to build custom reactive components, bounded queue generator, converters from/to Java 9 Flow, Publisher and Java 8 CompletableFuture. The repository contains a reactor-test project with test features like the StepVerifier.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/reactor/reactor-core là nguồn chính thức.
reactor/reactor-core có bao nhiêu sao?
reactor/reactor-core có 5.2k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/reactor/reactor-core. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
reactor/reactor-core có những chủ đề gì?
GitHub topics của reactor/reactor-core: "asynchronous", "flow", "flux", "jvm", "mono", "reactive", "reactive-extensions", "reactive-streams". TopGit xếp repo vào nhóm mã nguồn mở.
reactor/reactor-core còn đang phát triển không?
Commit gần nhất trên reactor/reactor-core là 8 ngày trước (theo timestamp GitHub). Repo có 1.3k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
reactor/reactor-core viết bằng ngôn ngữ gì?
reactor/reactor-core chủ yếu viết bằng Java. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về reactor-core?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về reactor-core.