FriendshipServiceVerticle
FriendshipServiceVerticle is the main entry point for the Friendship Service. It is responsible for handling all the business logic related to friendships, friendship requests, messages and users. It also deploys the KafkaFriendshipProducerVerticle to publish events to the Kafka broker.
Parameters
The repository to interact with the User entity.
The repository to interact with the Friendship entity.
The repository to interact with the FriendshipRequest entity.
The repository to interact with the Message entity.
The database credentials to connect to the MySQL database.
A flag to determine if the service should connect to the database, used for testing purposes.
Constructors
Functions
Accepts a friendship request. Also publishes a FriendshipRequestAccepted event to the Kafka broker and the Vert.x event bus.
Stops the FriendshipServiceVerticle and closes the database connections.
Adds a friendship request.
Adds a message to the repository.
Connects to the MySQL database using the provided credentials or the default credentials given by the environment variables.
Deletes a friendship by its ID. Also publishes a FriendshipRemoved event to the Kafka broker and the Vert.x event bus.
Deletes a message by its ID.
Retrieves all friendships of a user.
Retrieves all friendship requests in the repository.
Retrieves all friendship requests of a user.
Retrieves all friendships.
Retrieves all messages in the repository.
Retrieves all messages exchanged between 2 users.
Retrieves all messages sent by a user.
Retrieves a friendship by its ID.
Retrieves a friendship request by its ID.
Retrieves a message by its ID.
Retrieves a user by their ID.
Handles a received message. Also publishes a MessageReceived event to the Kafka broker and the Vert.x event bus.
Rejects a friendship request. Also publishes a FriendshipRequestRejected event to the Kafka broker and the Vert.x event bus.
Handles a sent message. Also publishes a MessageSent event to the Kafka broker and the Vert.x event bus.