Commit f88503b0 authored by GromeTT's avatar GromeTT
Browse files

Fix: Forwarder receives msgs and responds properly

parent 9ae0cbb2
......@@ -14,4 +14,4 @@ def __init__(self, idp, config):
"""
super(Komatsu, idp, config)
super().__init__(idp, config)
......@@ -28,7 +28,7 @@ def send_forwarding_job(self, receiver_id, job):
:param job:
"""
APP_LOGGER.info("Sending forwarding job.")
receiver_ids = [receiver_id]
access_token = self.idp.get_token(TokenType.ACCESS_TOKEN)
send_request(
......
......@@ -10,7 +10,7 @@ class Ponsse(Harvester):
"""Example implentation of a Ponsse harvester."""
def __init__(self, idp, config):
super(Ponsse, idp, config)
super().__init__(idp, config)
def send_forwarding_job(self, receiver_id, job):
"""Send a fml40::Forwardingjob message to receiver_id.
......@@ -28,5 +28,5 @@ def send_forwarding_job(self, receiver_id, job):
self.config["thingId"],
receiver_ids,
"fml40::ForwardingJob",
parameter=job,
parameters=job,
)
......@@ -61,7 +61,9 @@ def acceptJob(self, job):
# Check if job can be accepted
# Find the correct functionality which should execute the job
APP_LOGGER.info("Checking if the job can be accepted.")
proxy_executer = self.managing_actor.proxy_functionalities.get()[self.proxy_name]
proxy_executer = self.managing_actor.proxy_functionalities.get()[
self.proxy_name
]
proxy_executer.executeJob(job)
......@@ -103,8 +105,8 @@ def assignJob(self, sender_id, receiver_id, job):
"""
APP_LOGGER.info("I assign the job {} to the Komatsu forwarder".format(job))
# access_token = self.idp.get_token(TokenType.ACCESS_TOKEN)
actor_proxy = self.managing_actor.proxy()
actor_proxy.send_forwarding_job(sender_id, receiver_id, job)
self.managing_actor.send_forwarding_job(receiver_id, job)
print("Done")
class AcceptsForwardingJobs(AcceptsJobs):
......@@ -119,9 +121,11 @@ def acceptJob(self, job):
:param job:
"""
print("accepting job")
APP_LOGGER.info("I check if I (the Komatsu Forwarder) can accept the job.")
proxy_executer = self.managing_actor.proxy_functionalities.get()[self.proxy_name]
proxy_executer = self.managing_actor.proxy_functionalities.get()[
self.proxy_name
]
proxy_executer.executeJob(job)
......
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