Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
M
MicroServices
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohammad.salama
MicroServices
Commits
58768210
Commit
58768210
authored
Apr 28, 2024
by
mohammad.salama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replication Returned for UserService
parent
c2587404
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
200 additions
and
0 deletions
+200
-0
compiler.xml
MicroServices/.idea/compiler.xml
+2
-0
encodings.xml
MicroServices/.idea/encodings.xml
+2
-0
UserService.class
.../UserService/target/classes/org/example/UserService.class
+0
-0
pom.xml
MicroServices/UserServiceReplica/pom.xml
+105
-0
UserService.java
...ServiceReplica/src/main/java/org/example/UserService.java
+55
-0
UserServiceApp.java
...viceReplica/src/main/java/org/example/UserServiceApp.java
+27
-0
application.properties
...rServiceReplica/src/main/resources/application.properties
+4
-0
application.properties
.../UserServiceReplica/target/classes/application.properties
+4
-0
UserService.class
...rviceReplica/target/classes/org/example/UserService.class
+0
-0
UserServiceApp.class
...ceReplica/target/classes/org/example/UserServiceApp.class
+0
-0
pom.xml
MicroServices/pom.xml
+1
-0
No files found.
MicroServices/.idea/compiler.xml
View file @
58768210
...
...
@@ -9,6 +9,7 @@
<module
name=
"WeatherService"
/>
<module
name=
"DiscAndReg"
/>
<module
name=
"UserService"
/>
<module
name=
"UserServiceReplica"
/>
<module
name=
"DataBase"
/>
<module
name=
"CloudGateway"
/>
</profile>
...
...
@@ -24,6 +25,7 @@
<module
name=
"DataBase"
options=
"-parameters"
/>
<module
name=
"DiscAndReg"
options=
"-parameters"
/>
<module
name=
"UserService"
options=
"-parameters"
/>
<module
name=
"UserServiceReplica"
options=
"-parameters"
/>
<module
name=
"WeatherService"
options=
"-parameters"
/>
</option>
</component>
...
...
MicroServices/.idea/encodings.xml
View file @
58768210
...
...
@@ -11,6 +11,8 @@
<file
url=
"file://$PROJECT_DIR$/ServiceDiscoveryAndRegistry/src/main/resources"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/UserService/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/UserService/src/main/resources"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/UserServiceReplica/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/UserServiceReplica/src/main/resources"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/WeatherService/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/WeatherService/src/main/resources"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/src/main/java"
charset=
"UTF-8"
/>
...
...
MicroServices/UserService/target/classes/org/example/UserService.class
View file @
58768210
No preview for this file type
MicroServices/UserServiceReplica/pom.xml
0 → 100644
View file @
58768210
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
3.0.1
</version>
<relativePath/>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.example
</groupId>
<artifactId>
UserServiceReplica
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
UserServiceReplica
</name>
<properties>
<maven.compiler.source>
17
</maven.compiler.source>
<maven.compiler.target>
17
</maven.compiler.target>
<java.version>
17
</java.version>
<spring-cloud.version>
2022.0.0
</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.example
</groupId>
<artifactId>
DataBase
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
org.example
</groupId>
<artifactId>
WeatherService
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
${spring-cloud.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
2.0.9
</version>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-classic
</artifactId>
<version>
1.4.11
</version>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-core
</artifactId>
<version>
1.4.11
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.9
</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>
netflix-candidates
</id>
<name>
Netflix Candidates
</name>
<url>
https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates
</url>
<snapshots>
<enabled>
false
</enabled>
</snapshots>
</repository>
</repositories>
</project>
\ No newline at end of file
MicroServices/UserServiceReplica/src/main/java/org/example/UserService.java
0 → 100644
View file @
58768210
package
org
.
example
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/users"
)
public
class
UserService
{
@Autowired
RestTemplate
restTemplate
;
String
UserDBURL
=
"http://database-service/users-db/"
;
String
FlightDBURL
=
"http://database-service/flights-db/"
;
String
WeatherURL
=
"http://weather-service/weather/"
;
@RequestMapping
(
"/{userID}"
)
public
List
<
Flight
>
getFlights
(
@PathVariable
(
"userID"
)
String
userID
)
{
User
user
=
restTemplate
.
getForObject
(
UserDBURL
+
userID
,
User
.
class
);
if
(
user
==
null
)
return
new
ArrayList
<>();
System
.
out
.
println
(
"Welcome : "
+
user
.
getName
());
List
<
Flight
>
ans
=
new
ArrayList
<>();
/// System.out.println("Ans size is " + user.getFlights().size());
for
(
String
flightID
:
user
.
getFlights
())
{
Flight
flight
=
restTemplate
.
getForObject
(
FlightDBURL
+
flightID
,
Flight
.
class
);
ans
.
add
(
flight
);
}
System
.
out
.
println
(
ans
);
return
ans
;
}
@RequestMapping
(
"/weather/{flightID}"
)
public
Weather
getWeather
(
@PathVariable
(
"flightID"
)
String
flightID
)
{
Flight
flight
=
restTemplate
.
getForObject
(
FlightDBURL
+
flightID
,
Flight
.
class
);
if
(
flight
.
getDestination
().
isEmpty
()
)
return
new
Weather
();
String
city
=
flight
.
getDestination
();
Weather
weather
=
restTemplate
.
getForObject
(
WeatherURL
+
city
,
Weather
.
class
);
System
.
out
.
println
(
weather
);
return
weather
;
}
}
MicroServices/UserServiceReplica/src/main/java/org/example/UserServiceApp.java
0 → 100644
View file @
58768210
package
org
.
example
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.client.loadbalancer.LoadBalanced
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.web.client.RestTemplate
;
@SpringBootApplication
@EnableDiscoveryClient
public
class
UserServiceApp
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
UserServiceApp
.
class
,
args
);
}
@Bean
@LoadBalanced
public
RestTemplate
getRestTemplate
()
{
return
new
RestTemplate
();
}
}
\ No newline at end of file
MicroServices/UserServiceReplica/src/main/resources/application.properties
0 → 100644
View file @
58768210
server.port
=
8085
spring.main.allow-bean-definition-overriding
=
true
spring.application.name
=
user-service
eureka.client.serviceUrl.defaultZone
=
${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
MicroServices/UserServiceReplica/target/classes/application.properties
0 → 100644
View file @
58768210
server.port
=
8085
spring.main.allow-bean-definition-overriding
=
true
spring.application.name
=
user-service
eureka.client.serviceUrl.defaultZone
=
${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
MicroServices/UserServiceReplica/target/classes/org/example/UserService.class
0 → 100644
View file @
58768210
File added
MicroServices/UserServiceReplica/target/classes/org/example/UserServiceApp.class
0 → 100644
View file @
58768210
File added
MicroServices/pom.xml
View file @
58768210
...
...
@@ -13,6 +13,7 @@
<module>
DataBase
</module>
<module>
DiscAndReg
</module>
<module>
CloudGateway
</module>
<module>
UserServiceReplica
</module>
</modules>
<properties>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment