Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
K
Kafka-Banking
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
Kafka-Banking
Commits
74ec3501
Commit
74ec3501
authored
Mar 22, 2024
by
mohammad.salama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All Consumers + Producer + DB-Redis
parent
07a2d4f7
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
1214 additions
and
2 deletions
+1214
-2
Consumer_jar.xml
Consumer-Account-Manager/.idea/artifacts/Consumer_jar.xml
+16
-0
compiler.xml
Consumer-Account-Manager/.idea/compiler.xml
+15
-0
encodings.xml
Consumer-Account-Manager/.idea/encodings.xml
+7
-0
jarRepositories.xml
Consumer-Account-Manager/.idea/jarRepositories.xml
+20
-0
misc.xml
Consumer-Account-Manager/.idea/misc.xml
+14
-0
uiDesigner.xml
Consumer-Account-Manager/.idea/uiDesigner.xml
+124
-0
vcs.xml
Consumer-Account-Manager/.idea/vcs.xml
+7
-0
workspace.xml
Consumer-Account-Manager/.idea/workspace.xml
+84
-0
Reporting-Log
Consumer-Account-Manager/Logs/Reporting-Log
+0
-0
pom.xml
Consumer-Account-Manager/pom.xml
+45
-0
AccountManagerKafkaConsumer.java
...rc/main/java/org/example/AccountManagerKafkaConsumer.java
+89
-0
DataBaseHandler.java
...nt-Manager/src/main/java/org/example/DataBaseHandler.java
+24
-0
TransactionInfo.java
...nt-Manager/src/main/java/org/example/TransactionInfo.java
+43
-0
WritingHelper.java
...ount-Manager/src/main/java/org/example/WritingHelper.java
+31
-0
MANIFEST.MF
...r-Account-Manager/src/main/resources/META-INF/MANIFEST.MF
+3
-0
logback.xml
Consumer-Account-Manager/src/main/resources/logback.xml
+29
-0
MANIFEST.MF
Consumer-Account-Manager/target/classes/META-INF/MANIFEST.MF
+3
-0
logback.xml
Consumer-Account-Manager/target/classes/logback.xml
+29
-0
ReportingKafkaConsumer.class
...r/target/classes/org/example/ReportingKafkaConsumer.class
+0
-0
TransactionInfo.class
...-Manager/target/classes/org/example/TransactionInfo.class
+0
-0
WritingHelper.class
...nt-Manager/target/classes/org/example/WritingHelper.class
+0
-0
Consumer.jar
Consumer-Reporting/out/artifacts/Consumer_jar/Consumer.jar
+0
-0
Consumer_jar.xml
Consumer-User-Notification/.idea/artifacts/Consumer_jar.xml
+16
-0
compiler.xml
Consumer-User-Notification/.idea/compiler.xml
+16
-0
encodings.xml
Consumer-User-Notification/.idea/encodings.xml
+7
-0
jarRepositories.xml
Consumer-User-Notification/.idea/jarRepositories.xml
+20
-0
misc.xml
Consumer-User-Notification/.idea/misc.xml
+14
-0
uiDesigner.xml
Consumer-User-Notification/.idea/uiDesigner.xml
+124
-0
vcs.xml
Consumer-User-Notification/.idea/vcs.xml
+7
-0
workspace.xml
Consumer-User-Notification/.idea/workspace.xml
+83
-0
Reporting-Log
Consumer-User-Notification/Logs/Reporting-Log
+0
-0
pom.xml
Consumer-User-Notification/pom.xml
+45
-0
DataBaseHandler.java
...tification/src/main/java/org/example/DataBaseHandler.java
+22
-0
TransactionInfo.java
...tification/src/main/java/org/example/TransactionInfo.java
+43
-0
UserNotificationKafkaConsumer.java
.../main/java/org/example/UserNotificationKafkaConsumer.java
+85
-0
WritingHelper.java
...Notification/src/main/java/org/example/WritingHelper.java
+31
-0
MANIFEST.MF
...User-Notification/src/main/resources/META-INF/MANIFEST.MF
+3
-0
logback.xml
Consumer-User-Notification/src/main/resources/logback.xml
+29
-0
MANIFEST.MF
...mer-User-Notification/target/classes/META-INF/MANIFEST.MF
+3
-0
logback.xml
Consumer-User-Notification/target/classes/logback.xml
+29
-0
ReportingKafkaConsumer.class
...n/target/classes/org/example/ReportingKafkaConsumer.class
+0
-0
TransactionInfo.class
...fication/target/classes/org/example/TransactionInfo.class
+0
-0
WritingHelper.class
...tification/target/classes/org/example/WritingHelper.class
+0
-0
workspace.xml
Producer/.idea/workspace.xml
+4
-2
Producer.jar
Producer/out/artifacts/Producer_jar/Producer.jar
+0
-0
pom.xml
Producer/pom.xml
+5
-0
BankingAPI.java
Producer/src/main/java/org/example/BankingAPI.java
+45
-0
No files found.
Consumer-Account-Manager/.idea/artifacts/Consumer_jar.xml
0 → 100644
View file @
74ec3501
<component
name=
"ArtifactManager"
>
<artifact
type=
"jar"
name=
"Consumer:jar"
>
<output-path>
$PROJECT_DIR$/out/artifacts/Consumer_jar
</output-path>
<root
id=
"archive"
name=
"Consumer.jar"
>
<element
id=
"module-output"
name=
"Consumer"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.12.1/jackson-databind-2.12.1.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/github/luben/zstd-jni/1.5.5-6/zstd-jni-1.5.5-6.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.12.1/jackson-core-2.12.1.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/lz4/lz4-java/1.8.0/lz4-java-1.8.0.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.12.1/jackson-annotations-2.12.1.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/apache/kafka/kafka-clients/3.7.0/kafka-clients-3.7.0.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/xerial/snappy/snappy-java/1.1.10.5/snappy-java-1.1.10.5.jar"
path-in-jar=
"/"
/>
</root>
</artifact>
</component>
\ No newline at end of file
Consumer-Account-Manager/.idea/compiler.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<annotationProcessing>
<profile
name=
"Maven default annotation processors profile"
enabled=
"true"
>
<sourceOutputDir
name=
"target/generated-sources/annotations"
/>
<sourceTestOutputDir
name=
"target/generated-test-sources/test-annotations"
/>
<outputRelativeToContentRoot
value=
"true"
/>
<module
name=
"Consumer"
/>
<module
name=
"Consumer-Account-Manager"
/>
<module
name=
"Consumer-ِAccount-Manager"
/>
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
Consumer-Account-Manager/.idea/encodings.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Encoding"
>
<file
url=
"file://$PROJECT_DIR$/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/src/main/resources"
charset=
"UTF-8"
/>
</component>
</project>
\ No newline at end of file
Consumer-Account-Manager/.idea/jarRepositories.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RemoteRepositoriesConfiguration"
>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Central Repository"
/>
<option
name=
"url"
value=
"https://repo.maven.apache.org/maven2"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Maven Central repository"
/>
<option
name=
"url"
value=
"https://repo1.maven.org/maven2"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"jboss.community"
/>
<option
name=
"name"
value=
"JBoss Community repository"
/>
<option
name=
"url"
value=
"https://repository.jboss.org/nexus/content/repositories/public/"
/>
</remote-repository>
</component>
</project>
\ No newline at end of file
Consumer-Account-Manager/.idea/misc.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ExternalStorageConfigurationManager"
enabled=
"true"
/>
<component
name=
"MavenProjectsManager"
>
<option
name=
"originalFiles"
>
<list>
<option
value=
"$PROJECT_DIR$/pom.xml"
/>
</list>
</option>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_17"
default=
"true"
project-jdk-name=
"17 (2)"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/out"
/>
</component>
</project>
\ No newline at end of file
Consumer-Account-Manager/.idea/uiDesigner.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Palette2"
>
<group
name=
"Swing"
>
<item
class=
"com.intellij.uiDesigner.HSpacer"
tooltip-text=
"Horizontal Spacer"
icon=
"/com/intellij/uiDesigner/icons/hspacer.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"1"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"com.intellij.uiDesigner.VSpacer"
tooltip-text=
"Vertical Spacer"
icon=
"/com/intellij/uiDesigner/icons/vspacer.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"1"
anchor=
"0"
fill=
"2"
/>
</item>
<item
class=
"javax.swing.JPanel"
icon=
"/com/intellij/uiDesigner/icons/panel.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JScrollPane"
icon=
"/com/intellij/uiDesigner/icons/scrollPane.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"7"
hsize-policy=
"7"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JButton"
icon=
"/com/intellij/uiDesigner/icons/button.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"0"
fill=
"1"
/>
<initial-values>
<property
name=
"text"
value=
"Button"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JRadioButton"
icon=
"/com/intellij/uiDesigner/icons/radioButton.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"RadioButton"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JCheckBox"
icon=
"/com/intellij/uiDesigner/icons/checkBox.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"CheckBox"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JLabel"
icon=
"/com/intellij/uiDesigner/icons/label.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"Label"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JTextField"
icon=
"/com/intellij/uiDesigner/icons/textField.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JPasswordField"
icon=
"/com/intellij/uiDesigner/icons/passwordField.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JFormattedTextField"
icon=
"/com/intellij/uiDesigner/icons/formattedTextField.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextArea"
icon=
"/com/intellij/uiDesigner/icons/textArea.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextPane"
icon=
"/com/intellij/uiDesigner/icons/textPane.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JEditorPane"
icon=
"/com/intellij/uiDesigner/icons/editorPane.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JComboBox"
icon=
"/com/intellij/uiDesigner/icons/comboBox.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"2"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JTable"
icon=
"/com/intellij/uiDesigner/icons/table.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JList"
icon=
"/com/intellij/uiDesigner/icons/list.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"2"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTree"
icon=
"/com/intellij/uiDesigner/icons/tree.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTabbedPane"
icon=
"/com/intellij/uiDesigner/icons/tabbedPane.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSplitPane"
icon=
"/com/intellij/uiDesigner/icons/splitPane.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSpinner"
icon=
"/com/intellij/uiDesigner/icons/spinner.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSlider"
icon=
"/com/intellij/uiDesigner/icons/slider.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSeparator"
icon=
"/com/intellij/uiDesigner/icons/separator.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JProgressBar"
icon=
"/com/intellij/uiDesigner/icons/progressbar.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JToolBar"
icon=
"/com/intellij/uiDesigner/icons/toolbar.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
>
<preferred-size
width=
"-1"
height=
"20"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JToolBar$Separator"
icon=
"/com/intellij/uiDesigner/icons/toolbarSeparator.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JScrollBar"
icon=
"/com/intellij/uiDesigner/icons/scrollbar.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"0"
anchor=
"0"
fill=
"2"
/>
</item>
</group>
</component>
</project>
\ No newline at end of file
Consumer-Account-Manager/.idea/vcs.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/.."
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
Consumer-Account-Manager/.idea/workspace.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ArtifactsWorkspaceSettings"
>
<artifacts-to-build>
<artifact
name=
"Consumer:jar"
/>
</artifacts-to-build>
</component>
<component
name=
"AutoImportSettings"
>
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"68795978-b1a2-4702-95fa-e8e7afae617a"
name=
"Changes"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/../Consumer-User-Notification/src/main/java/org/example/UserNotificationKafkaConsumer.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../Consumer-Reporting/out/artifacts/Consumer_jar/Consumer.jar"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../Producer/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../Producer/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../Producer/out/artifacts/Producer_jar/Producer.jar"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../Producer/pom.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../Producer/pom.xml"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
</component>
<component
name=
"FileTemplateManagerImpl"
>
<option
name=
"RECENT_TEMPLATES"
>
<list>
<option
value=
"Class"
/>
</list>
</option>
</component>
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$/.."
/>
</component>
<component
name=
"MarkdownSettingsMigration"
>
<option
name=
"stateVersion"
value=
"1"
/>
</component>
<component
name=
"ProjectId"
id=
"2e2xOWSyAwlrJgJsmMdML8arM85"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
<component
name=
"ProjectViewState"
>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
<component
name=
"PropertiesComponent"
>
{
"
keyToString
"
: {
"
RunOnceActivity.OpenProjectViewOnStart
"
:
"
true
"
,
"
RunOnceActivity.ShowReadmeOnStart
"
:
"
true
"
,
"
SHARE_PROJECT_CONFIGURATION_FILES
"
:
"
true
"
,
"
last_opened_file_path
"
:
"
D:/HIAST/FIY/SS/Advanced Distributed Systems/Lab/4/java-kafka-consumer/Consumer/src/main/resources
"
,
"
project.structure.last.edited
"
:
"
Modules
"
,
"
project.structure.proportion
"
:
"
0.0
"
,
"
project.structure.side.proportion
"
:
"
0.2
"
}
}
</component>
<component
name=
"RecentsManager"
>
<key
name=
"CopyFile.RECENT_KEYS"
>
<recent
name=
"D:\HIAST\FIY\SS\Advanced Distributed Systems\Lab\4\java-kafka-consumer\Consumer\src\main\resources"
/>
</key>
<key
name=
"CopyClassDialog.RECENTS_KEY"
>
<recent
name=
"org.example"
/>
</key>
</component>
<component
name=
"SpellCheckerSettings"
RuntimeDictionaries=
"0"
Folders=
"0"
CustomDictionaries=
"0"
DefaultDictionary=
"application-level"
UseSingleDictionary=
"true"
transferred=
"true"
/>
<component
name=
"TaskManager"
>
<task
active=
"true"
id=
"Default"
summary=
"Default task"
>
<changelist
id=
"68795978-b1a2-4702-95fa-e8e7afae617a"
name=
"Changes"
comment=
""
/>
<created>
1711116444789
</created>
<option
name=
"number"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1711116444789
</updated>
</task>
<servers
/>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
<option
name=
"TAB_STATES"
>
<map>
<entry
key=
"MAIN"
>
<value>
<State
/>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
Consumer-Account-Manager/Logs/Reporting-Log
0 → 100644
View file @
74ec3501
Consumer-Account-Manager/pom.xml
0 → 100644
View file @
74ec3501
<?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"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.example
</groupId>
<artifactId>
Consumer
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<dependencies>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.12.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.kafka
</groupId>
<artifactId>
kafka-clients
</artifactId>
<version>
3.7.0
</version>
</dependency>
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
<version>
3.7.0
</version>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-core
</artifactId>
<version>
1.2.10
</version>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-classic
</artifactId>
<version>
1.2.10
</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>
17
</maven.compiler.source>
<maven.compiler.target>
17
</maven.compiler.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
</project>
\ No newline at end of file
Consumer-Account-Manager/src/main/java/org/example/AccountManagerKafkaConsumer.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.apache.kafka.common.serialization.LongDeserializer
;
import
org.apache.kafka.clients.consumer.*
;
import
org.apache.kafka.common.serialization.StringDeserializer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.time.Duration
;
import
java.util.Collections
;
import
java.util.Properties
;
public
class
AccountManagerKafkaConsumer
{
private
static
final
String
TOPIC
=
"VALID_TOPIC"
;
private
static
final
String
BOOTSTRAP_SERVERS
=
"localhost:9092,localhost:9093,localhost:9094"
;
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
AccountManagerKafkaConsumer
.
class
);
public
static
void
main
(
String
[]
args
)
{
String
consumerGroup
=
"defaultConsumerGroup"
;
if
(
args
.
length
==
1
)
{
consumerGroup
=
args
[
0
];
}
System
.
out
.
println
(
"Consumer is part of consumer group "
+
consumerGroup
);
Consumer
<
Long
,
String
>
kafkaConsumer
=
createKafkaConsumer
(
BOOTSTRAP_SERVERS
,
consumerGroup
);
consumeMessages
(
TOPIC
,
kafkaConsumer
);
}
public
static
void
consumeMessages
(
String
topic
,
Consumer
<
Long
,
String
>
kafkaConsumer
)
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
kafkaConsumer
.
subscribe
(
Collections
.
singletonList
(
topic
));
while
(
true
)
{
ConsumerRecords
<
Long
,
String
>
consumerRecords
=
kafkaConsumer
.
poll
(
Duration
.
ofSeconds
(
1
));
if
(
consumerRecords
.
isEmpty
())
continue
;
for
(
ConsumerRecord
<
Long
,
String
>
record
:
consumerRecords
)
{
String
stringJson
=
record
.
value
();
System
.
out
.
println
(
"key : "
+
record
.
key
());
System
.
out
.
println
(
"Received : "
+
stringJson
);
try
{
TransactionInfo
transactionInfo
=
objectMapper
.
readValue
(
stringJson
,
TransactionInfo
.
class
);
WritingHelper
writingHelper
=
new
WritingHelper
(
transactionInfo
);
writingHelper
.
writeToLog
();
boolean
x
=
DataBaseHandler
.
editAmount
(
transactionInfo
.
getName
()
,
transactionInfo
.
getAmount
());
if
(!
x
)
{
log
.
warn
(
transactionInfo
.
getName
()
+
" : Balance not Enough to Withdraw Amount"
);
}
System
.
out
.
println
(
writingHelper
);
}
catch
(
JsonProcessingException
e
)
{
System
.
out
.
println
(
"Error Parsing"
);
System
.
out
.
println
(
e
.
getMessage
());
log
.
error
(
"Could Not Parse Json in Transaction"
);
}
}
kafkaConsumer
.
commitAsync
();
}
}
public
static
Consumer
<
Long
,
String
>
createKafkaConsumer
(
String
bootstrapServers
,
String
consumerGroup
)
{
Properties
properties
=
new
Properties
();
properties
.
put
(
ConsumerConfig
.
BOOTSTRAP_SERVERS_CONFIG
,
bootstrapServers
);
properties
.
put
(
ConsumerConfig
.
KEY_DESERIALIZER_CLASS_CONFIG
,
LongDeserializer
.
class
.
getName
());
properties
.
put
(
ConsumerConfig
.
VALUE_DESERIALIZER_CLASS_CONFIG
,
StringDeserializer
.
class
.
getName
());
properties
.
put
(
ConsumerConfig
.
GROUP_ID_CONFIG
,
consumerGroup
);
properties
.
put
(
ConsumerConfig
.
ENABLE_AUTO_COMMIT_CONFIG
,
false
);
return
new
KafkaConsumer
<>(
properties
);
}
}
\ No newline at end of file
Consumer-Account-Manager/src/main/java/org/example/DataBaseHandler.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
import
redis.clients.jedis.Jedis
;
public
class
DataBaseHandler
{
private
static
final
String
REDIS_HOST
=
"localhost"
;
private
static
final
int
REDIS_PORT
=
6379
;
private
static
final
String
BALANCE_FIELD
=
"balance"
;
private
static
Jedis
jedis
=
new
Jedis
(
REDIS_HOST
,
REDIS_PORT
);
public
static
boolean
editAmount
(
String
name
,
double
amount
)
{
String
_balance
=
jedis
.
hget
(
name
,
BALANCE_FIELD
);
Double
balance
=
Double
.
parseDouble
(
_balance
);
if
(
amount
>
balance
)
return
false
;
balance
-=
amount
;
jedis
.
hset
(
name
,
BALANCE_FIELD
,
balance
.
toString
());
return
true
;
}
}
Consumer-Account-Manager/src/main/java/org/example/TransactionInfo.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
public
class
TransactionInfo
{
private
String
name
;
private
String
location
;
private
double
amount
;
public
TransactionInfo
()
{}
public
TransactionInfo
(
String
name
,
String
location
,
double
amount
)
{
this
.
amount
=
amount
;
this
.
name
=
name
;
this
.
location
=
location
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getLocation
()
{
return
location
;
}
public
void
setLocation
(
String
location
)
{
this
.
location
=
location
;
}
public
double
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
double
amount
)
{
this
.
amount
=
amount
;
}
}
\ No newline at end of file
Consumer-Account-Manager/src/main/java/org/example/WritingHelper.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
public
class
WritingHelper
{
String
name
;
String
location
;
Double
amount
;
public
WritingHelper
(
TransactionInfo
transactionInfo
)
{
name
=
transactionInfo
.
getName
();
location
=
transactionInfo
.
getLocation
();
amount
=
transactionInfo
.
getAmount
();
}
@Override
public
String
toString
()
{
String
ans
=
""
;
Double
x
=
amount
;
ans
+=
"Name : "
+
name
+
" --- Location of Transaction : "
+
location
+
" --- amount of transaction : "
+
x
.
toString
();
return
ans
;
}
public
void
writeToLog
()
{
String
ans
=
toString
();
AccountManagerKafkaConsumer
.
log
.
info
(
ans
);
}
}
Consumer-Account-Manager/src/main/resources/META-INF/MANIFEST.MF
0 → 100644
View file @
74ec3501
Manifest-Version: 1.0
Main-Class: org.example.AccountManagerKafkaConsumer
Consumer-Account-Manager/src/main/resources/logback.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"HOME_LOG"
value=
"./myLogs/AccountManager-Log"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<Pattern>
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.FileAppender"
>
<file>
${HOME_LOG}
</file>
<append>
true
</append>
<immediateFlush>
true
</immediateFlush>
<encoder>
<pattern>
%d %p %c{1.} [%t] %m%n
</pattern>
</encoder>
</appender>
<logger
name=
"org.example"
level=
"DEBUG"
additivity=
"false"
>
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"FILE"
/>
</logger>
<root
level=
"error"
>
<appender-ref
ref=
"FILE"
/>
</root>
</configuration>
\ No newline at end of file
Consumer-Account-Manager/target/classes/META-INF/MANIFEST.MF
0 → 100644
View file @
74ec3501
Manifest-Version: 1.0
Main-Class: org.example.ReportingKafkaConsumer
Consumer-Account-Manager/target/classes/logback.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"HOME_LOG"
value=
"./myLogs/Reporting-Log"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<Pattern>
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.FileAppender"
>
<file>
${HOME_LOG}
</file>
<append>
true
</append>
<immediateFlush>
true
</immediateFlush>
<encoder>
<pattern>
%d %p %c{1.} [%t] %m%n
</pattern>
</encoder>
</appender>
<logger
name=
"org.example"
level=
"DEBUG"
additivity=
"false"
>
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"FILE"
/>
</logger>
<root
level=
"error"
>
<appender-ref
ref=
"FILE"
/>
</root>
</configuration>
\ No newline at end of file
Consumer-Account-Manager/target/classes/org/example/ReportingKafkaConsumer.class
0 → 100644
View file @
74ec3501
File added
Consumer-Account-Manager/target/classes/org/example/TransactionInfo.class
0 → 100644
View file @
74ec3501
File added
Consumer-Account-Manager/target/classes/org/example/WritingHelper.class
0 → 100644
View file @
74ec3501
File added
Consumer-Reporting/out/artifacts/Consumer_jar/Consumer.jar
deleted
100644 → 0
View file @
07a2d4f7
File deleted
Consumer-User-Notification/.idea/artifacts/Consumer_jar.xml
0 → 100644
View file @
74ec3501
<component
name=
"ArtifactManager"
>
<artifact
type=
"jar"
name=
"Consumer:jar"
>
<output-path>
$PROJECT_DIR$/out/artifacts/Consumer_jar
</output-path>
<root
id=
"archive"
name=
"Consumer.jar"
>
<element
id=
"module-output"
name=
"Consumer"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.12.1/jackson-databind-2.12.1.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/github/luben/zstd-jni/1.5.5-6/zstd-jni-1.5.5-6.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.12.1/jackson-core-2.12.1.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/lz4/lz4-java/1.8.0/lz4-java-1.8.0.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.12.1/jackson-annotations-2.12.1.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/apache/kafka/kafka-clients/3.7.0/kafka-clients-3.7.0.jar"
path-in-jar=
"/"
/>
<element
id=
"extracted-dir"
path=
"$MAVEN_REPOSITORY$/org/xerial/snappy/snappy-java/1.1.10.5/snappy-java-1.1.10.5.jar"
path-in-jar=
"/"
/>
</root>
</artifact>
</component>
\ No newline at end of file
Consumer-User-Notification/.idea/compiler.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<annotationProcessing>
<profile
name=
"Maven default annotation processors profile"
enabled=
"true"
>
<sourceOutputDir
name=
"target/generated-sources/annotations"
/>
<sourceTestOutputDir
name=
"target/generated-test-sources/test-annotations"
/>
<outputRelativeToContentRoot
value=
"true"
/>
<module
name=
"Consumer"
/>
<module
name=
"Consumer-Account-Manager"
/>
<module
name=
"Consumer-User-Notification"
/>
<module
name=
"Consumer-ِAccount-Manager"
/>
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
Consumer-User-Notification/.idea/encodings.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Encoding"
>
<file
url=
"file://$PROJECT_DIR$/src/main/java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/src/main/resources"
charset=
"UTF-8"
/>
</component>
</project>
\ No newline at end of file
Consumer-User-Notification/.idea/jarRepositories.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RemoteRepositoriesConfiguration"
>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Central Repository"
/>
<option
name=
"url"
value=
"https://repo.maven.apache.org/maven2"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Maven Central repository"
/>
<option
name=
"url"
value=
"https://repo1.maven.org/maven2"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"jboss.community"
/>
<option
name=
"name"
value=
"JBoss Community repository"
/>
<option
name=
"url"
value=
"https://repository.jboss.org/nexus/content/repositories/public/"
/>
</remote-repository>
</component>
</project>
\ No newline at end of file
Consumer-User-Notification/.idea/misc.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ExternalStorageConfigurationManager"
enabled=
"true"
/>
<component
name=
"MavenProjectsManager"
>
<option
name=
"originalFiles"
>
<list>
<option
value=
"$PROJECT_DIR$/pom.xml"
/>
</list>
</option>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_17"
default=
"true"
project-jdk-name=
"17 (2)"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/out"
/>
</component>
</project>
\ No newline at end of file
Consumer-User-Notification/.idea/uiDesigner.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Palette2"
>
<group
name=
"Swing"
>
<item
class=
"com.intellij.uiDesigner.HSpacer"
tooltip-text=
"Horizontal Spacer"
icon=
"/com/intellij/uiDesigner/icons/hspacer.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"1"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"com.intellij.uiDesigner.VSpacer"
tooltip-text=
"Vertical Spacer"
icon=
"/com/intellij/uiDesigner/icons/vspacer.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"1"
anchor=
"0"
fill=
"2"
/>
</item>
<item
class=
"javax.swing.JPanel"
icon=
"/com/intellij/uiDesigner/icons/panel.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JScrollPane"
icon=
"/com/intellij/uiDesigner/icons/scrollPane.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"7"
hsize-policy=
"7"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JButton"
icon=
"/com/intellij/uiDesigner/icons/button.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"0"
fill=
"1"
/>
<initial-values>
<property
name=
"text"
value=
"Button"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JRadioButton"
icon=
"/com/intellij/uiDesigner/icons/radioButton.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"RadioButton"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JCheckBox"
icon=
"/com/intellij/uiDesigner/icons/checkBox.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"CheckBox"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JLabel"
icon=
"/com/intellij/uiDesigner/icons/label.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"Label"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JTextField"
icon=
"/com/intellij/uiDesigner/icons/textField.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JPasswordField"
icon=
"/com/intellij/uiDesigner/icons/passwordField.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JFormattedTextField"
icon=
"/com/intellij/uiDesigner/icons/formattedTextField.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextArea"
icon=
"/com/intellij/uiDesigner/icons/textArea.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextPane"
icon=
"/com/intellij/uiDesigner/icons/textPane.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JEditorPane"
icon=
"/com/intellij/uiDesigner/icons/editorPane.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JComboBox"
icon=
"/com/intellij/uiDesigner/icons/comboBox.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"2"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JTable"
icon=
"/com/intellij/uiDesigner/icons/table.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JList"
icon=
"/com/intellij/uiDesigner/icons/list.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"2"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTree"
icon=
"/com/intellij/uiDesigner/icons/tree.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTabbedPane"
icon=
"/com/intellij/uiDesigner/icons/tabbedPane.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSplitPane"
icon=
"/com/intellij/uiDesigner/icons/splitPane.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSpinner"
icon=
"/com/intellij/uiDesigner/icons/spinner.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSlider"
icon=
"/com/intellij/uiDesigner/icons/slider.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSeparator"
icon=
"/com/intellij/uiDesigner/icons/separator.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JProgressBar"
icon=
"/com/intellij/uiDesigner/icons/progressbar.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JToolBar"
icon=
"/com/intellij/uiDesigner/icons/toolbar.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
>
<preferred-size
width=
"-1"
height=
"20"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JToolBar$Separator"
icon=
"/com/intellij/uiDesigner/icons/toolbarSeparator.svg"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JScrollBar"
icon=
"/com/intellij/uiDesigner/icons/scrollbar.svg"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"0"
anchor=
"0"
fill=
"2"
/>
</item>
</group>
</component>
</project>
\ No newline at end of file
Consumer-User-Notification/.idea/vcs.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/.."
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
Consumer-User-Notification/.idea/workspace.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ArtifactsWorkspaceSettings"
>
<artifacts-to-build>
<artifact
name=
"Consumer:jar"
/>
</artifacts-to-build>
</component>
<component
name=
"AutoImportSettings"
>
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"68795978-b1a2-4702-95fa-e8e7afae617a"
name=
"Changes"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/../Consumer-Reporting/out/artifacts/Consumer_jar/Consumer.jar"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../Producer/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../Producer/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../Producer/out/artifacts/Producer_jar/Producer.jar"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../Producer/pom.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../Producer/pom.xml"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
</component>
<component
name=
"FileTemplateManagerImpl"
>
<option
name=
"RECENT_TEMPLATES"
>
<list>
<option
value=
"Class"
/>
</list>
</option>
</component>
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$/.."
/>
</component>
<component
name=
"MarkdownSettingsMigration"
>
<option
name=
"stateVersion"
value=
"1"
/>
</component>
<component
name=
"ProjectId"
id=
"2e2xOWSyAwlrJgJsmMdML8arM85"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
<component
name=
"ProjectViewState"
>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
<component
name=
"PropertiesComponent"
>
<![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"last_opened_file_path": "D:/HIAST/FIY/SS/Advanced Distributed Systems/Lab/4/java-kafka-consumer/Consumer/src/main/resources",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.2"
}
}]]>
</component>
<component
name=
"RecentsManager"
>
<key
name=
"CopyFile.RECENT_KEYS"
>
<recent
name=
"D:\HIAST\FIY\SS\Advanced Distributed Systems\Lab\4\java-kafka-consumer\Consumer\src\main\resources"
/>
</key>
<key
name=
"CopyClassDialog.RECENTS_KEY"
>
<recent
name=
"org.example"
/>
</key>
</component>
<component
name=
"SpellCheckerSettings"
RuntimeDictionaries=
"0"
Folders=
"0"
CustomDictionaries=
"0"
DefaultDictionary=
"application-level"
UseSingleDictionary=
"true"
transferred=
"true"
/>
<component
name=
"TaskManager"
>
<task
active=
"true"
id=
"Default"
summary=
"Default task"
>
<changelist
id=
"68795978-b1a2-4702-95fa-e8e7afae617a"
name=
"Changes"
comment=
""
/>
<created>
1711116444789
</created>
<option
name=
"number"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1711116444789
</updated>
</task>
<servers
/>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
<option
name=
"TAB_STATES"
>
<map>
<entry
key=
"MAIN"
>
<value>
<State
/>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
Consumer-User-Notification/Logs/Reporting-Log
0 → 100644
View file @
74ec3501
Consumer-User-Notification/pom.xml
0 → 100644
View file @
74ec3501
<?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"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.example
</groupId>
<artifactId>
Consumer
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<dependencies>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.12.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.kafka
</groupId>
<artifactId>
kafka-clients
</artifactId>
<version>
3.7.0
</version>
</dependency>
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
<version>
3.7.0
</version>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-core
</artifactId>
<version>
1.2.10
</version>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-classic
</artifactId>
<version>
1.2.10
</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>
17
</maven.compiler.source>
<maven.compiler.target>
17
</maven.compiler.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
</project>
\ No newline at end of file
Consumer-User-Notification/src/main/java/org/example/DataBaseHandler.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
import
redis.clients.jedis.Jedis
;
public
class
DataBaseHandler
{
private
static
final
String
REDIS_HOST
=
"localhost"
;
private
static
final
int
REDIS_PORT
=
6379
;
private
static
final
String
SUSPICIOUS_FIELD
=
"suspicious"
;
private
static
Jedis
jedis
=
new
Jedis
(
REDIS_HOST
,
REDIS_PORT
);
public
static
void
notifyUser
(
String
name
)
{
String
_notify_num
=
jedis
.
hget
(
name
,
SUSPICIOUS_FIELD
);
Integer
notify_num
=
Integer
.
parseInt
(
_notify_num
);
notify_num
++;
jedis
.
hset
(
name
,
SUSPICIOUS_FIELD
,
notify_num
.
toString
());
}
}
Consumer-User-Notification/src/main/java/org/example/TransactionInfo.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
public
class
TransactionInfo
{
private
String
name
;
private
String
location
;
private
double
amount
;
public
TransactionInfo
()
{}
public
TransactionInfo
(
String
name
,
String
location
,
double
amount
)
{
this
.
amount
=
amount
;
this
.
name
=
name
;
this
.
location
=
location
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getLocation
()
{
return
location
;
}
public
void
setLocation
(
String
location
)
{
this
.
location
=
location
;
}
public
double
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
double
amount
)
{
this
.
amount
=
amount
;
}
}
\ No newline at end of file
Consumer-User-Notification/src/main/java/org/example/UserNotificationKafkaConsumer.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.apache.kafka.common.serialization.LongDeserializer
;
import
org.apache.kafka.clients.consumer.*
;
import
org.apache.kafka.common.serialization.StringDeserializer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.time.Duration
;
import
java.util.Collections
;
import
java.util.Properties
;
public
class
UserNotificationKafkaConsumer
{
private
static
final
String
TOPIC
=
"SUSPICIOUS_TOPIC"
;
private
static
final
String
BOOTSTRAP_SERVERS
=
"localhost:9092,localhost:9093,localhost:9094"
;
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
UserNotificationKafkaConsumer
.
class
);
public
static
void
main
(
String
[]
args
)
{
String
consumerGroup
=
"defaultConsumerGroup"
;
if
(
args
.
length
==
1
)
{
consumerGroup
=
args
[
0
];
}
System
.
out
.
println
(
"Consumer is part of consumer group "
+
consumerGroup
);
Consumer
<
Long
,
String
>
kafkaConsumer
=
createKafkaConsumer
(
BOOTSTRAP_SERVERS
,
consumerGroup
);
consumeMessages
(
TOPIC
,
kafkaConsumer
);
}
public
static
void
consumeMessages
(
String
topic
,
Consumer
<
Long
,
String
>
kafkaConsumer
)
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
kafkaConsumer
.
subscribe
(
Collections
.
singletonList
(
topic
));
while
(
true
)
{
ConsumerRecords
<
Long
,
String
>
consumerRecords
=
kafkaConsumer
.
poll
(
Duration
.
ofSeconds
(
1
));
if
(
consumerRecords
.
isEmpty
())
continue
;
for
(
ConsumerRecord
<
Long
,
String
>
record
:
consumerRecords
)
{
String
stringJson
=
record
.
value
();
System
.
out
.
println
(
"key : "
+
record
.
key
());
System
.
out
.
println
(
"Received : "
+
stringJson
);
try
{
TransactionInfo
transactionInfo
=
objectMapper
.
readValue
(
stringJson
,
TransactionInfo
.
class
);
WritingHelper
writingHelper
=
new
WritingHelper
(
transactionInfo
);
writingHelper
.
writeToLog
();
DataBaseHandler
.
notifyUser
(
transactionInfo
.
getName
());
System
.
out
.
println
(
writingHelper
);
}
catch
(
JsonProcessingException
e
)
{
System
.
out
.
println
(
"Error Parsing"
);
System
.
out
.
println
(
e
.
getMessage
());
log
.
error
(
"Could Not Parse Json in Transaction"
);
}
}
kafkaConsumer
.
commitAsync
();
}
}
public
static
Consumer
<
Long
,
String
>
createKafkaConsumer
(
String
bootstrapServers
,
String
consumerGroup
)
{
Properties
properties
=
new
Properties
();
properties
.
put
(
ConsumerConfig
.
BOOTSTRAP_SERVERS_CONFIG
,
bootstrapServers
);
properties
.
put
(
ConsumerConfig
.
KEY_DESERIALIZER_CLASS_CONFIG
,
LongDeserializer
.
class
.
getName
());
properties
.
put
(
ConsumerConfig
.
VALUE_DESERIALIZER_CLASS_CONFIG
,
StringDeserializer
.
class
.
getName
());
properties
.
put
(
ConsumerConfig
.
GROUP_ID_CONFIG
,
consumerGroup
);
properties
.
put
(
ConsumerConfig
.
ENABLE_AUTO_COMMIT_CONFIG
,
false
);
return
new
KafkaConsumer
<>(
properties
);
}
}
\ No newline at end of file
Consumer-User-Notification/src/main/java/org/example/WritingHelper.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
public
class
WritingHelper
{
String
name
;
String
location
;
Double
amount
;
public
WritingHelper
(
TransactionInfo
transactionInfo
)
{
name
=
transactionInfo
.
getName
();
location
=
transactionInfo
.
getLocation
();
amount
=
transactionInfo
.
getAmount
();
}
@Override
public
String
toString
()
{
String
ans
=
""
;
Double
x
=
amount
;
ans
+=
"Name : "
+
name
+
" --- Location of Transaction : "
+
location
+
" --- amount of transaction : "
+
x
.
toString
();
return
ans
;
}
public
void
writeToLog
()
{
String
ans
=
toString
();
UserNotificationKafkaConsumer
.
log
.
info
(
ans
);
}
}
Consumer-User-Notification/src/main/resources/META-INF/MANIFEST.MF
0 → 100644
View file @
74ec3501
Manifest-Version: 1.0
Main-Class: org.example.UserNotificationKafkaConsumer
Consumer-User-Notification/src/main/resources/logback.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"HOME_LOG"
value=
"./myLogs/AccountManager-Log"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<Pattern>
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.FileAppender"
>
<file>
${HOME_LOG}
</file>
<append>
true
</append>
<immediateFlush>
true
</immediateFlush>
<encoder>
<pattern>
%d %p %c{1.} [%t] %m%n
</pattern>
</encoder>
</appender>
<logger
name=
"org.example"
level=
"DEBUG"
additivity=
"false"
>
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"FILE"
/>
</logger>
<root
level=
"error"
>
<appender-ref
ref=
"FILE"
/>
</root>
</configuration>
\ No newline at end of file
Consumer-User-Notification/target/classes/META-INF/MANIFEST.MF
0 → 100644
View file @
74ec3501
Manifest-Version: 1.0
Main-Class: org.example.ReportingKafkaConsumer
Consumer-User-Notification/target/classes/logback.xml
0 → 100644
View file @
74ec3501
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"HOME_LOG"
value=
"./myLogs/Reporting-Log"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<Pattern>
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.FileAppender"
>
<file>
${HOME_LOG}
</file>
<append>
true
</append>
<immediateFlush>
true
</immediateFlush>
<encoder>
<pattern>
%d %p %c{1.} [%t] %m%n
</pattern>
</encoder>
</appender>
<logger
name=
"org.example"
level=
"DEBUG"
additivity=
"false"
>
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"FILE"
/>
</logger>
<root
level=
"error"
>
<appender-ref
ref=
"FILE"
/>
</root>
</configuration>
\ No newline at end of file
Consumer-User-Notification/target/classes/org/example/ReportingKafkaConsumer.class
0 → 100644
View file @
74ec3501
File added
Consumer-User-Notification/target/classes/org/example/TransactionInfo.class
0 → 100644
View file @
74ec3501
File added
Consumer-User-Notification/target/classes/org/example/WritingHelper.class
0 → 100644
View file @
74ec3501
File added
Producer/.idea/workspace.xml
View file @
74ec3501
...
...
@@ -9,7 +9,9 @@
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"9704b422-94d9-4d0a-8879-40f13e57ea0e"
name=
"Changes"
comment=
""
/>
<list
default=
"true"
id=
"9704b422-94d9-4d0a-8879-40f13e57ea0e"
name=
"Changes"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/../Consumer-Reporting/out/artifacts/Consumer_jar/Consumer.jar"
beforeDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
@@ -32,7 +34,7 @@
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"last_opened_file_path": "D:/HIAST/FIY/SS/Advanced Distributed Systems/Lab/4/java-kafka-
consumer/Consumer
",
"last_opened_file_path": "D:/HIAST/FIY/SS/Advanced Distributed Systems/Lab/4/java-kafka-
producer/Producer/Producer/src/main/java/org/example
",
"project.structure.last.edited": "Libraries",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2",
...
...
Producer/out/artifacts/Producer_jar/Producer.jar
deleted
100644 → 0
View file @
07a2d4f7
File deleted
Producer/pom.xml
View file @
74ec3501
...
...
@@ -33,6 +33,11 @@
<artifactId>
logback-classic
</artifactId>
<version>
1.2.10
</version>
</dependency>
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
<version>
3.7.0
</version>
</dependency>
</dependencies>
<properties>
...
...
Producer/src/main/java/org/example/BankingAPI.java
0 → 100644
View file @
74ec3501
package
org
.
example
;
import
redis.clients.jedis.Jedis
;
import
java.util.Scanner
;
public
class
BankingAPI
{
private
static
final
String
REDIS_HOST
=
"localhost"
;
private
static
final
int
REDIS_PORT
=
6379
;
public
static
void
main
(
String
[]
args
)
{
// Connect to Redis
Jedis
jedis
=
new
Jedis
(
REDIS_HOST
,
REDIS_PORT
);
// Read user input
String
name
=
getUserInput
(
"Enter your name: "
);
String
location
=
getUserInput
(
"Enter your location: "
);
double
amount
=
Double
.
parseDouble
(
getUserInput
(
"Enter the transaction amount: "
));
// Search for the user in the Redis database
String
country
=
jedis
.
hget
(
"users"
,
name
);
if
(
country
==
null
)
{
System
.
out
.
println
(
"User not found in the database."
);
}
else
{
if
(
country
.
equals
(
location
))
{
System
.
out
.
println
(
"Transaction is valid."
);
// Perform further processing for valid transaction
}
else
{
System
.
out
.
println
(
"Transaction is suspicious."
);
// Perform further processing for suspicious transaction
}
}
// Close the Redis connection
jedis
.
close
();
}
private
static
String
getUserInput
(
String
prompt
)
{
System
.
out
.
print
(
prompt
);
Scanner
scanner
=
new
Scanner
(
System
.
in
);
return
scanner
.
nextLine
();
}
}
\ No newline at end of file
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