I have a very simple component:

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <lightning:empApi aura:id="empApi"/>
    <aura:handler name="init" value="{!this}" action="{!c.onInit}"/>

    onInit: function(component, event, helper) {
        var empApi = component.find("empApi");
        empApi.subscribe("/topic/AccountChanges?Id=0011t0000033C9QAAU", -1, function(message) {
            console.log("Event Received : " + JSON.stringify(message));

I also have PushTopic created like this: PushTopic Screenshot

What I am trying to do, is to only receive events for specific record Id. Based on documentation this should work: "/topic/AccountChanges?Id=0011t0000033C9QAAU", but it doesn't.

"/topic/AccountChanges" works though.

I've tried Id='0011t0000033C9QAAU' aswell, but no luck.

Do you know if it is possible at all?

  • 3
    The filtered subscription doesn't even seem to be working when subscribed from say a java client using emp connector. The connection itself fails if filtered subscription is provided as an argument to the emp connector client
    – Jayant Das
    Nov 5, 2018 at 18:42

3 Answers 3


Filtering is not available for subscriptions to Change Data Capture event streams. Only PushTopic streams exposed the ability for filtered subscriptions https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/using_filtered_subscriptions.htm. We are prioritizing this work, but there the effort will require a few releases for GA.

Change Data Capture events : /data/*
PushTopic Streaming : /topic/*
Platform Events : /event/*
Generic Streaming : /u/*


There is a known bug about this issue: empapi-can-t-process-event-notifications-using-filtered-subscription-during-aura-component-initialization

The thing is that you can't do this filtered subscription during the init process of the component. As a workaround you can create a button and do the subscription from the button click.

<input type="button" value="subscribe" onclick="{!c.subscribe}" id="mybutton"/>

To automate this click you can set a timer into the init process to call the button click process, just a timer calling the subscribe on the helper didn't work for me so I had to do this workaround with the button.


In the controller include the subscribe function:

subscribe: function (component, event, helper) {
    helper.subscribe(component, event, helper);

In the helper do the subscription implementing the subscribe process as per your needs.

It's working for me. Hope it helps.

  • Does this bug still exist in 2020? Can we now use the filtering technique posed the question on the component initializer? Jan 15, 2020 at 19:26

Jayant - Sorry you encountered this error. I confirmed that this is indeed a recent issue with subscription filtering in EMP Connector and the empApi component. Salesforce is working on a fix. We have a PR for EMP Connector that fixes this problem here: https://github.com/forcedotcom/EMP-Connector/pull/43/files

  • Thanks for the update. I will definitely check it out after it is fixed.
    – diff
    Nov 13, 2018 at 13:35
  • @Katia - Do you know if this has been resolved? Seems this was encountered again, here's the reference
    – Jayant Das
    Mar 20, 2019 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.