Thursday, May 16, 2019

Handling Platform Events in Lightning Components

The lightning:empApi component gives methods for subscribing to a streaming channel and listening to event messages. It supports all streaming channels including channels for platform events, pushTopic events and Change Data Capture events. The lightning:empApi component uses a shared CometD connection.

Note:
  • This component is available in 44.0 api version or later.
  • This is available in Lightning Experience and only supported in desktop browsers.
To call the component's methods, add the lightning:empApi component inside your custom component and assign an aura:id attribute to it.

If you want to learn more about platform events then refer below blog:

Platform Events : Way to Deliver Custom Notifications within Salesforce or to external Applications

I have created a lightning component which will subscribe to platform event "Demo_Event__e" which we have created in our previous blog.

I have created an app page using lightning app builder named as "Platform Events App Page". and added this lightning component into it.

Code Snippet:

Below is snapshot of Lightning App page before platform event is fired.

Now fire platform event using workbench through REST API call

Platform event notification received in lightning component.

Hope this will help to understand platform events handling in lightning components. 

Looking forward for everyone's suggestions and comments!!!


16 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. best texting service

    ReplyDelete
  3. When your website or blog goes live for the first time, it is exciting. That is until you realize no one but you and your. simply buzzes

    ReplyDelete
  4. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. pipedrive pricing

    ReplyDelete
  5. Thanks a lot for sharing this excellent info! I am looking forward to seeing more posts by you as soon as possible! I have judged that you do not compromise on quality. material equipements for handling

    ReplyDelete
  6. The article looks magnificent, but it would be beneficial if you can share more about the suchlike subjects in the future. Keep posting. sviluppo siti web Milano

    ReplyDelete
  7. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. 1000 Pip Builder Forex Signals Review

    ReplyDelete
  8. I would make sure the site looked professional of course, I believe that having quality photography and a clean design are the two best ways to get a professional site. I would have a very limited amount of outgoing links on my main page and NO BANNERS from directories. Webdesign

    ReplyDelete
  9. Is there a way to subscribe to platform events for a specific records updates? I am working on Account "Target Corp", and an event was published for Target Corp. Is there a way to display that the message using EMPAPi to users only working on Target Corp?

    ReplyDelete
  10. Webmasters are guaranteed to remain competitive in the online business if they stick with SEO experts. They will have all they need to ensure business success. Webdesign Limburg

    ReplyDelete
  11. Then I start to second guess myself. All of these thoughts pop into my head more than once every day, and it's an ongoing struggle to get past all the doubts and uncertainties. Webdesignprofessioneel.be

    ReplyDelete
  12. TAXPRO is a chief expert administration firm enhancing the matter of its customers for over 30 decades. We do this by giving a wide array of administrations in the monetary space which ranges from Entry Level Strategy, Taxation consultancy administrations, GST, Audit and Assurance, Accounting, Corporate Compliance, Payroll Services, ESI/PF Consultancy, and part more. We are a group of expense experts that incorporates Chartered Accountants, Advocates, Company Secretaries, Financial counselors offering marketing for accounting to the makers, Traders, Dealers, and specialist organizations of the business. Our administrations are looked for different business, lawful, and tax assessment confusions.

    ReplyDelete
  13. TAXPRO is a chief expert administration firm enhancing the matter of its customers for over 30 decades. We do this by giving a wide array of administrations in the monetary space which ranges from Entry Level Strategy, Taxation consultancy administrations, GST, Audit and Assurance, Accounting, Corporate Compliance, Payroll Services, ESI/PF Consultancy, and part more. We are a group of expense experts that incorporates Chartered Accountants, Advocates, Company Secretaries, Financial counselors offering taxpro to the makers, Traders, Dealers, and specialist organizations of the business. Our administrations are looked for different business, lawful, and tax assessment confusions.

    ReplyDelete
  14. However, most companies will not support sites in which the client has made changes to the original code. Make sure to discuss this during your initial consultation. Webdesigner Antwerpen

    ReplyDelete
  15. At the point when the youthful couple withdrew for their special night, my mom, I, Rupert's mom and sibling, all hosted a calm gathering among ourselves, to pay tribute to the achievement of the wedding that had occurred. My mom encouraged me to get hitched and settle down and surprisingly guaranteed me that she would toss as beautiful a gathering for me as she had tossed for Daniela. The entire event was unrealistic, similar to a fantasy that left us, groups of the couple, pretty overpowered.420 events nj

    ReplyDelete