forcedotcom / EMP-Connector

A simplified cometd connector for Enterprise Messaging Platform
BSD 3-Clause "New" or "Revised" License
185 stars 243 forks source link

Upgrade cometd library to version 8 #107

Open kubav182 opened 5 months ago

kubav182 commented 5 months ago

We need to upgrade libraries like spring boot etc. and we are forced to use jakarta packages so we need new version of jetty and cometd library.

Is upgrading to newer version of cometd in plan or is this project dead? Cometd is now at version 8, but this project is using version 4 out of support long time ago. If we stay to this version we are forced to use out of support spring versions etc.

vladokrsymphony commented 3 months ago

We have the same problem on our side, because we try to migrate to java 17.

kubav182 commented 3 months ago

we forked this project to our private git repo and private packages repo a few years ago, so finally we made the update on our own, I could create PR, but I'm afraid this project is not maintained

vladokrsymphony commented 3 months ago

We did the same on our side and we forked the project. If you could open a pull request with your changes for java 17 it would be great.

kubav182 commented 3 months ago

@vladokrsymphony I think java version itself is not an issue, we were able to run it with java 21 project (java is backward compatible), our issue was after upgrading to SB3 as it forces to use jakarta packages instead of javax. So we needed to upgrade jetty and cometd. Java is still version 8 in this lib and 21 in our project.

anhtt116 commented 3 months ago

@kubav182 So you still use SB3 in your project? And update cometd 8 and jetty 12 using java 8 in emp-connector right? Because we do the same thing but are having problems when jetty 12 httpClient.start(). It's failed to connect cometd/61.0

kubav182 commented 3 months ago

@anhtt116 this is constructor of class EmpConnector, you can compare. I'm not sure about that number 61.0, we dont specify it anywhere

public EmpConnector(BayeuxParameters parameters) {
        this.parameters = parameters;
        HttpClientTransport transport = new HttpClientTransportOverHTTP();
        httpClient = new HttpClient(transport);
        httpClient.setSslContextFactory(new SslContextFactory.Client());
        parameters.proxies().forEach(proxy -> {
            httpClient.getProxyConfiguration().addProxy(proxy);
        });
}
anhtt116 commented 3 months ago

@anhtt116 this is constructor of class EmpConnector, you can compare. I'm not sure about that number 61.0, we dont specify it anywhere

public EmpConnector(BayeuxParameters parameters) {
        this.parameters = parameters;
        HttpClientTransport transport = new HttpClientTransportOverHTTP();
        httpClient = new HttpClient(transport);
        httpClient.setSslContextFactory(new SslContextFactory.Client());
        parameters.proxies().forEach(proxy -> {
            httpClient.getProxyConfiguration().addProxy(proxy);
        });
}

Thanks. I tried with your way now It can run subscribe but error with message error -> 403::Unknown client but with this config I can run with version java 1.8. Did you get this issue @kubav182

anhtt116 commented 3 months ago

@kubav182 Did you meet the same problem?

kubav182 commented 3 months ago

@anhtt116 No I haven't seen this error. This may help you https://help.salesforce.com/s/articleView?id=001119042&type=1

yellapusony229 commented 3 months ago

@kubav182 we are trying to migrate our project to spring boot 3, but facing difficulties how to use the emp-connector. Could you share the code base that you tried and working

kubav182 commented 3 months ago

I opened PR https://github.com/forcedotcom/EMP-Connector/pull/108 we have more changes in our private repo, but not related to this library update.

anhtt116 commented 3 months ago

image I cloned your code to my local to test and I got the error not found org.eclipse.jetty.http.HttpMethod. What is the JDK version you are using for the emp-connector? And do you still load normally?

kubav182 commented 3 months ago

I can build it using java 8 or higher, jetty-http should be included in dependencies as transitive dependency, maybe some cache on your side?

image