You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/integration/data-federation.md
+25-5Lines changed: 25 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,10 +77,10 @@ Relying on live calls to remote services per row is clearly not an option. Inste
77
77
78
78
We'll use the same [XTravels sample](calesi.md#the-xtravels-sample) and setup as in the [_CAP-level Service Integration_](calesi.md) guide. If you haven't done so already, clone the required repositories to follow along:
> Line 6 above turns the `cap/samples` folder into a root for `npm workspaces` to optimize the `npm install` locally.
99
+
> We'll learn more about that in the [_Inner Loop Development guide_](inner-loops.md).
92
100
93
101
94
102
@@ -180,15 +188,27 @@ Let's have a closer look at this code, which handles these main tasks:
180
188
181
189
## Test Drive Locally
182
190
183
-
Let's see the outcome in action: to activate the above data federation code, edit `srv/server.js` file and uncomment the single line of code in there like this:
191
+
Let's see the outcome in action: to activate the above data federation code, edit `xtravels/srv/server.js` file and uncomment the single line of code in there like this:
Restart the Xtravels app, and see these lines in the log output:
199
+
With that in place, we can start the xtravels app again, and see the data federation in action. Do so by running the following commands from within the `cap/samples` root folder in separate terminals, and in that order:
200
+
201
+
```shell :line-numbers=1
202
+
cds watch s4
203
+
```
204
+
```shell :line-numbers=2
205
+
cds watch xflights
206
+
```
207
+
```shell :line-numbers=3
208
+
cds watch xtravels
209
+
```
210
+
211
+
In the logs of the xtravels app server, you should now see the output of the replication handler, showing that entries from the remote services are replicated locally:
Copy file name to clipboardExpand all lines: guides/integration/inner-loops.md
+20-7Lines changed: 20 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,26 +32,39 @@ Here's a very rough comparison from a real world example:
32
32
33
33
### The XTravels Sample
34
34
35
-
We'll use the same [XTravels sample](calesi.md#the-xtravels-sample) and setup as in the [_CAP-level Service Integration_](calesi.md) guide. If you haven't done so already, clone the required repositories to follow along:
35
+
We'll use the same [XTravels sample](calesi.md#the-xtravels-sample) and setup as described in the [_CAP-level Service Integration_](calesi.md) guide. If you haven't done so already, clone the required repositories to follow along:
> Line 6 above turns the `cap/samples` folder into a root for `npm workspaces`. For the time being this simply optimizes the `npm install`. We'll revisit that in chapter [*Using `npm` Workspaces*](#using-npm-workspaces) below.
54
57
58
+
#### Activate Generic Data Federation
59
+
60
+
In addition, activate generic data federation as described in the [_CAP-level Data Federation_](data-federation.md) guide, by editing `xtravels/srv/server.js` file and uncommenting the single line of code in there like this:
@@ -166,12 +179,12 @@ For Java, make sure to add the `--with-mocks` option to the `cds deploy` command
166
179
167
180
## Run with Real Services
168
181
169
-
Instead of mocking required services by the imported APIs [using `cds mock` as shown above](#cds-mock), we can also run the real *xflights* service from its respective home folder which we [cloned already in the beginning](#the-xtravels-sample). We can combine that with `s4` still mocked from the imported API, as above.
182
+
Instead of mocking required services by the imported APIs [using `cds mock` as shown above](#cds-mock), we can also run the real *xflights* and *s4* services from their respective home folders which we [cloned already in the beginning](#the-xtravels-sample).
170
183
171
184
Do so by running the following commands from within the `cap/samples` root folder in separate terminals, and in that order:
172
185
173
186
```shell :line-numbers=1
174
-
cd xtravels;cds mock apis/capire/s4.cds
187
+
cds watch s4
175
188
```
176
189
```shell :line-numbers=2
177
190
cds watch xflights
@@ -200,10 +213,10 @@ In the log output of the xtravels server we should see that it _connects_ to the
200
213
201
214
We can use `cds repl` to experiment the options to send requests and queries to remote services interactively. Do so as follows...
202
215
203
-
From within the xtravels project's root folder `cap/samples/xtravels`, start by mocking the remote services in separate terminals, then start xtravels server within `cds repl` (instead of `cds watch`) in a third terminal:
216
+
From within the xtravels project's root folder `cap/samples/xtravels`, start by again running the remote services in separate terminals, then start xtravels server again in a third terminal, this time within `cds repl` instead of `cds watch`:
0 commit comments