Samples for JCSMP use deprecated classes
I just faced today when looking at JCSMP samples for publishing e.g. to topic that samples
here:
https://tutorials.solace.dev/jcsmp/publish-subscribe/
+
https://github.com/SolaceSamples/solace-samples-java-jcsmp/blob/master/src/main/java/com/solace/samples/jcsmp/features/TopicPublisher.java
to not get adapted to a latest version of library.
The JCSMPStreamingPublishEventHandler got deprecated and now points to use:
JCSMPStreamingPublishCorrelatingEventHandler
I recommend to verify and run your samples you provide towards latest version of libraries to detect usage of deprecated functionality. If found it should get replaced to avoid confusion.
Comments
-
Hi @Robert . Yeah, during the GitHub repo migration where we were moving JCSMP samples due our new Java API, some of the older samples got copied over "as-is" and I didn't go back and fix the deprecation issues.
If looking for a better topic publisher sample, start here: https://github.com/SolaceSamples/solace-samples-java-jcsmp/blob/master/src/main/java/com/solace/samples/jcsmp/patterns/DirectPublisher.java or https://github.com/SolaceSamples/solace-samples-java-jcsmp/blob/master/src/main/java/com/solace/samples/jcsmp/patterns/GuaranteedPublisher.java
0 -
Fixed the samples, and submitted a PR, if anyone wants to take a look at it: https://github.com/SolaceSamples/solace-samples-java-jcsmp/pull/72
0 -
@Aaron Many thanks, that was for fixing the one issue. Can you bring up to have a process that this is done automatically. Meaning any solace sample should be tested automated towards new releases.
If deprecated usage is found it should pop up rewritten to new ways.Like that you would never have samples which deviate from working with latest version of libs.
0 -
@Aaron As well consider not only GIT HUB. The same problem is on the hands on pages in solace it self. So as well here it makes use of deprecated classes.
0 -
JCSMPStreamingPublishCorrelatingEventHandler should have been made generic based on object type auto parsing.
0 -
@KumarAbhishek what do you mean? Generic how..? The
JCSMPStreamingPublishCorrelatingEventHandler
has been around for about 10 years, probably might have done things differently.The new Java API has a dedicated class for correlating published Guaranteed messages: https://docs.solace.com/API-Developer-Online-Ref-Documentation/pubsubplus-java/com/solace/messaging/publisher/PersistentMessagePublisher.PublishReceipt.html
0 -
@Aaron is the purpose of PersistentMessagePublisher and
JCSMPStreamingPublishCorrelatingEventHandler
Same ?My question was while using
JCSMPStreamingPublishCorrelatingEventHandler
public void responseReceived instead of Object if we make Generic Java <T> Generics then the parser would know what kind of binding is expected.0