[jOOQ/jOOQ#14490] Add a jOOQ-reactor-extensions module offering reactor
specific extensions
This commit is contained in:
parent
203a32cdb4
commit
6ac0e77f73
3
jOOQ-reactor-extensions/.gitignore
vendored
Normal file
3
jOOQ-reactor-extensions/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/target
|
||||
/.idea
|
||||
/*.iml
|
||||
19
jOOQ-reactor-extensions/LICENSE.txt
Normal file
19
jOOQ-reactor-extensions/LICENSE.txt
Normal file
@ -0,0 +1,19 @@
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Other licenses:
|
||||
-----------------------------------------------------------------------------
|
||||
Commercial licenses for this work are available. These replace the above
|
||||
Apache-2.0 license and offer limited warranties, support, maintenance, and
|
||||
commercial database integrations.
|
||||
|
||||
For more information, please visit: https://www.jooq.org/legal/licensing
|
||||
10
jOOQ-reactor-extensions/NOTICE.txt
Normal file
10
jOOQ-reactor-extensions/NOTICE.txt
Normal file
@ -0,0 +1,10 @@
|
||||
Third party NOTICE.txt contents
|
||||
===============================
|
||||
|
||||
Contents of https://github.com/apache/commons-lang/blob/master/NOTICE.txt
|
||||
-------------------------------------------------------------------------
|
||||
Apache Commons Lang
|
||||
Copyright 2001-2019 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
72
jOOQ-reactor-extensions/pom.xml
Normal file
72
jOOQ-reactor-extensions/pom.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq-parent</artifactId>
|
||||
<version>3.20.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>jooq-reactor-extensions</artifactId>
|
||||
<name>jOOQ Reactor Extensions</name>
|
||||
<description>jOOQ's utilities for Reactor integration</description>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
<url>https://www.jooq.org/inc/LICENSE.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</licenses>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Automatic-Module-Name>org.jooq.reactor.extensions</Automatic-Module-Name>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
15
jOOQ-reactor-extensions/src/main/java/module-info.java
Normal file
15
jOOQ-reactor-extensions/src/main/java/module-info.java
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* The jOOQ reactor extensions module.
|
||||
*/
|
||||
module org.jooq.reactor.extensions {
|
||||
|
||||
// Other jOOQ modules
|
||||
requires transitive org.jooq;
|
||||
|
||||
// Nullability annotations for better Kotlin interop
|
||||
requires static org.jetbrains.annotations;
|
||||
|
||||
requires transitive reactor.core;
|
||||
|
||||
exports org.jooq.reactor.extensions;
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Other licenses:
|
||||
* -----------------------------------------------------------------------------
|
||||
* Commercial licenses for this work are available. These replace the above
|
||||
* Apache-2.0 license and offer limited warranties, support, maintenance, and
|
||||
* commercial database integrations.
|
||||
*
|
||||
* For more information, please visit: https://www.jooq.org/legal/licensing
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.jooq.reactor.extensions;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.jooq.SubscriberProvider;
|
||||
|
||||
import org.reactivestreams.Subscriber;
|
||||
import org.reactivestreams.Subscription;
|
||||
|
||||
import reactor.core.CoreSubscriber;
|
||||
import reactor.util.context.Context;
|
||||
|
||||
/**
|
||||
* A reactor {@link Context} aware implementation of the
|
||||
* {@link SubscriberProvider} SPI.
|
||||
* <p>
|
||||
* This implementation helps jOOQ wrap all of its internal {@link Subscriber}
|
||||
* instances in a {@link CoreSubscriber}, which allows for reactor context
|
||||
* propagation.
|
||||
*
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
public class CoreSubscriberProvider implements SubscriberProvider<Context> {
|
||||
|
||||
@Override
|
||||
public Context context() {
|
||||
return Context.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context context(Subscriber<?> subscriber) {
|
||||
if (subscriber instanceof CoreSubscriber<?> c)
|
||||
return c.currentContext();
|
||||
else
|
||||
return context();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Subscriber<T> subscriber(
|
||||
Consumer<? super Subscription> onSubscribe,
|
||||
Consumer<? super T> onNext,
|
||||
Consumer<? super Throwable> onError,
|
||||
Runnable onComplete,
|
||||
Context context
|
||||
) {
|
||||
return new CoreSubscriber<T>() {
|
||||
|
||||
@Override
|
||||
public Context currentContext() {
|
||||
return context != null
|
||||
? context
|
||||
: context();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(T t) {
|
||||
onNext.accept(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
onError.accept(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Subscription s) {
|
||||
onSubscribe.accept(s);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Other licenses:
|
||||
-----------------------------------------------------------------------------
|
||||
Commercial licenses for this work are available. These replace the above
|
||||
Apache-2.0 license and offer limited warranties, support, maintenance, and
|
||||
commercial database integrations.
|
||||
|
||||
For more information, please visit: https://www.jooq.org/legal/licensing
|
||||
@ -0,0 +1,2 @@
|
||||
Thanks for downloading jOOQ.
|
||||
Please visit http://www.jooq.org for more information.
|
||||
6
pom.xml
6
pom.xml
@ -131,6 +131,11 @@
|
||||
<artifactId>jooq-postgres-extensions</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq-reactor-extensions</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq-jackson-extensions</artifactId>
|
||||
@ -860,6 +865,7 @@
|
||||
<module>jOOQ-jackson-extensions</module>
|
||||
<module>jOOQ-jpa-extensions</module>
|
||||
<module>jOOQ-postgres-extensions</module>
|
||||
<module>jOOQ-reactor-extensions</module>
|
||||
|
||||
<module>jOOQ-meta</module>
|
||||
<module>jOOQ-meta-extensions</module>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user