Skip to content

522 - Kafka steram client upgrade initial change#77

Merged
kaushalaroraharman merged 3 commits into
eclipse-ecsp:feature/74-feat-upgrade-kafka-streams-version-to-410from
sanath-madhav:feature/74-feat-upgrade-kafka-streams-version-to-410
Nov 3, 2025
Merged

522 - Kafka steram client upgrade initial change#77
kaushalaroraharman merged 3 commits into
eclipse-ecsp:feature/74-feat-upgrade-kafka-streams-version-to-410from
sanath-madhav:feature/74-feat-upgrade-kafka-streams-version-to-410

Conversation

@sanath-madhav
Copy link
Copy Markdown

@sanath-madhav sanath-madhav commented Oct 28, 2025

Please refer to our contributing docs for any questions on submitting a pull request.
Issues are required for both bug fixes and features.

Resolves #522


Describe behaviour before the change

  • Behaviour unchanged, updated new upgraded api changed to existing code base

Describe behaviour after the change

Pull request checklist

  • I have read the CONTRIBUTING.md
  • My code follows the code style of this project
  • Tests for the changes have been added (for bug fixes / features)
  • All new and existing tests passed.
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

  • Yes
  • No

@kaushalaroraharman kaushalaroraharman self-requested a review October 29, 2025 06:33
@kaushalaroraharman
Copy link
Copy Markdown
Contributor

@sanath-madhav Please update the required details in the PR, such as link to ticket it resolves, section for "Describe behaviour before the change", checklist, etc.

Copy link
Copy Markdown
Contributor

@kaushalaroraharman kaushalaroraharman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments added in-line

@Override
public void write(final WriteBatch batch) throws RocksDBException {
db.write(writeOptions, batch);
public void write(final WriteBatchInterface batch) throws RocksDBException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide reason for this change from WriteBatch to WriteBatchInterface as the method parameter.

Also please document this on the design page here : https://github.com/HARMAN-Auto/sp-platform-productenablers-streambase/blob/main/docs/designs/kafka-client-upgrade-3.9.1.md, along with all the other required details for this upgrade.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface signature change

from
void write(final WriteBatch batch) throws RocksDBException
to
void write(final WriteBatchInterface batch) throws RocksDBException

if (batch instanceof WriteBatch writeBatch) {
db.write(writeOptions, writeBatch);
} else {
throw new IllegalArgumentException("Batch must be an instance of WriteBatch");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any other implementation is not supported by this method, add an error level logger as well before throwing the exception and also add the type of instance received by the method.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added error log before throwing the exception

}
} else {
batch.put(key, value);
throw new IllegalArgumentException("Batch must be an instance of WriteBatch");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment, add a logger and the type of instance received in this case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added error log before throwing the exception

effectiveConfigProps.put(KafkaConfig$.MODULE$.AutoCreateTopicsEnableProp(), true);
effectiveConfigProps.put(KafkaConfig$.MODULE$.MessageMaxBytesProp(), Constants.INT_1000000);
effectiveConfigProps.put(KafkaConfig$.MODULE$.ControlledShutdownEnableProp(), true);
effectiveConfigProps.put("broker.id", 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the documentation, this has been removed in favour of KRaft adoption.
There should be properties available in https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/KafkaConfig.scala, which can be used. Avoid hardcoding property names here, and use the one provided by Kafka client library. Only if not able to use from KafkaConfig class, you can create these in propertyNames file, whilst some would already be existing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to Constant file

final Properties effectiveBrokerConfig = effectiveBrokerConfigFrom(brokerConfig, zookeeper);
LOG.debug("Starting a Kafka instance on port {} ...",
effectiveBrokerConfig.getProperty(KafkaConfig.ListenersProp()));
effectiveBrokerConfig.getProperty("listeners"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not hardcode property names directly in the code. Either fetch from Kafka client library, if the source has changed post upgrade, or use from PropertyNames class in stream-base.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to Constant file

public String brokerList() {
final EndPoint endPoint = ((ArraySeq<EndPoint>) kafka.advertisedListeners()).head();
// Kafka 3.9.1 returns ArrayBuffer instead of ArraySeq
final scala.collection.Seq<EndPoint> listeners = kafka.advertisedListeners();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason for using the fully qualified name here instead of importing the required class?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Api has been changed

final EndPoint endPoint = ((ArrayBuffer) kafka.advertisedListeners()).head();

final EndPoint endPoint = ((ArraySeq<EndPoint>) kafka.advertisedListeners()).head();
// Kafka 3.9.1 returns ArrayBuffer instead of ArraySeq
final scala.collection.Seq<EndPoint> listeners = kafka.advertisedListeners();
final EndPoint endPoint = listeners.apply(0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are .apply(0) and .head() equivalent?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Api has been refactored

final EndPoint endPoint = ((ArrayBuffer) kafka.advertisedListeners()).head();

@sanath-madhav
Copy link
Copy Markdown
Author

@sanath-madhav Please update the required details in the PR, such as link to ticket it resolves, section for "Describe behaviour before the change", checklist, etc.

Updated the respective details

@sanath-madhav
Copy link
Copy Markdown
Author

@sanath-madhav Please update the required details in the PR, such as link to ticket it resolves, section for "Describe behaviour before the change", checklist, etc.

Updated respective details

mqttClientId, platform);
}
});
}).join();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't seem to be related to kafka streams upgrade. If fixing an existing bug, please do so in a separate PR.

@kaushalaroraharman kaushalaroraharman merged commit d2d0454 into eclipse-ecsp:feature/74-feat-upgrade-kafka-streams-version-to-410 Nov 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants