File tree Expand file tree Collapse file tree 7 files changed +90
-0
lines changed
src/main/java/io/quarkiverse/flow/deployment
main/java/io/quarkiverse/flow/it
test/java/io/quarkiverse/flow/it
java/io/quarkiverse/flow/converters
resources/META-INF/services Expand file tree Collapse file tree 7 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 2929 <groupId >io.quarkus</groupId >
3030 <artifactId >quarkus-jackson-deployment</artifactId >
3131 </dependency >
32+ <dependency >
33+ <groupId >io.serverlessworkflow</groupId >
34+ <artifactId >serverlessworkflow-experimental-lambda</artifactId >
35+ </dependency >
3236 <dependency >
3337 <groupId >io.quarkus</groupId >
3438 <artifactId >quarkus-rest-client-jackson-deployment</artifactId >
Original file line number Diff line number Diff line change 11package io .quarkiverse .flow .deployment ;
22
3+ import io .quarkiverse .flow .converters .Multi2CompletableFuture ;
4+ import io .quarkiverse .flow .converters .Uni2CompletableFuture ;
35import io .quarkiverse .flow .providers .MetadataPropagationRequestDecorator ;
46import io .quarkus .deployment .annotations .BuildProducer ;
57import io .quarkus .deployment .annotations .BuildStep ;
911import io .serverlessworkflow .impl .events .EventPublisher ;
1012import io .serverlessworkflow .impl .events .InMemoryEvents ;
1113import io .serverlessworkflow .impl .executors .TaskExecutorFactory ;
14+ import io .serverlessworkflow .impl .executors .func .DataTypeConverter ;
1215import io .serverlessworkflow .impl .executors .func .JavaTaskExecutorFactory ;
1316import io .serverlessworkflow .impl .executors .http .HttpRequestDecorator ;
1417import io .serverlessworkflow .impl .expressions .ExpressionFactory ;
@@ -41,6 +44,8 @@ void registerSDKServiceProviders(BuildProducer<ServiceProviderBuildItem> sp) {
4144 JacksonModelFactory .class .getName ()));
4245 sp .produce (new ServiceProviderBuildItem (HttpRequestDecorator .class .getName (),
4346 MetadataPropagationRequestDecorator .class .getName ()));
47+ sp .produce (new ServiceProviderBuildItem (DataTypeConverter .class .getName (),
48+ Uni2CompletableFuture .class .getName (), Multi2CompletableFuture .class .getName ()));
4449 }
4550
4651}
Original file line number Diff line number Diff line change 1+ package io .quarkiverse .flow .it ;
2+
3+ import jakarta .enterprise .context .ApplicationScoped ;
4+
5+ import io .quarkiverse .flow .Flow ;
6+ import io .serverlessworkflow .api .types .Workflow ;
7+ import io .serverlessworkflow .fluent .func .FuncWorkflowBuilder ;
8+ import io .smallrye .mutiny .Uni ;
9+
10+ @ ApplicationScoped
11+ public class UniWorkflow extends Flow {
12+
13+ public Workflow descriptor () {
14+ return FuncWorkflowBuilder .workflow ("uniTest" )
15+ .tasks (tasks -> tasks .function (f -> f .function (t -> Uni .createFrom ().item ("Javierito" ))))
16+ .build ();
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ package io .quarkiverse .flow .it ;
2+
3+ import static org .assertj .core .api .Assertions .assertThat ;
4+
5+ import jakarta .inject .Inject ;
6+
7+ import org .junit .jupiter .api .Test ;
8+
9+ import io .quarkus .test .junit .QuarkusTest ;
10+
11+ @ QuarkusTest
12+ public class UniWorkflowTest {
13+
14+ @ Inject
15+ UniWorkflow def ;
16+
17+ @ Test
18+ void testUni () {
19+ assertThat (def .startInstance ().await ().indefinitely ().as (String .class ).orElseThrow ()).isEqualTo ("Javierito" );
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ package io .quarkiverse .flow .converters ;
2+
3+ import java .util .concurrent .CompletableFuture ;
4+
5+ import io .serverlessworkflow .impl .executors .func .DataTypeConverter ;
6+ import io .smallrye .mutiny .Multi ;
7+
8+ @ SuppressWarnings ("rawtypes" )
9+ public class Multi2CompletableFuture implements DataTypeConverter <Multi , CompletableFuture > {
10+
11+ @ Override
12+ public CompletableFuture apply (Multi t ) {
13+ return t .toUni ().subscribeAsCompletionStage ();
14+ }
15+
16+ @ Override
17+ public Class <Multi > sourceType () {
18+ return Multi .class ;
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ package io .quarkiverse .flow .converters ;
2+
3+ import java .util .concurrent .CompletableFuture ;
4+
5+ import io .serverlessworkflow .impl .executors .func .DataTypeConverter ;
6+ import io .smallrye .mutiny .Uni ;
7+
8+ @ SuppressWarnings ("rawtypes" )
9+ public class Uni2CompletableFuture implements DataTypeConverter <Uni , CompletableFuture > {
10+
11+ @ Override
12+ public CompletableFuture apply (Uni t ) {
13+ return t .subscribeAsCompletionStage ();
14+ }
15+
16+ @ Override
17+ public Class <Uni > sourceType () {
18+ return Uni .class ;
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ io.quarkiverse.flow.converters.Uni2CompletableFuture
2+ io.quarkiverse.flow.converters.Multi2CompletableFuture
You can’t perform that action at this time.
0 commit comments