Пример #1
0
    def update_position(self, move: MovementRequest) -> UpdatedPosition:
        self.set_pos(move.p_id, move.destination.x_pos, move.destination.y_pos)

        update = UpdatedPosition()
        update.p_id = move.p_id
        update.x_pos = move.destination.x_pos
        update.y_pos = move.destination.y_pos
        print(update)
        return update
Пример #2
0
from kafka import KafkaConsumer, KafkaProducer
from People.Interface.move import UpdatedPosition
from Utilities.Serialization.serialize import serialize

consumer = KafkaConsumer('main', bootstrap_servers=['0.0.0.0:9092'])
producer = KafkaProducer(bootstrap_servers=['0.0.0.0:9092'])

messageOne = UpdatedPosition()
messageOne.x_pos = 3
messageOne.y_pos = 3
messageOne.p_id = 10

producer.send("fe", serialize(messageOne))