Skip to content

Commit 0961121

Browse files
committed
reactive-streams: need to fix sb component scan and rest example
1 parent 6653f05 commit 0961121

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

reactive-streams/readme.adoc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
This example shows some possible usages of the Camel reactive streams component.
44

5+
=== Introduction
6+
57
The following sample routes are started together in a spring-boot application (all routes use `reactor-core` as external reactive framework):
68

79
- **examples.basic.camel-to-reactor**: shows how data generated by Camel route can be consumed by a reactive application.
810
- **examples.basic.camel-to-reactor-in-out**: shows how Camel data can be processed by a reactive library and return back to Camel to complete the flow.
911
- **examples.basic.reactor-to-camel**: shows how data generated by a reactive application can be consumed by a Camel route.
1012
- **examples.basic.reactor-to-camel-in-out**: shows how data generated by a reactive application can can be processed by Camel and return back to the library to complete the flow.
1113
- **examples.client-api.rest**: shows how a rest service can be defined using the reactive streams client API only.
12-
- **examples.client-api.workflow**: shows how multiple Camel endpoints can be used into a reactive streams processing flow.
14+
- **examples.client-api.workflow**: shows how multiple Camel endpoints can be used into a reactive streams processing flow. It reads from an "input" named directory, filtering files containing "camel" as text as criteria before sending to an external system
1315
- **examples.others.rest**: shows how `Publisher` classes can be used as parameters or return types in beans.
1416

1517
All routes are enabled by default, but they can be switched off by changing the `src/main/resources/application.yml` file.
@@ -21,6 +23,29 @@ You can run this example using
2123

2224
mvn spring-boot:run
2325

26+
In some cases the camel reactor streams routes can be verified during execution of application, but we can also verify the functionality of reactor subscriptions through some defined Rest APIs.
27+
28+
Rest API to retrieve informations about orders:
29+
30+
http://localhost:8080/camel/orders/1
31+
http://localhost:8080/camel/orders/2
32+
33+
If we call:
34+
35+
----
36+
curl http://localhost:8080/camel/orders/3
37+
----
38+
39+
We should receive a message "Not Found" as result of Flux Reactor coded behaviour
40+
41+
Rest API for reactor managed calculator:
42+
43+
----
44+
curl http://localhost:8080/camel/sum/23/31
45+
----
46+
47+
Let verify "54" as result
48+
2449
=== Help and contributions
2550

2651
If you hit any problem using Camel or have some feedback, then please

reactive-streams/src/main/java/org/apache/camel/example/reactive/streams/ClientAPIWorkflowExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void configure() throws Exception {
8080
.log("Content marshalled to string: ${body}");
8181

8282
from("direct:send")
83-
.log("Sending the file to an external system (simulation)");
83+
.log("Sending the file to an external system (simulation) with text: ${body}");
8484

8585
}
8686

reactive-streams/src/main/java/org/apache/camel/example/reactive/streams/RestExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public void configure() throws Exception {
7070
.to("direct:sum");
7171

7272
from("direct:sum")
73-
.setHeader("num1").simple("${headerAs(num1,Long)}")
74-
.setHeader("num2").simple("${headerAs(num2,Long)}")
73+
.setHeader("num1").simple("${header.num1}",Long.class)
74+
.setHeader("num2").simple("${header.num2}",Long.class)
7575
.bean("calculator", "sum")
7676
.process(new UnwrapStreamProcessor())
7777
.setBody().simple("The result is: ${body}");

reactive-streams/src/main/java/org/apache/camel/example/reactive/streams/app/ReactiveStreamsSpringBootApp.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
package org.apache.camel.example.reactive.streams.app;
1818

1919
import org.springframework.boot.SpringApplication;
20+
import org.springframework.context.annotation.ComponentScan;
2021
import org.springframework.boot.autoconfigure.SpringBootApplication;
2122

2223
//CHECKSTYLE:OFF
2324
@SpringBootApplication
25+
@ComponentScan(basePackages = "org.apache.camel.example.reactive.streams")
2426
public class ReactiveStreamsSpringBootApp {
2527

2628
public static void main(String[] args) {

0 commit comments

Comments
 (0)