Commit eac0bfb2 authored by Robin Obůrka's avatar Robin Obůrka

dev: Prepare for new version of sn_main

parent 49a369f0
...@@ -6,19 +6,18 @@ import sn ...@@ -6,19 +6,18 @@ import sn
def setup(): def setup():
class ExampleResources: return {
foo = "bar" "foo": "bar",
}
return ExampleResources
def teardown(context):
def teardown(userdata):
print("teardown") print("teardown")
def process(envdata, userdata, msg_type, payload): def process(context, msg_type, payload):
print(msg_type, payload) print(msg_type, payload)
if __name__ == "__main__": if __name__ == "__main__":
sn.sn_main("in_only", setup=setup, teardown=teardown, process=process) sn.sn_main("in_only", process, setup=setup, teardown=teardown)
...@@ -6,21 +6,20 @@ import sn ...@@ -6,21 +6,20 @@ import sn
def setup(): def setup():
class ExampleResources: return {
foo = "bar" "foo": "bar",
}
return ExampleResources
def teardown(context):
def teardown(userdata):
print("teardown") print("teardown")
def process(envdata, userdata, msg_type, payload): def process(context, msg_type, payload):
print(msg_type, payload) print(msg_type, payload)
return msg_type, payload return msg_type, payload
if __name__ == "__main__": if __name__ == "__main__":
sn.sn_main("in_out", setup=setup, teardown=teardown, process=process) sn.sn_main("in_out", process, setup=setup, teardown=teardown)
...@@ -8,20 +8,19 @@ import sn ...@@ -8,20 +8,19 @@ import sn
def setup(): def setup():
class ExampleResources: return {
foo = "bar" "foo": "bar",
}
return ExampleResources
def teardown(userdata): def teardown(context):
print("teardown") print("teardown")
def process(envdata, userdata): def process(context):
while True: while True:
data = { data = {
"foo": userdata.foo, "foo": context.foo,
"ts": int(time.time()), "ts": int(time.time()),
} }
...@@ -32,4 +31,4 @@ def process(envdata, userdata): ...@@ -32,4 +31,4 @@ def process(envdata, userdata):
if __name__ == "__main__": if __name__ == "__main__":
sn.sn_main("out_only", setup=setup, teardown=teardown, process=process) sn.sn_main("out_only", process, setup=setup, teardown=teardown)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment