@@ -10,3 +10,79 @@ Start the toll-intake
10
10
11
11
<img width =" 1366 " alt =" Screenshot 2022年06月07日 at 11 50 10 PM " src =" https://user-images.githubusercontent.com/54174687/172454675-fb4e1cd3-268d-4a4f-95e2-19fbee0480d6.png " >
12
12
13
+ fastpass-ui application.properties
14
+
15
+ ``` sh
16
+ server.port=8080
17
+ spring.application.name=fastpass-ui
18
+ # eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
19
+ # eureka.client.register-with-eureka=true
20
+ # eureka.client.fetch-registry=true
21
+ # eureka.instance.hostname=localhost
22
+
23
+ spring.cloud.stream.bindings.generatetollcharge-out-0.destination=tolltopic
24
+ spring.cloud.stream.bindings.generatetollcharge-out-0.content-type=application/json
25
+
26
+
27
+ spring.cloud.stream.bindings.generatethreecharges-out-0.destination=tolltopic
28
+ spring.cloud.stream.bindings.generatethreecharges-out-0.content-type=application/json
29
+
30
+ spring.rabbitmq.host=127.0.0.1
31
+ spring.rabbitmq.port=5672
32
+ spring.rabbitmq.username=guest
33
+ spring.rabbitmq.password=guest
34
+ ```
35
+
36
+ FastpassUiApplication.java
37
+
38
+ ``` sh
39
+ package com.example;
40
+
41
+ import java.util.ArrayList;
42
+ import java.util.function.Supplier;
43
+
44
+ import org.springframework.boot.SpringApplication;
45
+ import org.springframework.boot.autoconfigure.SpringBootApplication;
46
+ import org.springframework.context.annotation.Bean;
47
+ import org.springframework.integration.support.MessageBuilder;
48
+ import org.springframework.messaging.Message;
49
+
50
+ import reactor.core.publisher.Flux;
51
+
52
+
53
+ @SpringBootApplication
54
+ public class FastpassUiApplication {
55
+
56
+ public static void main(String[] args) {
57
+ SpringApplication.run(FastpassUiApplication.class, args);
58
+ }
59
+
60
+ // This bean will send the messages for every sec
61
+ //@Bean
62
+ public Supplier< FastPassToll> generateTollCharge () {
63
+ return () -> new FastPassToll(" 800" , " 1001" , 1.05f);
64
+ }
65
+
66
+ @Bean
67
+ public Supplier< Flux< Message< FastPassToll>>> generateThreeCharges () {
68
+
69
+ ArrayList< Message< FastPassToll>> tolls = new ArrayList<Message<FastPassToll>> ();
70
+ tolls.add(MessageBuilder
71
+ .withPayload(new FastPassToll(" 800" , " 1001" , 1.05f))
72
+ .setHeader(" speed" , " slow" )
73
+ .build ());
74
+
75
+ tolls.add(MessageBuilder
76
+ .withPayload(new FastPassToll(" 801" , " 1001" , 1.05f))
77
+ .setHeader(" speed" , " fast" )
78
+ .build ());
79
+
80
+ tolls.add(MessageBuilder
81
+ .withPayload(new FastPassToll(" 802" , " 1001" , 1.05f))
82
+ .setHeader(" speed" , " slow" )
83
+ .build ());
84
+
85
+ return () -> Flux.fromIterable(tolls);
86
+ }
87
+ }
88
+ ` ` `
0 commit comments