api.endpoints package#

Submodules#

api.endpoints.endpoints module#

Websocket API module.

This module contains method(s) defining application any web socket endpoint(s)

exception api.endpoints.endpoints.InelegantKafkaShutdownWarning[source]#

Bases: Warning

Warning to indicate issues with shutdown of kafka

exception api.endpoints.endpoints.MultipleKafkaProducerStartWarning[source]#

Bases: Warning

Warning to indicate attempt to start kafka producer on app with existing kafka producer.

async api.endpoints.endpoints.close_apache_kafka_producer(fastapi_application: FastAPI)[source]#

Closes the Apache Kafka producer

Parameters:

fastapi_application – Instance of FastAPI application to consume properties from.

async api.endpoints.endpoints.handle_chat(websocket: WebSocket, chat_uuid: UUID)[source]#

Handle chat operations on chat with id {chat_uuid}. :param websocket: FastAPI Websocket object for websocket operations. :param chat_uuid: UUID of chat :return:

api.endpoints.endpoints.lifespan(fastapi_application: FastAPI)[source]#

Run start up and shut down operations for the server.

Code before the yield statement gets called before running server, while code after the yield statement gets called during the closure of the server. :param fastapi_application: FastAPI app instance.

async api.endpoints.endpoints.set_up_chat(request_json_body: SetUpChatRequestBody, session: Session = Depends(get_db))[source]#

Endpoint for setting up chat.

Creates a unique chat uuid and saves in database returning a redirect response. :return:

api.endpoints.endpoints.shutdown_apache_kafka(fastapi_application: FastAPI)[source]#

Shutdown Apache Kafka.

This is done with a trial and error method. If there is an error while attempting to close with the official *-stop.sh executables, a terminate() call to the subprocesses that holds the already started kafka zookeeper and server process will be called; a warning will also be issued

If kafka’s server or zookeeper isn’t running, OperationNotAllowedException will be raised.

async api.endpoints.endpoints.start_apache_kafka_producer(fastapi_application: FastAPI)[source]#

Starts the Apache Kafka producer

Parameters:

fastapi_application – Instance of FastAPI application to set properties on.

api.endpoints.endpoints.startup_apache_kafka(fastapi_application: FastAPI)[source]#

Starts Apache Kafka

It essentially does 2 things: 1. Starts zookeeper 2. Starts the apache kafka server.

Parameters:

fastapi_application – Instance of FastAPI application to set properties on.

Module contents#