Useful new feature, GA Summer'16. I like it.

While I can successfully consume streaming api via java client, no problems, I am unable to take advantage of this new replay option with my java client.

My starting point: SFDC has kindly provided java and javascript client extensions here: https://github.com/developerforce/StreamingReplayClientExtensions

Fine, but this thing won't even compile. The compiler is very clear about the issue:

$javac CometDReplayExtension.java
CometDReplayExtension.java:35: error: cannot find symbol
import org.cometd.bayeux.client.ClientSession.Extension.Adapter;

So to recap, the java extension provided by SFDC references this resource, but this resource is not included or linked to anywhere in SFDC docs. Fine. Maybe they missed. I believe I tracked the right resource down in the cometd jar (direct download from cometd) but even after including this resource in the proper build path I am not able to compile. Same compiler objection, unable to find symbol.

Has anyone been able to successfully implement replay using a java client? Which resource did you use for for your Adapter? SFDC does not provide one, even though their code references this resource.

SFDC docs, fyi:

  • Am I really this bleeding-edge? No one else has attempted new replay option via java client?
    – krigi
    Sep 23, 2016 at 20:26
  • Do you have the latest source for CometDReplayExtension.java? I only ask as line 35 is now a different import statement. Things were changing in GitHub 6 days ago - vs. the 4 days ago that this question was asked. Sep 27, 2016 at 1:45
  • 1
    Yes, most definitely my java resources are current per github. I am using the latest version of CometDReplayExtension.java.
    – krigi
    Sep 27, 2016 at 2:10
  • OK, that rules that out. You mention that you are using a recent version of cometd. Is it 3.0.9 or higher? Most of the online docs for the Adapter class suggest is appears in that version or later. Sep 27, 2016 at 8:44
  • Yes. I'm current.
    – krigi
    Sep 28, 2016 at 4:00

2 Answers 2


The issue was with the datamp which I was sending to cometdReplayExtension. I was using the wrong key to send the replayid.To send the datamap, Use channel name as key and replayid name as value. Now everything works fine for me.

  • That is good to hear! Please better summarize your answer with these details, and I'll accept your answer!
    – krigi
    Oct 19, 2016 at 23:40
  • 2
    First I changed the Streaming code to be compatible with the extension provided by salesforce. Then I used the code as below to create the BayeuxClient: Map<String,Long> replayMap = new HashMap<String,Long>(); replayMap.put(CHANNEL,Long.parseLong("<any replayid within 24 hours>")); client.addExtension(new CometDReplayExtension<>(replayMap));
    – Abinash
    Oct 20, 2016 at 11:45
  • Were you able to rectify it or still you are facing the issue?
    – Abinash
    Oct 21, 2016 at 12:15

For your question related to building issue, I have used cometD java version 3.0.10 and jetty-client version 9.2.19.v20160908 and I was not facing any issue while building. I am still working on new code which uses jetty version 9.2.19 for httpclient objetcs.(This code is not provided in salesforce doc.).

If you want to look for further insvestigation Apache camel is also using same code which is shared in documentation in salesforce.

  • are you saying that you have successfully implemented the replay / durable events functionality with a java client? And to do so, you used cometD 3.0.10 and jetty client 9.2.19.v20160908? Did you have to update the SFDC-provided code?
    – krigi
    Sep 28, 2016 at 17:29
  • No , I am saying that I did not get any issue while building the provided CometDReplayExtension. But since this new code is using the new comet+jetty library, I will have to update the httpclient(Using jetty-client lib) code .Since I can not do comment here as I do not have priviledge to do that, I can not post my answar as comment.
    – Abinash
    Sep 29, 2016 at 5:06
  • ok, so you are using the answer section to add a comment. This is not, in fact, an intended answer?
    – krigi
    Sep 29, 2016 at 16:37
  • I updated the streaming code to be compatible with the provided extension version but it is still not working.It is still showing the events with are currently being updated as client code is connected and not showing the past 24 hours events based on the replayid.Some salesforce person has to rectify it.
    – Abinash
    Sep 30, 2016 at 6:38
  • I am hearing you say "I cannot get replay events/ durable push topics to work either", correct? It is not clear to me what you did. Please clarify. You updated CometDReplayExtension.java so that it compiles against cometd 2.3.1 and jetty-hightide-7.4.4.v20110707 ? But you noticed that it does not serve up replay information?
    – krigi
    Sep 30, 2016 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .