I am writing a java application where a change in Salesforce Account should hit my java application through Streaming API.I gone through various articles and I found it can be achieved through Emp connector and CometD protocol.I wanted to implement with API and normal HTTP methods without including cometD libraries.How can I do it.

  • Would you mind sharing why you wish to avoid CometD (it has a Java client) and re-implement it yourself?
    – POZ
    Commented Sep 27, 2017 at 14:30
  • Iam not supposed to use any third party application JARS.More over I have a doubt.If I use cometD how can I authenticate whether The call Is from Salesforce Or Not.Is there any authentication mechanism to authenticate a call from Salesforce to my java Application?
    – sidd zen
    Commented Sep 28, 2017 at 6:35
  • More Over the server holds my connection untill a change is done.Tis consumes a thread for evry single SOBJECT
    – sidd zen
    Commented Sep 28, 2017 at 6:55
  • The Streaming API is authenticated via OAuth just like the other Salesforce Platform APIs. There are Java OAuth clients such as Scribe that are available. Furthermore, the performance footprint of running a CometD client is not significant. I agree with @Daniel, do not try to reimplement CometD yourself as you will waste a lot of time and energy.
    – POZ
    Commented Sep 29, 2017 at 7:25

1 Answer 1


You can't currently1. The Bayeux protocal via CometD is the only push technology currently supported by Salesforce for the Streaming API.

From Bayeux Protocol, CometD, and Long Polling:

Long polling, also called Comet programming, allows emulation of an information push from a server to a client. Similar to a normal poll, the client connects and requests information from the server. However, instead of sending an empty response if information isn't available, the server holds the request and waits until information is available (an event occurs). The server then sends a complete response to the client. The client then immediately re-requests information. The client continually maintains a connection to the server, so it’s always waiting to receive a response. In the case of server timeouts, the client connects again and starts over.

  • 1 - Can't might not be the right term here. Technically you could re-implement CometD from the ground up yourself. And if you are lucky/skilled you'll end up with something much like the current CometD library.

You must log in to answer this question.

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