Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Employee consumer App
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
Ramakrushna Sahoo
Employee consumer App
Commits
305ddbc1
Commit
305ddbc1
authored
Oct 17, 2024
by
Ramakrushna Sahoo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update file with some changes
parent
729b415f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
13 deletions
+15
-13
.gitattributes.txt
.gitattributes.txt
+3
-0
vcs.xml
.idea/vcs.xml
+0
-1
employee.csv
employee.csv
+2
-0
EmployeeConsumerApplication.java
src/main/java/rks/EmployeeConsumerApplication.java
+2
-0
EmployeeConsumer.java
src/main/java/rks/consumer/EmployeeConsumer.java
+7
-9
employee.csv
src/main/resources/employee.csv
+0
-0
application.properties
target/classes/application.properties
+1
-3
EmployeeConsumerApplication.class
target/classes/rks/EmployeeConsumerApplication.class
+0
-0
EmployeeConsumer.class
target/classes/rks/consumer/EmployeeConsumer.class
+0
-0
No files found.
.gitattributes.txt
View file @
305ddbc1
* text=auto
*.java text eol=lf
*.properties text eol=lf
*.csv text eol=lf
.idea/vcs.xml
View file @
305ddbc1
...
...
@@ -2,6 +2,5 @@
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$/employee-consumer-app"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
employee.csv
0 → 100644
View file @
305ddbc1
[{"id":1,"email":"sam@gmail.com","deptId":112
[{"id":7,"email":"olivia@example.com","deptId":114,"ename":"olivia"},{"id":8,"email":"noah@example.com","deptId":114,"ename":"noah"},{"id":9,"email":"ava@example.com","deptId":114,"ename":"ava"},{"id":10,"email":"ethan@example.com","deptId":114,"ename":"ethan"},{"id":11,"email":"ram@gmail.com","deptId":114,"ename":"Ram"}]
src/main/java/rks/EmployeeConsumerApplication.java
View file @
305ddbc1
...
...
@@ -2,8 +2,10 @@ package rks;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.kafka.annotation.EnableKafka
;
@SpringBootApplication
@EnableKafka
public
class
EmployeeConsumerApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/rks/consumer/EmployeeConsumer.java
View file @
305ddbc1
...
...
@@ -32,19 +32,17 @@ public class EmployeeConsumer implements CommandLineRunner {
// Here you can parse the message to create an Employee object
// Assuming message is a CSV string, you can split it or use a library like Jackson to convert it
log
.
info
(
"Employee data read from kafka : {}"
,
message
);
// String[] parts = message.split(",");
// Employee employee = new Employee(parts[0], parts[1], parts[2]);
// log.info("Employee data read from kafka : {}", employee);
//
// // Write to CSV
// writeEmployeeToCSV(employee);
// Write to CSV
writeEmployeeToCSV
(
message
.
value
());
}
private
void
writeEmployeeToCSV
(
Employee
employe
e
)
{
private
void
writeEmployeeToCSV
(
String
messag
e
)
{
try
(
BufferedWriter
writer
=
new
BufferedWriter
(
new
FileWriter
(
outputFile
,
true
)))
{
writer
.
write
(
employee
.
toString
()
);
writer
.
write
(
message
);
writer
.
newLine
();
log
.
info
(
"data written in csv file
"
);
log
.
info
(
"data written in csv file
: {}"
,
message
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
src/main/resources/employee.csv
deleted
100644 → 0
View file @
729b415f
target/classes/application.properties
View file @
305ddbc1
...
...
@@ -6,9 +6,7 @@ spring.r2dbc.url=r2dbc:mysql://root:root@localhost:3306/database1
spring.r2dbc.username
=
root
spring.r2dbc.password
=
root
# Optional: R2DBC pool configuration (if you want to enable connection pooling)
spring.r2dbc.pool.initial-size
=
5
spring.r2dbc.pool.max-size
=
20
# Enable R2DBC logging (optional)
logging.level.io.r2dbc.spi
=
DEBUG
...
...
target/classes/rks/EmployeeConsumerApplication.class
View file @
305ddbc1
No preview for this file type
target/classes/rks/consumer/EmployeeConsumer.class
View file @
305ddbc1
No preview for this file type
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