Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
orders-monitoring-dashboard
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
Ramakanth Dhane
orders-monitoring-dashboard
Commits
5e5d25aa
Commit
5e5d25aa
authored
Apr 30, 2020
by
Ramakanth Dhane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OMD-04 - Generate random orders-Bug Fixes
parent
fb36840a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
77 deletions
+86
-77
pom.xml
omd-checkout-service/pom.xml
+81
-72
OrderGenerator.java
...t-service/src/main/java/com/nisum/omd/OrderGenerator.java
+5
-5
No files found.
omd-checkout-service/pom.xml
View file @
5e5d25aa
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.2.6.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>
com.nisum.omd
</groupId>
<artifactId>
omd-checkout-service
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
omd-checkout-service
</name>
<description>
Demo project for Spring Boot
</description>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.2.6.RELEASE
</version>
<relativePath
/>
<!-- lookup parent from repository -->
</parent>
<groupId>
com.nisum.omd
</groupId>
<artifactId>
omd-checkout-service
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
omd-checkout-service
</name>
<description>
Demo project for Spring Boot
</description>
<properties>
<java.version>
1.8
</java.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
</properties>
<properties>
<java.version>
1.8
</java.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
</properties>
<dependencies>
<dependency>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.kafka
</groupId>
<artifactId>
spring-kafka
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.kafka
</groupId>
<artifactId>
spring-kafka
</artifactId>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-simple
</artifactId>
<version>
1.7.30
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<scope>
runtime
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
com.github.javafaker
</groupId>
<artifactId>
javafaker
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<artifactId>
spring-boot-starter
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.
junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
<groupId>
org.
springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-log4j2
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<scope>
runtime
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
com.github.javafaker
</groupId>
<artifactId>
javafaker
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<exclusions>
<exclusion>
<groupId>
org.junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
omd-checkout-service/src/main/java/com/nisum/omd/OrderGenerator.java
View file @
5e5d25aa
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ThreadLocalRandom
;
import
javax.annotation.PostConstruct
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -20,11 +18,12 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import
com.nisum.omd.domain.Order
;
import
com.nisum.omd.service.OmdProducerService
;
import
com.nisum.omd.service.RandomDataGenerator
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
@Component
@RestController
public
class
OrderGenerator
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
OrderGenerator
.
class
);
@Autowired
private
RandomDataGenerator
randomDataGenerator
;
@Autowired
...
...
@@ -48,11 +47,12 @@ public class OrderGenerator {
while
(
true
)
{
if
(
orderGenerateFlag
)
{
order
=
getObjectData
(
order
);
omdProducerService
.
sendMessage
(
order
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
objectMapper
.
registerModule
(
new
JavaTimeModule
());
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
String
jsonOrderStr
=
objectMapper
.
writeValueAsString
(
order
);
System
.
out
.
println
(
jsonOrderStr
);
logger
.
info
(
jsonOrderStr
);
Thread
.
sleep
((
long
)(
getRandomInterval
(
intervalList
)
*
1000
));
}
}
...
...
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