Skip to content

Creates broker for communication between slave server and transductor

Arthur Assis requested to merge broker into development

Fixes #60 (closed)

I created a broker service that acts as a intermediary in the communication slave server - transductor. The objective of this broker is to ensure that the same transductor does not receive more that one message at a time, to do so the broker creates a message queue and a worker for each transductor. Every worker works asynchronously from each other, and every worker sends the message from it's message queue synchronously.

The logic of the transport protocol was migrated to the broker service, but the serial protocol logic remains in the slave-api service, doing this the transport module was simplified a lot, now it only creates a message to send to the broker and handles it's response.

the communication between broker and slave is made using a UDP socket. and the message uses this format:

  • slave to broker:
{
    'protocol': The protocol that should be used to talk with the transductor
    'ip': The IP address of the transductor
    'port': The port of the transductor
    'content': An array of messages that should be send to the transductor
}
  • broker to slave:
{
    'status': This informs if the communication was successful(where this value is '1') or if there was any error(where this value is '0')
    'content': An array of response given from the transductor if the communication was successful, or if there was any error the error message.  
}

Merge request reports