How to clear/delete published Platform event from EventBus after sometime?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















I'm publishing Platform Events using APEX Code
EventBus.publish method and consuming the events in backend Java app using EventListener.



Problem



All the published events remains in EventBus and whenever my consumer Java app restarts, listener is receiving all the previously published events (in the past 24 hrs?, not sure about the timing though).



Is there any way to clear the events published to EventBus after some set interval? I've gone through the Platform Events documentation and couldn't find any help to tackle this problem.



Any pointer would be helpful










share|improve this question





























    2















    I'm publishing Platform Events using APEX Code
    EventBus.publish method and consuming the events in backend Java app using EventListener.



    Problem



    All the published events remains in EventBus and whenever my consumer Java app restarts, listener is receiving all the previously published events (in the past 24 hrs?, not sure about the timing though).



    Is there any way to clear the events published to EventBus after some set interval? I've gone through the Platform Events documentation and couldn't find any help to tackle this problem.



    Any pointer would be helpful










    share|improve this question

























      2












      2








      2








      I'm publishing Platform Events using APEX Code
      EventBus.publish method and consuming the events in backend Java app using EventListener.



      Problem



      All the published events remains in EventBus and whenever my consumer Java app restarts, listener is receiving all the previously published events (in the past 24 hrs?, not sure about the timing though).



      Is there any way to clear the events published to EventBus after some set interval? I've gone through the Platform Events documentation and couldn't find any help to tackle this problem.



      Any pointer would be helpful










      share|improve this question














      I'm publishing Platform Events using APEX Code
      EventBus.publish method and consuming the events in backend Java app using EventListener.



      Problem



      All the published events remains in EventBus and whenever my consumer Java app restarts, listener is receiving all the previously published events (in the past 24 hrs?, not sure about the timing though).



      Is there any way to clear the events published to EventBus after some set interval? I've gone through the Platform Events documentation and couldn't find any help to tackle this problem.



      Any pointer would be helpful







      apex subscriber platform-event publisher






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 16:14









      jusermar10jusermar10

      1133




      1133






















          2 Answers
          2






          active

          oldest

          votes


















          4














          This is a feature called Event Durability. It is expected that the client retains the last replayId it has seen, and pass this in to the streaming handshake to resume where they left off. There's no way to clear this early and yet provide durability. The events do drop off after 24 hours. You will need to modify your code to remember the last replayId.






          share|improve this answer
























          • Got it! Thanks for pointing me in the right direction to track replayId. Will play around.

            – jusermar10
            Nov 16 '18 at 16:26



















          1














          You cannot delete Platform Event records. This is mentioned in the documentation:




          Unlike custom objects, you can’t update or delete event records.




          The only way you can delete event records is by deleting its definition altogether:




          When you delete a platform event definition, it’s permanently deleted.







          share|improve this answer





















          • 1





            +1 lol you beat me by 6 seconds!

            – codeyinthecloud
            Nov 16 '18 at 16:18














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "459"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f239645%2fhow-to-clear-delete-published-platform-event-from-eventbus-after-sometime%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          This is a feature called Event Durability. It is expected that the client retains the last replayId it has seen, and pass this in to the streaming handshake to resume where they left off. There's no way to clear this early and yet provide durability. The events do drop off after 24 hours. You will need to modify your code to remember the last replayId.






          share|improve this answer
























          • Got it! Thanks for pointing me in the right direction to track replayId. Will play around.

            – jusermar10
            Nov 16 '18 at 16:26
















          4














          This is a feature called Event Durability. It is expected that the client retains the last replayId it has seen, and pass this in to the streaming handshake to resume where they left off. There's no way to clear this early and yet provide durability. The events do drop off after 24 hours. You will need to modify your code to remember the last replayId.






          share|improve this answer
























          • Got it! Thanks for pointing me in the right direction to track replayId. Will play around.

            – jusermar10
            Nov 16 '18 at 16:26














          4












          4








          4







          This is a feature called Event Durability. It is expected that the client retains the last replayId it has seen, and pass this in to the streaming handshake to resume where they left off. There's no way to clear this early and yet provide durability. The events do drop off after 24 hours. You will need to modify your code to remember the last replayId.






          share|improve this answer













          This is a feature called Event Durability. It is expected that the client retains the last replayId it has seen, and pass this in to the streaming handshake to resume where they left off. There's no way to clear this early and yet provide durability. The events do drop off after 24 hours. You will need to modify your code to remember the last replayId.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 16:21









          sfdcfoxsfdcfox

          265k13211458




          265k13211458













          • Got it! Thanks for pointing me in the right direction to track replayId. Will play around.

            – jusermar10
            Nov 16 '18 at 16:26



















          • Got it! Thanks for pointing me in the right direction to track replayId. Will play around.

            – jusermar10
            Nov 16 '18 at 16:26

















          Got it! Thanks for pointing me in the right direction to track replayId. Will play around.

          – jusermar10
          Nov 16 '18 at 16:26





          Got it! Thanks for pointing me in the right direction to track replayId. Will play around.

          – jusermar10
          Nov 16 '18 at 16:26













          1














          You cannot delete Platform Event records. This is mentioned in the documentation:




          Unlike custom objects, you can’t update or delete event records.




          The only way you can delete event records is by deleting its definition altogether:




          When you delete a platform event definition, it’s permanently deleted.







          share|improve this answer





















          • 1





            +1 lol you beat me by 6 seconds!

            – codeyinthecloud
            Nov 16 '18 at 16:18


















          1














          You cannot delete Platform Event records. This is mentioned in the documentation:




          Unlike custom objects, you can’t update or delete event records.




          The only way you can delete event records is by deleting its definition altogether:




          When you delete a platform event definition, it’s permanently deleted.







          share|improve this answer





















          • 1





            +1 lol you beat me by 6 seconds!

            – codeyinthecloud
            Nov 16 '18 at 16:18
















          1












          1








          1







          You cannot delete Platform Event records. This is mentioned in the documentation:




          Unlike custom objects, you can’t update or delete event records.




          The only way you can delete event records is by deleting its definition altogether:




          When you delete a platform event definition, it’s permanently deleted.







          share|improve this answer















          You cannot delete Platform Event records. This is mentioned in the documentation:




          Unlike custom objects, you can’t update or delete event records.




          The only way you can delete event records is by deleting its definition altogether:




          When you delete a platform event definition, it’s permanently deleted.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 16 '18 at 16:20

























          answered Nov 16 '18 at 16:18









          Jayant DasJayant Das

          18.3k21330




          18.3k21330








          • 1





            +1 lol you beat me by 6 seconds!

            – codeyinthecloud
            Nov 16 '18 at 16:18
















          • 1





            +1 lol you beat me by 6 seconds!

            – codeyinthecloud
            Nov 16 '18 at 16:18










          1




          1





          +1 lol you beat me by 6 seconds!

          – codeyinthecloud
          Nov 16 '18 at 16:18







          +1 lol you beat me by 6 seconds!

          – codeyinthecloud
          Nov 16 '18 at 16:18




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Salesforce Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f239645%2fhow-to-clear-delete-published-platform-event-from-eventbus-after-sometime%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Error while running script in elastic search , gateway timeout

          Adding quotations to stringified JSON object values