Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Store-Producer
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
Mahesh Rohra
Store-Producer
Commits
a36e15b3
Commit
a36e15b3
authored
May 08, 2020
by
Mahesh Rohra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After review process modified code
parent
0e22b472
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
16 deletions
+41
-16
build.gradle
build.gradle
+2
-0
StoreProducerApplication.java
src/main/java/com/safeway/epe/StoreProducerApplication.java
+1
-1
ProducerServiceProxy.java
...ain/java/com/safeway/epe/client/ProducerServiceProxy.java
+1
-1
SwaggerConfig.java
src/main/java/com/safeway/epe/config/SwaggerConfig.java
+24
-0
ProducerService.java
src/main/java/com/safeway/epe/service/ProducerService.java
+10
-2
TransactionService.java
...main/java/com/safeway/epe/service/TransactionService.java
+0
-3
TransactionServiceImpl.java
.../java/com/safeway/epe/service/TransactionServiceImpl.java
+0
-6
StoreScheduler.java
src/main/java/com/safeway/epe/util/StoreScheduler.java
+2
-2
ProducerServiceTest.java
...est/java/com/safeway/epe/service/ProducerServiceTest.java
+1
-1
No files found.
build.gradle
View file @
a36e15b3
...
...
@@ -27,6 +27,8 @@ repositories {
}
dependencies
{
compile
group:
'io.springfox'
,
name:
'springfox-swagger2'
,
version:
'2.7.0'
compile
group:
'io.springfox'
,
name:
'springfox-swagger-ui'
,
version:
'2.7.0'
implementation
'org.springframework.cloud:spring-cloud-starter-openfeign'
implementation
'org.springframework.boot:spring-boot-starter-data-jpa'
implementation
'org.springframework.boot:spring-boot-starter-web'
...
...
src/main/java/com/safeway/epe/StoreProducerApplication.java
View file @
a36e15b3
...
...
@@ -7,7 +7,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@EnableFeignClients
(
"com.safeway.epe.
*
"
)
@EnableFeignClients
(
"com.safeway.epe.
client
"
)
public
class
StoreProducerApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/safeway/epe/c
onfig
/ProducerServiceProxy.java
→
src/main/java/com/safeway/epe/c
lient
/ProducerServiceProxy.java
View file @
a36e15b3
package
com
.
safeway
.
epe
.
c
onfig
;
package
com
.
safeway
.
epe
.
c
lient
;
import
com.safeway.epe.domain.ConsumerPayload
;
...
...
src/main/java/com/safeway/epe/config/SwaggerConfig.java
0 → 100644
View file @
a36e15b3
package
com
.
safeway
.
epe
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@EnableSwagger2
public
class
SwaggerConfig
{
@Bean
public
Docket
api
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.safeway.epe.controller"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
}
}
src/main/java/com/safeway/epe/service/ProducerService.java
View file @
a36e15b3
package
com
.
safeway
.
epe
.
service
;
import
com.safeway.epe.c
onfig
.ProducerServiceProxy
;
import
com.safeway.epe.c
lient
.ProducerServiceProxy
;
import
com.safeway.epe.domain.ConsumerPayload
;
import
com.safeway.epe.domain.Offsets
;
import
com.safeway.epe.domain.TransactionPayload
;
...
...
@@ -9,6 +9,7 @@ import com.safeway.epe.repository.TransactionRepository;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
...
...
@@ -50,10 +51,17 @@ public class ProducerService
else
{
transactionRepository
.
updateProcessedFlagByTransactionId
(
false
,
transactionRecorder
.
getUuid
());
transactionService
.
errorResponse
(
transactionRecorder
,
"failed to insert data to topic"
,
false
);
errorResponse
(
transactionRecorder
,
"failed to insert data to topic"
,
false
);
logger
.
info
(
"failed to insert data to topic"
);
return
new
ArrayList
<>();
}
}
private
ResponseEntity
<
String
>
errorResponse
(
TransactionRecorder
transactionRecorder
,
String
exceptionMessage
,
boolean
isReprocesed
)
{
if
(!
isReprocesed
){
logger
.
error
(
"Error response : "
+
exceptionMessage
);
}
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Error"
);
}
}
src/main/java/com/safeway/epe/service/TransactionService.java
View file @
a36e15b3
package
com
.
safeway
.
epe
.
service
;
import
com.safeway.epe.domain.Offsets
;
import
com.safeway.epe.domain.TransactionRecorder
;
import
org.springframework.http.ResponseEntity
;
import
java.util.List
;
public
interface
TransactionService
{
ResponseEntity
<
List
<
Offsets
>>
produceMessage
(
String
uuid
);
ResponseEntity
<
List
<
Offsets
>>
sendData
(
TransactionRecorder
transactionRecorder
,
boolean
isReprocesed
);
ResponseEntity
<
String
>
errorResponse
(
TransactionRecorder
transactionRecorder
,
String
exceptionMessage
,
boolean
isReprocesed
);
}
src/main/java/com/safeway/epe/service/TransactionServiceImpl.java
View file @
a36e15b3
...
...
@@ -53,10 +53,4 @@ public class TransactionServiceImpl implements TransactionService
return
ResponseEntity
.
ok
(
offsetsList
);
}
public
ResponseEntity
<
String
>
errorResponse
(
TransactionRecorder
transactionRecorder
,
String
exceptionMessage
,
boolean
isReprocesed
)
{
if
(!
isReprocesed
){
logger
.
error
(
"Error response : "
+
exceptionMessage
);
}
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Error"
);
}
}
src/main/java/com/safeway/epe/util/StoreScheduler.java
View file @
a36e15b3
...
...
@@ -2,7 +2,7 @@ package com.safeway.epe.util;
import
com.safeway.epe.domain.TransactionRecorder
;
import
com.safeway.epe.repository.TransactionRepository
;
import
com.safeway.epe.service.TransactionService
;
import
com.safeway.epe.service.TransactionService
Impl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
...
@@ -16,7 +16,7 @@ public class StoreScheduler
TransactionRepository
transactionRepository
;
@Autowired
private
TransactionService
transactionService
;
private
TransactionService
Impl
transactionService
;
@Scheduled
(
fixedRateString
=
"${offertransaction.reprocess.timedelay}"
,
initialDelay
=
77777
)
public
void
processTransactionData
(){
...
...
src/test/java/com/safeway/epe/service/ProducerServiceTest.java
View file @
a36e15b3
package
com
.
safeway
.
epe
.
service
;
import
com.safeway.epe.c
onfig
.ProducerServiceProxy
;
import
com.safeway.epe.c
lient
.ProducerServiceProxy
;
import
com.safeway.epe.domain.ConsumerPayload
;
import
com.safeway.epe.domain.Offsets
;
import
com.safeway.epe.domain.TransactionPayload
;
...
...
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