Add observer field to ZeroMQ sent data
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>spacecruft
parent
87ac2f9dc9
commit
4aed383ed0
|
@ -276,7 +276,7 @@ class TelemetryViewSet( # pylint: disable=R0901
|
|||
decode_current_frame.delay(norad_cat_id, serializer.instance.pk)
|
||||
|
||||
# Run task to publish the current frame via ZeroMQ
|
||||
publish_current_frame.delay(norad_cat_id, timestamp, request.data.get('frame'))
|
||||
publish_current_frame.delay(norad_cat_id, timestamp, request.data.get('frame'), observer)
|
||||
|
||||
return Response(status=status.HTTP_201_CREATED)
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ def decode_current_frame(norad_id, demoddata_id):
|
|||
|
||||
|
||||
@shared_task
|
||||
def publish_current_frame(norad_id, timestamp, frame):
|
||||
def publish_current_frame(norad_id, timestamp, frame, observer):
|
||||
"""Task to publish a current frame for a satellite."""
|
||||
# Initialize ZeroMQ socket
|
||||
publisher = CONTEXT.socket(zmq.XPUB)
|
||||
|
@ -281,9 +281,12 @@ def publish_current_frame(norad_id, timestamp, frame):
|
|||
raise
|
||||
else:
|
||||
publisher.send_multipart(
|
||||
[bytes(str(norad_id), 'utf-8'),
|
||||
[
|
||||
bytes(str(norad_id), 'utf-8'),
|
||||
bytes(timestamp, 'utf-8'),
|
||||
bytes(frame, 'utf-8'),
|
||||
bytes(timestamp, 'utf-8')]
|
||||
bytes(observer, 'utf-8')
|
||||
]
|
||||
)
|
||||
finally:
|
||||
publisher.close()
|
||||
|
|
Loading…
Reference in New Issue