Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ GEM
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.6)
dnsruby (1.61.3)
addressable (~> 2.5)
dnsruby (1.61.4)
simpleidn (~> 0.1)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
Expand All @@ -37,9 +37,9 @@ GEM
ffi (1.13.1)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (206)
github-pages (207)
github-pages-health-check (= 1.16.1)
jekyll (= 3.8.7)
jekyll (= 3.9.0)
jekyll-avatar (= 0.7.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.1.6)
Expand Down Expand Up @@ -73,7 +73,8 @@ GEM
jekyll-theme-time-machine (= 0.1.1)
jekyll-titles-from-headings (= 0.5.3)
jemoji (= 0.11.1)
kramdown (= 1.17.0)
kramdown (= 2.3.0)
kramdown-parser-gfm (= 1.1.0)
liquid (= 4.0.3)
mercenary (~> 0.3)
minima (= 2.5.1)
Expand All @@ -100,14 +101,14 @@ GEM
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.8.7)
jekyll (3.9.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 2.0)
kramdown (~> 1.14)
kramdown (>= 1.17, < 3)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
Expand Down Expand Up @@ -206,7 +207,10 @@ GEM
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
kramdown (1.17.0)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
Expand Down Expand Up @@ -234,6 +238,7 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.19.0)
ruby-enum (0.8.0)
i18n
Expand All @@ -247,13 +252,18 @@ GEM
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
simpleidn (0.1.1)
unf (~> 0.1.4)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.7)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
yell (2.2.2)
zeitwerk (2.4.0)
Expand Down
52 changes: 27 additions & 25 deletions docs/guides/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ The Event Consumer, as depicted above, implements the Event transformation logic
establish this communication channel, the **Airplane Supplies** system declares a [gRPC](https://grpc.io/)
service. In [`supplies_service.proto`](https://github.com/spine-examples/airport/blob/master/airplane-supplies/src/main/proto/spine/example/airport/supplies/supplies_service.proto):

<?embed-code file="examples/airport/airplane-supplies/src/main/proto/spine/example/airport/supplies/supplies_service.proto"
start="message Subscription*"
end="}*"?>
[//]: # <?embed-code file="examples/airport/airplane-supplies/src/main/proto/spine/example/airport/supplies/supplies_service.proto"
[//]: # start="message Subscription*"
[//]: # end="}*"?>
```proto
message Subscription {

Expand All @@ -102,9 +102,9 @@ message Subscription {
google.protobuf.Timestamp starting_from = 3;
}
```
<?embed-code file="examples/airport/airplane-supplies/src/main/proto/spine/example/airport/supplies/supplies_service.proto"
start="enum EventType*"
end="}*"?>
[//]: # <?embed-code file="examples/airport/airplane-supplies/src/main/proto/spine/example/airport/supplies/supplies_service.proto"
[//]: # start="enum EventType*"
[//]: # end="}*"?>
```proto
enum EventType {
ALL = 0;
Expand All @@ -117,8 +117,8 @@ enum EventType {
The **Airplane Supplies** system [implements](https://github.com/spine-examples/airport/blob/master/airplane-supplies/src/main/java/io/spine/example/airport/supplies/SuppliesEventProducer.java)
the service and exposes it on an endpoint available to the **Takeoffs and Landings** system:

<?embed-code file="examples/airport/airplane-supplies/src/main/java/io/spine/example/airport/supplies/SuppliesEventProducer.java"
fragment="SuppliesEventProducer" ?>
[//]: # <?embed-code file="examples/airport/airplane-supplies/src/main/java/io/spine/example/airport/supplies/SuppliesEventProducer.java"
[//]: # fragment="SuppliesEventProducer" ?>
```java
public final class SuppliesEventProducer extends SuppliesEventProducerImplBase {
...
Expand All @@ -145,8 +145,8 @@ an&nbsp;[event consumer](https://github.com/spine-examples/airport/blob/master/t
which constructs a subscription and maintains it as long as the system needs to receive more events.
The consumer broadcasts the received Events via an instance of [`ThirdPartyContext`](https://spine.io/core-java/reference/server/io/spine/server/integration/ThirdPartyContext.html):

<?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/supplies/SuppliesEventConsumer.java"
fragment="onNext" ?>
[//]: # <?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/supplies/SuppliesEventConsumer.java"
[//]: # fragment="onNext" ?>
```java
@Override
public void onNext(SuppliesEvent event) {
Expand All @@ -168,9 +168,9 @@ The [`AircraftAggregate`](https://github.com/spine-examples/airport/blob/master/
reacts on those events. Note that all the events published through `ThirdPartyContext` are always
`external`, so should be the subscriber and reactor methods.

<?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/AircraftAggregate.java"
start="@React"
end="}"?>
[//]: # <?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/AircraftAggregate.java"
[//]: # start="@React"
[//]: # end="}"?>
```java
@React
AircraftPreparedForFlight on(@External PreflightCheckComplete event) {
Expand Down Expand Up @@ -201,9 +201,9 @@ The Consumer consists of two parts: [`WeatherUpdateClient`](https://github.com/s
and [`WeatherUpdateEndpoint`](https://github.com/spine-examples/airport/blob/master/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/weather/WeatherUpdateEndpoint.java).
The client polls the pull-style API of the **Weather** system.

<?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/weather/WeatherUpdateClient.java"
start="private void fetchWeatherUpdates"
end="^ }"?>
[//]: # <?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/weather/WeatherUpdateClient.java"
[//]: # start="private void fetchWeatherUpdates"
[//]: # end="^ }"?>
```java
private void fetchWeatherUpdates() {
Instant lastEvent = lastEventTime;
Expand All @@ -230,9 +230,9 @@ private void fetchWeatherUpdates() {
The endpoint handles the polled measurements and publishes them as Events in
the **Takeoffs and Landings** context:

<?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/weather/WeatherUpdateEndpoint.java"
start="public void receiveNew"
end="^ }"?>
[//]: # <?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/weather/WeatherUpdateEndpoint.java"
[//]: # start="public void receiveNew"
[//]: # end="^ }"?>
```java
public void receiveNew(WeatherMeasurement measurement) {
checkNotNull(measurement);
Expand All @@ -255,8 +255,9 @@ public void receiveNew(WeatherMeasurement measurement) {
```
The [`FlightAggregate`](https://github.com/spine-examples/airport/blob/master/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/FlightAggregate.java)
reacts on those events and changes its state as the result:
<?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/FlightAggregate.java"
fragment="TemperatureChanged" ?>

[//]: # <?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/FlightAggregate.java"
[//]: # fragment="TemperatureChanged" ?>
```java
@React
EitherOf2<FlightRescheduled, Nothing> on(@External TemperatureChanged event) {
Expand Down Expand Up @@ -302,8 +303,9 @@ for the [Boarding process](https://github.com/spine-examples/airport/blob/master
The **Security Checks** API provides data for each passenger independently. The client polls
the data and publishes many intermediate `PassengerBoarded` or `PassengerDeniedBoarding` external
events via [`ThirdPartyContext`](https://spine.io/core-java/reference/server/io/spine/server/integration/ThirdPartyContext.html):
<?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/passengers/PassengerClient.java"
fragment="Fetch passengers" ?>

[//]: # <?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/passengers/PassengerClient.java"
[//]: # fragment="Fetch passengers" ?>
```java
public void start() {
while (active) {
Expand Down Expand Up @@ -332,8 +334,8 @@ The [Process Manager](https://github.com/spine-examples/airport/blob/master/take
accumulates the Events and, once the whole *Flight* is boarded, emits a `BoardingComplete` event,
which is later consumed by the&nbsp;[*Flight* Aggregate](https://github.com/spine-examples/airport/blob/master/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/FlightAggregate.java).

<?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/passengers/BoardingProcman.java"
fragment="BoardingProcman" ?>
[//]: # <?embed-code file="examples/airport/takeoffs-and-landings/src/main/java/io/spine/example/airport/tl/passengers/BoardingProcman.java"
[//]: # fragment="BoardingProcman" ?>
```java
@React
EitherOf2<BoardingComplete, Nothing> on(@External PassengerBoarded event) {
Expand Down
Loading