To handle notifications from a SQL Server database, GRAVITY uses the database’s Service Broker mechanism. GRAVITY monitors the specified table in the database and, when a change occurs in that table, invokes the trigger with parameters corresponding to the record that was modified.
For example, if the database contains a table with the following structure:
CREATE TABLE [dbo].[articles](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](50) NULL,
CONSTRAINT [PK_articles] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]and a record with id=4 is modified, the trigger will invoke the project with parameters such as:
id=4
name="article 1"If the project defines parameters corresponding to these fields, they will be populated automatically and can be used during data processing.
Database Server Configuration
The database server requires the Service Broker feature to be enabled. Execute the following command on the database:
ALTER DATABASE [ETL_TEST] SET ENABLE_BROKERGRAVITY System Configuration
- When configuring the trigger for the project, after selecting a SQL Server–based connection, choose the table you want to monitor.
- Use parameters named after the columns of that table in the project that will be invoked by the trigger.