File tree Expand file tree Collapse file tree
springboot/src/main/java/io/temporal/samples/springboot/camel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929public class CamelRoutes extends RouteBuilder {
3030
3131 @ Autowired private WorkflowClient workflowClient ;
32+ @ Autowired OrderRepository repository ;
3233
3334 @ Override
3435 public void configure () {
@@ -47,5 +48,13 @@ public void configure() {
4748 exchange .getIn ().setBody (workflow .start ());
4849 })
4950 .end ();
51+
52+ from ("direct:findAllOrders" )
53+ .routeId ("direct-findAllOrders" )
54+ .process (
55+ exchange -> {
56+ exchange .getIn ().setBody (repository .findAll ());
57+ })
58+ .end ();
5059 }
5160}
Original file line number Diff line number Diff line change 2121
2222import io .temporal .spring .boot .ActivityImpl ;
2323import java .util .List ;
24+ import org .apache .camel .ProducerTemplate ;
2425import org .springframework .beans .factory .annotation .Autowired ;
2526import org .springframework .stereotype .Component ;
2627
2728@ Component
2829@ ActivityImpl (taskQueues = "CamelSampleTaskQueue" )
2930public class OrderActivityImpl implements OrderActivity {
3031
31- @ Autowired OrderRepository repository ;
32+ @ Autowired private ProducerTemplate producerTemplate ;
3233
3334 @ Override
3435 public List <OfficeOrder > getOrders () {
35- return repository .findAll ();
36+ producerTemplate .start ();
37+ List <OfficeOrder > orders =
38+ producerTemplate .requestBody ("direct:findAllOrders" , null , List .class );
39+ producerTemplate .stop ();
40+ return orders ;
3641 }
3742}
Original file line number Diff line number Diff line change 88
99 http://localhost:3030/orders
1010
11- This sample starts an Apache Camel route which runs our orders Workflow.
12- Results of the workflow are returned by the Camel route
11+ This sample starts an Apache Camel route which starts our orders Workflow.
12+ The workflow starts an activity which starts Camel route to get all orders JPA.
You can’t perform that action at this time.
0 commit comments