Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
task9_redis_receiver
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
arun.uday
task9_redis_receiver
Commits
3b4e6a18
Commit
3b4e6a18
authored
Feb 02, 2023
by
arun.uday
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v2
parent
151e1270
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
13 deletions
+56
-13
.idea/workspace.xml
+29
-8
app.py
+2
-2
conf/application.conf
+8
-0
scripts/config/api_route_config.py
+9
-0
scripts/config/applications_config.py
+4
-0
scripts/services/receiver_app_run.py
+4
-3
No files found.
.idea/workspace.xml
View file @
3b4e6a18
...
@@ -4,7 +4,14 @@
...
@@ -4,7 +4,14 @@
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
</component>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"530f9a40-4e97-41f4-9693-adc3b4faba7d"
name=
"Changes"
comment=
""
/>
<list
default=
"true"
id=
"530f9a40-4e97-41f4-9693-adc3b4faba7d"
name=
"Changes"
comment=
"v1"
>
<change
afterPath=
"$PROJECT_DIR$/scripts/config/api_route_config.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/conf/application.conf"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/conf/application.conf"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/scripts/config/applications_config.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/scripts/config/applications_config.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/scripts/services/receiver_app_run.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/scripts/services/receiver_app_run.py"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
@@ -29,14 +36,15 @@
...
@@ -29,14 +36,15 @@
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
</component>
<component
name=
"PropertiesComponent"
>
{
<component
name=
"PropertiesComponent"
>
<![CDATA[{
"
keyToString
"
: {
"keyToString": {
"
RunOnceActivity.OpenProjectViewOnStart
"
:
"
true
"
,
"RunOnceActivity.OpenProjectViewOnStart": "true",
"
RunOnceActivity.ShowReadmeOnStart
"
:
"
true
"
,
"RunOnceActivity.ShowReadmeOnStart": "true",
"
last_opened_file_path
"
:
"
E:/KL projects/task9receiverredis
"
,
"SONARLINT_PRECOMMIT_ANALYSIS": "true",
"
settings.editor.selected.configurable
"
:
"
project.propVCSSupport.DirectoryMappings
"
"last_opened_file_path": "E:/KL projects/task9senderredis",
"settings.editor.selected.configurable": "project.propVCSSupport.DirectoryMappings"
}
}
}
</component>
}
]]>
</component>
<component
name=
"RunManager"
>
<component
name=
"RunManager"
>
<configuration
name=
"app"
type=
"PythonConfigurationType"
factoryName=
"Python"
nameIsGenerated=
"true"
>
<configuration
name=
"app"
type=
"PythonConfigurationType"
factoryName=
"Python"
nameIsGenerated=
"true"
>
<module
name=
"redis receiver"
/>
<module
name=
"redis receiver"
/>
...
@@ -70,6 +78,18 @@
...
@@ -70,6 +78,18 @@
<option
name=
"presentableId"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1675224688329
</updated>
<updated>
1675224688329
</updated>
</task>
</task>
<task
id=
"LOCAL-00001"
summary=
"v1"
>
<created>
1675310885575
</created>
<option
name=
"number"
value=
"00001"
/>
<option
name=
"presentableId"
value=
"LOCAL-00001"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1675310885575
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"2"
/>
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"VcsManagerConfiguration"
>
<MESSAGE
value=
"v1"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"v1"
/>
</component>
</project>
</project>
\ No newline at end of file
app.py
View file @
3b4e6a18
import
uvicorn
import
uvicorn
from
scripts.config.applications_config
import
uvicorn_host
,
uvicorn_port
from
scripts.config.applications_config
import
uvicorn_host
,
uvicorn_port
,
uvicorn_app
# starting the application
# starting the application
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
print
(
"redis MQTT task"
)
print
(
"redis MQTT task"
)
uvicorn
.
run
(
"scripts.services.receiver_app_run:app"
,
host
=
uvicorn_host
,
port
=
int
(
uvicorn_port
))
uvicorn
.
run
(
uvicorn_app
,
host
=
uvicorn_host
,
port
=
int
(
uvicorn_port
))
conf/application.conf
View file @
3b4e6a18
...
@@ -12,6 +12,7 @@ requests = 60
...
@@ -12,6 +12,7 @@ requests = 60
[
uvicorn
]
[
uvicorn
]
uvicorn_host
=
127
.
0
.
0
.
1
uvicorn_host
=
127
.
0
.
0
.
1
uvicorn_port
=
8001
uvicorn_port
=
8001
uvicorn_app
=
scripts
.
services
.
receiver_app_run
:
app
# database servers
# database servers
[
connection
]
[
connection
]
...
@@ -19,3 +20,10 @@ mongodb = mongodb://localhost:27017
...
@@ -19,3 +20,10 @@ mongodb = mongodb://localhost:27017
[
redis_db
]
[
redis_db
]
redis_host
=
127
.
0
.
0
.
1
redis_host
=
127
.
0
.
0
.
1
[
encode
]
encode
=
utf
-
8
[
api_routes
]
index_route
= /
scripts/config/api_route_config.py
0 → 100644
View file @
3b4e6a18
import
configparser
config
=
configparser
.
RawConfigParser
()
config
.
read
(
"conf/application.conf"
)
# api routes
index_route
=
config
.
get
(
"api_route"
,
'index_route'
)
scripts/config/applications_config.py
View file @
3b4e6a18
...
@@ -23,6 +23,10 @@ client_connect = config.get("connection", "mongodb")
...
@@ -23,6 +23,10 @@ client_connect = config.get("connection", "mongodb")
# uvicorn
# uvicorn
uvicorn_host
=
config
.
get
(
"uvicorn"
,
"uvicorn_host"
)
uvicorn_host
=
config
.
get
(
"uvicorn"
,
"uvicorn_host"
)
uvicorn_port
=
config
.
get
(
"uvicorn"
,
"uvicorn_port"
)
uvicorn_port
=
config
.
get
(
"uvicorn"
,
"uvicorn_port"
)
uvicorn_app
=
config
.
get
(
"uvicorn"
,
"uvicorn_app"
)
# redis
# redis
redis_host
=
config
.
get
(
"redis_db"
,
"redis_host"
)
redis_host
=
config
.
get
(
"redis_db"
,
"redis_host"
)
# encode
utf_encode
=
config
.
get
(
"encode"
,
"encode"
)
scripts/services/receiver_app_run.py
View file @
3b4e6a18
import
paho.mqtt.client
as
mqtt
import
paho.mqtt.client
as
mqtt
from
fastapi
import
FastAPI
from
fastapi
import
FastAPI
from
scripts.config.applications_config
import
mqtt_host
,
port
,
request_no
from
scripts.config.api_route_config
import
index_route
from
scripts.config.applications_config
import
mqtt_host
,
port
,
request_no
,
utf_encode
from
scripts.core.engine.redis_db
import
conn
from
scripts.core.engine.redis_db
import
conn
from
scripts.core.handlers.reading_doctors
import
read_doctors
from
scripts.core.handlers.reading_doctors
import
read_doctors
...
@@ -11,7 +12,7 @@ app = FastAPI()
...
@@ -11,7 +12,7 @@ app = FastAPI()
# subscribing to the doctor topics and getting the messages
# subscribing to the doctor topics and getting the messages
@app.get
(
"/"
)
@app.get
(
index_route
)
def
receiver
():
def
receiver
():
# subscribe to the doctor topics
# subscribe to the doctor topics
def
on_connect
(
client_name
,
userdata
,
flags
,
rc
):
def
on_connect
(
client_name
,
userdata
,
flags
,
rc
):
...
@@ -23,7 +24,7 @@ def receiver():
...
@@ -23,7 +24,7 @@ def receiver():
def
on_message
(
client_name
,
userdata
,
msg
):
def
on_message
(
client_name
,
userdata
,
msg
):
print
(
client_name
,
" "
,
userdata
)
print
(
client_name
,
" "
,
userdata
)
# decoding the msg to string
# decoding the msg to string
payload_decoded
=
msg
.
payload
.
decode
(
'utf-8'
)
payload_decoded
=
msg
.
payload
.
decode
(
utf_encode
)
print
(
msg
.
topic
,
"assigned to"
,
payload_decoded
)
print
(
msg
.
topic
,
"assigned to"
,
payload_decoded
)
# creating the paho client for mqtt
# creating the paho client for mqtt
...
...
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