EVENT API GUIDE

BFF SERVICE

The BFF service is a microservice that acts as a bridge between the client and backend services. It provides a unified API for the client to interact with multiple backend services, simplifying the communication process and improving performance.

Architectural Design Credit and Contact Information

The architectural design of this microservice is credited to.
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:

Email:

We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.

Documentation Scope

Welcome to the official documentation for the BFF Service Event Listeners. This guide details the Kafka-based event listeners responsible for reacting to ElasticSearch index events. It describes listener responsibilities, the topics they subscribe to, and expected payloads.

Intended Audience
This documentation is intended for developers, architects, and system administrators involved in the design, implementation, and maintenance of the BFF Service. It assumes familiarity with microservices architecture, the Kafka messaging system, and ElasticSearch.

Overview
Each ElasticSearch index operation (create, update, delete) emits a corresponding event to Kafka. These events are consumed by listeners responsible for executing aggregate functions to ensure index- and system-level consistency.

Kafka Event Listeners

Kafka Event Listener: reservation-created

Event Topic: elastic-index-airbnb3_reservation-created

When a reservation is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the ReservationDetailViewAggregateData function to enrich and store the final document in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: reservation-updated

Event Topic: elastic-index-airbnb3_reservation-updated

When a reservation is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the ReservationDetailViewAggregateData function to update the enriched document in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: reservation-deleted

Event Topic: elastic-index-airbnb3>_reservation-deleted

When a reservation is deleted in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the ReservationDetailViewAggregateData function to handle removal or cleanup in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: user-created

Event Topic: elastic-index-user-created

When a user is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the guestReReservationDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: user-updated

Event Topic: elastic-index-airbnb3>_user-updated

When a user is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the guestReReservationDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: user-deleted

Event Topic: elastic-index-airbnb3>_user-deleted

When a user is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the guestReReservationDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: user-created

Event Topic: elastic-index-user-created

When a user is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the hostReReservationDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: user-updated

Event Topic: elastic-index-airbnb3>_user-updated

When a user is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the hostReReservationDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: user-deleted

Event Topic: elastic-index-airbnb3>_user-deleted

When a user is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the hostReReservationDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listing-created

Event Topic: elastic-index-listing-created

When a listing is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the listingReReservationDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listing-updated

Event Topic: elastic-index-airbnb3>_listing-updated

When a listing is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the listingReReservationDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listing-deleted

Event Topic: elastic-index-airbnb3>_listing-deleted

When a listing is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the listingReReservationDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: paymentrecord-created

Event Topic: elastic-index-paymentrecord-created

When a paymentrecord is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the paymentRecordReReservationDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: paymentrecord-updated

Event Topic: elastic-index-airbnb3>_paymentrecord-updated

When a paymentrecord is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the paymentRecordReReservationDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: paymentrecord-deleted

Event Topic: elastic-index-airbnb3>_paymentrecord-deleted

When a paymentrecord is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the paymentRecordReReservationDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: messagethread-created

Event Topic: elastic-index-airbnb3_messagethread-created

When a messagethread is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the chatContextAggregateData function to enrich and store the final document in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: messagethread-updated

Event Topic: elastic-index-airbnb3_messagethread-updated

When a messagethread is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the chatContextAggregateData function to update the enriched document in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: messagethread-deleted

Event Topic: elastic-index-airbnb3>_messagethread-deleted

When a messagethread is deleted in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the chatContextAggregateData function to handle removal or cleanup in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listing-created

Event Topic: elastic-index-airbnb3_listing-created

When a listing is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the ListingDetailViewAggregateData function to enrich and store the final document in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listing-updated

Event Topic: elastic-index-airbnb3_listing-updated

When a listing is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the ListingDetailViewAggregateData function to update the enriched document in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listing-deleted

Event Topic: elastic-index-airbnb3>_listing-deleted

When a listing is deleted in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the ListingDetailViewAggregateData function to handle removal or cleanup in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listinglocaletext-created

Event Topic: elastic-index-listinglocaletext-created

When a listinglocaletext is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the localizedTextsReListingDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listinglocaletext-updated

Event Topic: elastic-index-airbnb3>_listinglocaletext-updated

When a listinglocaletext is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the localizedTextsReListingDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listinglocaletext-deleted

Event Topic: elastic-index-airbnb3>_listinglocaletext-deleted

When a listinglocaletext is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the localizedTextsReListingDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listingcalendar-created

Event Topic: elastic-index-listingcalendar-created

When a listingcalendar is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the calendarEntriesReListingDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listingcalendar-updated

Event Topic: elastic-index-airbnb3>_listingcalendar-updated

When a listingcalendar is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the calendarEntriesReListingDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listingcalendar-deleted

Event Topic: elastic-index-airbnb3>_listingcalendar-deleted

When a listingcalendar is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the calendarEntriesReListingDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: review-created

Event Topic: elastic-index-review-created

When a review is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the reviewsReListingDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: review-updated

Event Topic: elastic-index-airbnb3>_review-updated

When a review is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the reviewsReListingDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: review-deleted

Event Topic: elastic-index-airbnb3>_review-deleted

When a review is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the reviewsReListingDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listingamenity-created

Event Topic: elastic-index-listingamenity-created

When a listingamenity is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the amenitiesReListingDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listingamenity-updated

Event Topic: elastic-index-airbnb3>_listingamenity-updated

When a listingamenity is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the amenitiesReListingDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: listingamenity-deleted

Event Topic: elastic-index-airbnb3>_listingamenity-deleted

When a listingamenity is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the amenitiesReListingDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: reservation-created

Event Topic: elastic-index-reservation-created

When a reservation is created in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the reservationsReListingDetailView function to update dependent documents in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: reservation-updated

Event Topic: elastic-index-airbnb3>_reservation-updated

When a reservation is updated in the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the reservationsReListingDetailView function to re-enrich dependent data in the related index.

Expected Payload:

{
  "id": "String"
}

Kafka Event Listener: reservation-deleted

Event Topic: elastic-index-airbnb3>_reservation-deleted

When a reservation is deleted from the ElasticSearch index, this listener is triggered. It parses the event payload, extracts the entity ID, and invokes the reservationsReListingDetailView function to handle dependent data cleanup or updates.

Expected Payload:

{
  "id": "String"
}