Forum Discussion

lyancy's avatar
lyancy
New Member
1 month ago
Solved

Heartbeat Action Query Not Sent to Source

I created an Eventstream with Postgre SQL CDC as source. I want to use heartbeat action query to ensure that Eventstream to keep the replication slot size low in source. There is no issue/error in the Eventstream but the heartbeat query is never been sent to source. Is there a configuration I missed?

 

This is the table that I created and the initial value: 

CREATE TABLE public.debezium_heartbeat (

    id SERIAL PRIMARY KEY,

    timestamp TIMESTAMP WITH TIME ZONE

);

INSERT INTO public.debezium_heartbeat (id, timestamp) VALUES (1, now());

 

This is the heartbeat action query that I put on the Eventstream source:

UPDATE public.debezium_heartbeat SET timestamp = now() WHERE id = 1

  • Hello lyancy ,

    I'm not able to test this myself, unfortunately.

    Just to be sure that this is not a misconfiguration or a glitch in the background, recreating the same logic in a new eventstream is recommended.

    If this does not help, and because the configuration discussed is quite generic, creating a ticket for support from Microsoft would be the next step.

7 Replies

  • Hello lyancy 

     

    welcome to this Fabric community forum.

     

    You want to enter the heartbeat query for this PostgreSQL connection:

    This query depends on a table in the source database, as you mentioned already.

     

    The documentation does not provide a real sample:

     

    I have no hands-on experience with this database, but I did some research that could help you out.

     

    It seems your solution should work because it looks a lot like this idempotent call:

    CREATE TABLE public.test_heartbeat_table (
        id integer primary key,
        last_seen timestamptz not null
    );
    
    INSERT INTO public.test_heartbeat_table (id, last_seen)
    VALUES (1, now());
    
    [idempotent call]
    UPDATE public.test_heartbeat_table
    SET last_seen = now()
    WHERE id = 1;

     

    A simplified alternative table and call could look like:

    CREATE TABLE public.test_heartbeat_table (
        id bigserial primary key,
        text text not null,
        created_at timestamptz not null default now()
    );
    
    INSERT INTO public.test_heartbeat_table (text)
    VALUES ('test_heartbeat');

     

    I found this post, which could be linked. There, a more elaborate solution is proposed:

    INSERT INTO my_schema.fabric_heartbeat (id, heartbeat_ts) 
    VALUES (1, NOW()) 
    ON CONFLICT(id) 
    DO UPDATE SET heartbeat_ts = EXCLUDED.heartbeat_ts;

     

    These are three possible solutions that could hopefully point you in the right direction.

     

    Please let us know which actually works for you.

     

    ---

    If this answer helps you, marking it as the accepted answer is appreciated. All community members with similar questions will benefit by doing so. Your contribution is highly appreciated.

     

     

    • lyancy's avatar
      lyancy
      New Member

      Hi svelde,

       

      Thank you for the solution options you shared.

       

      I tested for the other two heartbeat query and the issue is still the same. The Eventstream has been active for about 5 hours and nothing has been sent to the heartbeat table. Is there maybe a configuration regarding the heartbeat interval?

    • lyancy's avatar
      lyancy
      New Member

      Hi svelde

       

      Thank you for the solution options you shared.

       

      I tested for the other two heartbeat query and the issue is still the same. The Eventstream has been active for about 5 hours and nothing has been sent to the heartbeat table. Is there maybe a configuration regarding the heartbeat interval?

      • svelde's avatar
        svelde
        Super User

        Hello lyancy ,

        I'm not able to test this myself, unfortunately.

        Just to be sure that this is not a misconfiguration or a glitch in the background, recreating the same logic in a new eventstream is recommended.

        If this does not help, and because the configuration discussed is quite generic, creating a ticket for support from Microsoft would be the next step.

  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Thankyou, svelde for your response.

    Hi lyancy,

    We appreciate your inquiry through the Microsoft Fabric Community Forum.

    We would like to inquire whether have you got the chance to check the solution provided by svelde to resolve the issue. We hope the information provided helps to clear the query. Should you have any further queries, kindly feel free to contact the Microsoft Fabric community.

    Thank you.

  • Hi,

    Your heartbeat table and UPDATE statement look correct, so if the Eventstream is running without errors but the heartbeat query is never executed, it may not be a SQL issue.

    A few things I'd recommend checking:

    • Verify that Heartbeat is actually enabled for the PostgreSQL CDC source and that the heartbeat interval is configured as expected.

    • Confirm that the PostgreSQL user configured for CDC has sufficient permissions to execute the UPDATE statement on the debezium_heartbeat table.

    • Check whether the heartbeat action is only triggered when the connector is actively polling for changes. If there is no CDC activity, the connector's behavior may differ depending on the implementation.

    • Review the Eventstream logs (if available) and PostgreSQL logs to see whether the heartbeat query is being attempted or skipped entirely.

    To help narrow it down:

    • Which PostgreSQL version are you using?

    • Is the source Azure Database for PostgreSQL or self-managed PostgreSQL?

    • Does normal CDC capture work correctly, with only the heartbeat action failing?

    If everything is configured correctly and the heartbeat query is still never reaches the source, this may be a product issue. In that case, I'd recommend opening a Microsoft Support ticket with:

    • Workspace and Eventstream details

    • PostgreSQL version

    • Source type

    • Connector configuration

    • The heartbeat interval and action query

    • Relevant timestamps

    If Microsoft identifies the root cause or provides a workaround, please consider sharing it here. It would be very helpful for others using PostgreSQL CDC with Eventstream heartbeat actions.

    If you found this reply helpful, please consider giving it a Kudos. If it helps resolve your issue, marking it as the Accepted Solution will help other community members facing the same problem.