Skip to content

Commit e83ad32

Browse files
committed
Remove demo_app function and add MyBusinessOperation class with initialization logging
1 parent be8d064 commit e83ad32

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

demo/python/reddit/app.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

demo/python/reddit/bo.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,24 @@ def on_message(self, request):
153153
self.adapter.on_task()
154154
return
155155

156+
157+
class MyBusinessOperation(BusinessOperation):
158+
159+
# This setting will be available in the managment portal
160+
foo: str = "default"
161+
my_number: int = 42
162+
untyped_setting = None
163+
164+
# This setting will not be available in the managment portal
165+
_my_internal_setting: str = "default"
166+
no_aviable_setting: str
167+
168+
def on_init(self):
169+
self.log_info("[Python] MyBusinessOperation:on_init() is called")
170+
self.log_info("[Python] foo: " + self.foo)
171+
self.log_info("[Python] my_number: " + str(self.my_number))
172+
return
173+
156174
# Utils.register_component('adapter','TestHeartBeat','/irisdev/app/src/python/demo/',1,'Python.TestHeartBeat')
157175
# Utils.register_component('bo','HeartBeatOperation','/irisdev/app/src/python/demo/reddit/',1,'Python.HeartBeatOperation')
158176

demo/python/reddit/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
"Python.RedditService": bs.RedditService,
99
"Python.RedditServiceWithIrisAdapter": bs.RedditServiceWithIrisAdapter,
1010
"Python.RedditServiceWithPexAdapter": bs.RedditServiceWithPexAdapter,
11+
"Python.RedditInboundAdapter": adapter.RedditInboundAdapter,
1112
"Python.FilterPostRoutingRule": bp.FilterPostRoutingRule,
1213
"Python.TestHeartBeat": adapter.TestHeartBeat,
14+
"Python.Demo.MyBusinessOperation": bo.MyBusinessOperation,
1315
"Python.HeartBeat": bo.HeartBeatOperation,
1416
}
1517

0 commit comments

Comments
 (0)