Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Membuat arsitektur berbasis peristiwa dengan Eventarc
Anda dapat menggunakan Eventarc dan
Firestore dengan kompatibilitas MongoDB untuk membangun
arsitektur berbasis peristiwa.
Pemicu Firestore dengan kompatibilitas MongoDB untuk Eventarc menghasilkan peristiwa dari perubahan pada dokumen tertentu di database Anda. Pemicu dapat merutekan peristiwa ke
tujuan yang didukung:
Eventarc menawarkan solusi standar untuk mengelola alur perubahan status, yang disebut peristiwa, antara microservice yang dipisahkan. Saat dipicu, Eventarc akan merutekan peristiwa ini ke berbagai tujuan sambil mengelola pengiriman, keamanan, otorisasi, kemampuan observasi, dan penanganan error untuk Anda.
Batasan
Perhatikan batasan berikut untuk pemicu Firestore dengan kompatibilitas MongoDB untuk Eventarc:
Pengurutan tidak dijamin. Perubahan cepat dapat memicu peristiwa dalam urutan yang tidak terduga.
Peristiwa dikirimkan setidaknya satu kali.
Pastikan handler peristiwa Anda idempoten dan hindari menghasilkan hasil atau efek samping yang tidak terduga saat peristiwa dikirimkan lebih dari sekali. Lihat
Membangun fungsi idempoten untuk mempelajari lebih lanjut.
Pemicu dikaitkan dengan satu database. Anda tidak dapat membuat pemicu yang cocok dengan beberapa database.
Menghapus database tidak secara otomatis menghapus pemicu untuk database tersebut. Pemicu berhenti mengirim peristiwa, tetapi akan tetap ada sampai Anda menghapus pemicu. Jika database dibuat ulang, pemicu terkait juga harus dihapus dan dibuat ulang untuk memulihkan pengiriman peristiwa.
Firestore dengan kompatibilitas MongoDB mendukung fungsi Cloud Run (generasi ke-2) dan tidak mendukung fungsi Cloud Run (generasi ke-1).
Database edisi Firestore Enterprise tidak mendukung jenis peristiwa entity Datastore.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],null,["# Create event-driven architectures with Eventarc\n===============================================\n\nYou can use [Eventarc](/eventarc/docs/overview) and\nFirestore with MongoDB compatibility to build\n[event-driven architectures](/eventarc/docs/event-driven-architectures).\nFirestore with MongoDB compatibility triggers for\nEventarc generate events from changes\nto a particular documents in your database. The trigger can route events to a\n[supported destination](/eventarc/docs/event-providers-targets):\n\n- Cloud Run functions (2nd gen) which supports the [Cloud Client Libraries](/firestore/docs/extend-with-functions-2nd-gen) and the [Firebase SDK](https://firebase.google.com/docs/firestore/extend-with-functions-2nd-gen)\n- [Cloud Run](/eventarc/docs/run/route-trigger-cloud-firestore)\n- [Google Kubernetes Engine](/eventarc/docs/gke/route-trigger-cloud-firestore)\n- [Workflows](/eventarc/docs/workflows/route-trigger-cloud-firestore)\n\nEventarc offers a standardized solution to manage the flow of\nstate changes, called *events*, between decoupled microservices. When triggered,\nEventarc routes these events to\nvarious destinations while managing delivery, security, authorization,\nobservability, and error-handling for you.\n| **Note:** Eventarc events use the [`CloudEvents`](https://cloudevents.io/) specification.\n\nLimitations\n-----------\n\nNote the following limitations for Firestore with MongoDB compatibility triggers for\nEventarc:\n\n- Ordering is not guaranteed. Rapid changes can trigger events in an unexpected order.\n- Events are delivered *at least* once.\n\n Make sure your event handler is idempotent and avoid producing unexpected results\n or side effects when an event is delivered more than once. Refer to\n [Building idempotent functions](https://cloud.google.com/blog/products/serverless/cloud-functions-pro-tips-building-idempotent-functions) to learn more.\n- A trigger is associated with a single database. You cannot create a trigger that matches multiple databases.\n\n- Deleting a database does not automatically delete any triggers for that database. The\n trigger stops delivering events but continues to exist until you [delete the trigger](/eventarc/docs/managing-triggers#trigger-delete). If the database is recreated, any associated triggers will also need to be deleted and recreated to restore event delivery.\n\n- Firestore with MongoDB compatibility supports Cloud Run functions (2nd gen) and doesn't support\n Cloud Run functions (1st gen).\n\n- Firestore Enterprise edition databases do not support Datastore entity event types.\n\nWhat's next\n-----------\n\n- Learn about [event-driven architectures](/eventarc/docs/event-driven-architectures)."]]