# Events \[Kafka and DB Sync]

### Creating a Kafka Event

* Navigate to the [*<mark style="color:blue;">**Pipeline Editor**</mark>*](https://docs.bdb.ai/bdb-documentation/data-pipeline/getting-started/pipeline-workflow-editor) page.                        &#x20;
* Click the ***Toggle Event Panel*** <img src="https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FG8GzJmQrTYyVh9kN6xif%2Fimage.png?alt=media&#x26;token=02ab8069-aac7-4478-bef4-354fe4bdc881" alt="" data-size="line">icon from the header.

![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2F2S5HEGkH76U4uVVbWFa5%2Fimage.png?alt=media\&token=c592618a-a6b1-48be-9edb-906be698ff1a)

* The Events Panel appears, and the Toggle Event Panel icon gets changed as <img src="https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FJfEl63UmdOPrshlntSBJ%2Fimage.png?alt=media&#x26;token=38db2048-7ed1-4fef-a872-e0daada43076" alt="" data-size="line">suggesting that the event panel is displayed.
* Click the ***Add New Event*** icon from the Event Panel.

![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FavxTmqLbxgfqrhnGpIt3%2Fimage.png?alt=media\&token=f4288942-b86d-4e02-9ff7-f0c014174dd6)

* The ***New Event*** window opens.

&#x20;     ![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FuxdBow4qEqhUZZ9fdJPr%2Fimage.png?alt=media\&token=710b4193-0f00-4dea-8955-f581d91c120c)

* Provide a name for the new Event.
* Select Event Duration: Select an option from the below-given options.

&#x20;   **\* Short (4 hours)**

&#x20;   **\* Medium (8 hours)**

&#x20;   **\* Long (48 hours)**

&#x20;   **\* Full Day (24 hours)**

&#x20;   **\* Long (48 hours)**

&#x20;   **\* Week (168 hours)**

{% hint style="info" %}
*<mark style="color:green;">Please Note</mark>: The event data gets erased after 7 days if no duration option is selected from the available options. The Offsets expire as well.*
{% endhint %}

* Provide No. of Partitions (1-10).
* No. of Outputs: The user can define the number of outputs using this field.
* Checkmark the '**Is Failover'** option to enable the Failover Event.
* Select a Pipeline using the drop-down menu if you have selected the ‘**Is Shared**?’ option.
* Click the ***Add Event*** option.

![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FT2UNWJ7gFiylMnuZxfPQ%2Fimage.png?alt=media\&token=ec3cfc7c-07e7-4f38-a45a-7368a38e5f02)

* A notification message appears.
* The newly created Event gets added to the ***Private*** tab in the Events panel.

![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FcOdhG2LnCF1hUWLtrxLA%2Fimage.png?alt=media\&token=bd90d026-f80b-4fd9-a312-139fedeadaab)

### **Updating a Kafka Event**

The user can use the below-given steps to update a Kafka Event.

* Drag the created Event component to the Pipeline Editor canvas.

![Drop the Event from the event panel. ](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2F4ChKAaIt1OJZ4Ac3dL4j%2Fimage.png?alt=media\&token=19032ae1-3f6c-45b2-8de0-edcdbb958c60)

* Click the dragged Event component to open the **Basic Info** configuration field&#x73;**.**
* The user can edit the following information (except No. of Partition and Event Duration):
* Event Name: Modify the event name.
* No. of Outputs: Set the number of outputs (the maximum allowed number of outputs are 3).
* ‘Is Failover?’: Enable this option to create a failover event.
* Select Pipeline: Select one pipeline or multiple pipelines using the drop-down list.
* Click the ***Save Event*** icon to save the changes.

![Basic Info of the created event.](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FaSDd3oLupNVqLFwh5Ojl%2Fimage.png?alt=media\&token=75e9f89a-da4f-4cb5-8611-e2f17e623537)

* The user gets a notification message stating that the pipeline update is a success.
* The targeted Event component gets updated.

![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FtE6JpYo2OB9EheVMlEMY%2Fimage.png?alt=media\&token=7b15005f-e363-4534-994a-35fd5f90439b)

### **Connecting Event to a Component**

* Drag a (reader) component to the canvas.
* Configure the parameters of the dragged reader.

![Drag the Event from the Events Panel.](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2Fe8IZsKeqXAo1DEJwWToO%2Fimage.png?alt=media\&token=344b3a90-bc09-41ef-ad37-28458142b2f7)

* Drag the Event from the Events Panel.
* Connect the dragged reader component as the input connection to the dragged Event.

![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FErIo8PqQI7QEmpl0faCd%2Fimage.png?alt=media\&token=1e452578-5fe0-4c46-ac46-acd1c98e28a0)

* Click the ***Update Pipeline*** icon to save the pipeline workflow.

### Creating a DB Sync Event

* Navigate to the Pipeline Editor page.                        &#x20;
* Click the **Toggle Event Panel** <img src="https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FG8GzJmQrTYyVh9kN6xif%2Fimage.png?alt=media&#x26;token=02ab8069-aac7-4478-bef4-354fe4bdc881" alt="" data-size="line"> icon from the header.
* The Events Panel appears, and the Toggle Event Panel icon gets changed as <img src="https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FJfEl63UmdOPrshlntSBJ%2Fimage.png?alt=media&#x26;token=38db2048-7ed1-4fef-a872-e0daada43076" alt="" data-size="line">, suggesting that the event panel is displayed.
* Click on the ***DB Sync*** tab. Click on the ***Add New DB Sync*** icon from the Event Panel.

&#x20;     ![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FK8B5MDE5wDzqZgPcRhL4%2Fimage.png?alt=media\&token=632c3060-64fc-4091-b917-67c7c77cd98a)

* The **Create Data Sync** window opens.
  * Provide a display name for the new DB Sync.
  * Select Connection id: \[pre- defined by the user in the settings page]
  * Click the ***Save*** option.

&#x20;         ![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FV78gVnjLb5eM8aZPfL2r%2Fimage.png?alt=media\&token=1f5ec46e-6069-404d-a5bd-d330c12fe8a6)

* Drag and drop ***DB Sync Event*** to the workflow editor.
* Click on the dragged Data Sync component.    &#x20;

<figure><img src="https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2FrTiyZMdRnx4OWUZyn76r%2Fimage.png?alt=media&#x26;token=bb6947d0-9a00-4eeb-b79f-cff90241faf5" alt=""><figcaption></figcaption></figure>

* &#x20;The ***Basic Information*** tab appears with the following fields:

  * **Table name**: Specify table name.
  * **Driver**: this field will be pre-selected.
  * **Primary Key**: This field is optional.
  * **Save Mode**: select anyone save mode from the drop-down.              &#x20;
  * Click on the ***Save*** ***Data Sync*** icon to save the DB Sync information. &#x20;

  <figure><img src="https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2F0FLfdjDb29BSMF88lHY9%2Fimage.png?alt=media&#x26;token=4868f8a9-b253-48d6-a244-d9e8bbe27fc3" alt=""><figcaption></figcaption></figure>
* Connect the dragged ***DB Sync*** ***Event*** to the reader component as displayed below:

&#x20;    ![](https://972575688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYq1HgffNfbnIMWPu1D5%2Fuploads%2Fh7csxJ3I74X1lCugEJEs%2Fimage.png?alt=media\&token=4ae3235d-0a94-45bf-8080-5703229b3353)

{% hint style="success" %}
&#x20;**N*****ote:** In Save mode, we have two options.*

&#x20; *i. Append*

&#x20;*ii. Upsert: One extra field will be displayed for **upsert save mode** i.e.: **Composite Key.***
{% endhint %}
