Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
order-management-backend
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
1
Merge Requests
1
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
Ascend
order-management-backend
Commits
2632c247
Commit
2632c247
authored
May 07, 2021
by
dbhuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AFP-37]
✨
adding functionality for inventory quantity update producer [
@dbhuller
]
parent
4bf9070a
Pipeline
#1671
failed with stage
in 38 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
KafkaController.java
...a/com/afp/ordermanagement/controller/KafkaController.java
+5
-0
Consumer.java
...c/main/java/com/afp/ordermanagement/service/Consumer.java
+5
-0
Producer.java
...c/main/java/com/afp/ordermanagement/service/Producer.java
+6
-0
No files found.
backend/order-management/src/main/java/com/afp/ordermanagement/controller/KafkaController.java
View file @
2632c247
...
...
@@ -18,4 +18,9 @@ public class KafkaController {
public
void
sendMessageToKafkaTopic
(
@RequestParam
String
id
)
{
producer
.
sendOrderId
(
id
);
}
@PostMapping
(
value
=
"/inventory/{quantity}"
)
public
void
sendInventoryQuantity
(
@PathVariable
String
quantity
)
{
producer
.
sendInventoryQuantity
(
quantity
);
}
}
backend/order-management/src/main/java/com/afp/ordermanagement/service/Consumer.java
View file @
2632c247
...
...
@@ -20,4 +20,9 @@ public class Consumer {
public
void
getOrderStatusFromWarehouse
(
String
status
)
{
logger
.
info
(
String
.
format
(
"#### -> Consumed order Status: %s"
,
status
));
}
@KafkaListener
(
topics
=
"inventory"
)
public
void
getInventoryQuantityUpdate
(
String
quantity
)
{
logger
.
info
(
String
.
format
(
"#### -> Consume inventory quantity update: %s"
,
quantity
));
}
}
backend/order-management/src/main/java/com/afp/ordermanagement/service/Producer.java
View file @
2632c247
...
...
@@ -18,6 +18,7 @@ public class Producer {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Producer
.
class
);
private
static
final
String
MANAGER_TOPIC
=
"managers"
;
private
static
final
String
ORDER_TOPIC
=
"orders"
;
private
static
final
String
INVENTORY_TOPIC
=
"inventory"
;
private
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
...
...
@@ -45,4 +46,9 @@ public class Producer {
}
public
void
sendInventoryQuantity
(
String
quantity
)
{
logger
.
info
(
String
.
format
(
"#### -> Sending inventory quantity update: %s"
,
quantity
));
kafkaTemplate
.
send
(
INVENTORY_TOPIC
,
quantity
);
}
}
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