Skip to content

Commit

Permalink
Merge branch 'master' into 57-docs-topic-name-uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
pasimoes committed Oct 4, 2024
2 parents b267192 + b8f67a0 commit d73eac9
Show file tree
Hide file tree
Showing 7 changed files with 690 additions and 655 deletions.
24 changes: 11 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ allprojects {
}

group = 'org.oracle.okafka'
version = '23.4.0.0'
version = '23.5.0.0'

tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
// noinspection SpellCheckingInspection
title ="Oracle Kafka 23.4.0.0 API"
title ="Oracle Kafka 23.5.0.0 API"
options.addStringOption('Xdoclint:none', '-quiet')
options.windowTitle = "Oracle Database Transactional Event Queues Java API Reference"
options.header = """<b>Oracle&reg; Database Transactional Event Queues Java API Reference<br>23ai</b><br>FF46992-04<br>"""
Expand All @@ -33,7 +33,7 @@ allprojects {

ext {
gradleVersion = '8.8'
minJavaVersion = JavaVersion.VERSION_17
minJavaVersion = JavaVersion.VERSION_11

mavenUrl = project.hasProperty('mavenUrl') ? project.mavenUrl : ''
mavenUsername = project.hasProperty('mavenUsername') ? project.mavenUsername : ''
Expand All @@ -54,7 +54,7 @@ project(':clients') {
}
}

println 'Building okafka 23.4.0.0 Java API jar'
println 'Building okafka 23.5.0.0 Java API jar'

dependencies {

Expand All @@ -65,16 +65,14 @@ project(':clients') {
implementation group: 'javax.jms', name: 'javax.jms-api', version: '2.0'
implementation group: 'com.oracle.database.security', name: 'oraclepki', version: '23.4.0.24.05'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.0-alpha0'
implementation group: 'org.apache.kafka', name: 'kafka-clients', version: '3.7.1'
// Use JUnit test framework
implementation group: 'junit', name: 'junit', version: '4.12'

implementation group: 'org.apache.kafka', name: 'kafka-clients', version: '3.7.1'

// Test dependencies
testImplementation group: 'org.easymock', name: 'easymock', version: '3.6'
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.0-beta.5'
testImplementation group: 'org.powermock', name: 'powermock-api-support', version: '2.0.5'
testImplementation group: 'org.powermock', name: 'powermock-api-easymock', version: '2.0.0-beta.5'

testImplementation group: 'junit', name: 'junit', version: '4.12'
}

javadoc {
Expand All @@ -85,9 +83,9 @@ project(':clients') {
}

tasks.named('jar') {
description('Generates okafka 23.4.0.0 API jar ')
description('Generates okafka 23.5.0.0 API jar ')
archiveBaseName = 'okafka'
archiveVersion = '23.4.0.0'
archiveVersion = '23.5.0.0'

from "${rootProject.projectDir}/LICENSE.txt"
from "${rootProject.projectDir}/NOTICE"
Expand All @@ -96,7 +94,7 @@ project(':clients') {
attributes (
'Implementation-Title' : 'okafka',
'Implementation-Version': project.version,
'Version': '23.4.0.0',
'Version': '23.5.0.0',
'Build-Time-ISO-8601':new Date().format("yyyy-MM-dd HH:mm:ss")
)
}
Expand Down Expand Up @@ -218,4 +216,4 @@ dependencies {
task multiProjectJar (type: Jar, dependsOn: configurations.childJar) {
description 'Generates a jar containing okafka client, all its dependencies and examples for okafka demo'
from { configurations.childJar.collect { zipTree(it) } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1598,14 +1598,15 @@ private static boolean groupIdIsUnrepresentable(String groupId) {
public CreateTopicsResult createTopics(final Collection<NewTopic> newTopics, final CreateTopicsOptions options) {
final Map<String, KafkaFutureImpl<TopicMetadataAndConfig>> topicFutures = new HashMap<>(newTopics.size());
final Map<String, CreateTopicsRequest.TopicDetails> topicsMap = new HashMap<>(newTopics.size());

for (NewTopic newTopic : newTopics) {
if (topicNameIsUnrepresentable(newTopic.name())) {
KafkaFutureImpl<TopicMetadataAndConfig> future = new KafkaFutureImpl<>();
future.completeExceptionally(new InvalidTopicException(
"The given topic name '" + newTopic.name() + "' cannot be represented in a request."));
topicFutures.put(newTopic.name(), future);
} else if (!topicFutures.containsKey(newTopic.name())) {
topicFutures.put(newTopic.name(), new KafkaFutureImpl<TopicMetadataAndConfig>());
topicFutures.put(newTopic.name().toUpperCase(), future);
} else if (!topicFutures.containsKey(newTopic.name().toUpperCase())) {
topicFutures.put(newTopic.name().toUpperCase(), new KafkaFutureImpl<TopicMetadataAndConfig>());
TopicDetails topicDetails = null;

if (newTopic.replicasAssignments() != null) {
Expand All @@ -1622,7 +1623,7 @@ public CreateTopicsResult createTopics(final Collection<NewTopic> newTopics, fin
topicDetails = new TopicDetails(newTopic.numPartitions(), newTopic.replicationFactor());
}
}
topicsMap.put(newTopic.name(), topicDetails);
topicsMap.put(newTopic.name().toUpperCase(), topicDetails);
}
}
final long now = time.milliseconds();
Expand Down Expand Up @@ -1693,17 +1694,21 @@ public DeleteTopicsResult deleteTopics(Collection<String> topicNames, DeleteTopi

public org.oracle.okafka.clients.admin.DeleteTopicsResult deleteTopics(Collection<String> topicNames,
org.oracle.okafka.clients.admin.DeleteTopicsOptions options) {

final Map<String, KafkaFutureImpl<Void>> topicFutures = new HashMap<>(topicNames.size());
final List<String> validTopicNames = new ArrayList<>(topicNames.size());

for (String topicName : topicNames) {
if (topicNameIsUnrepresentable(topicName)) {

KafkaFutureImpl<Void> future = new KafkaFutureImpl<>();
future.completeExceptionally(new InvalidTopicException(
"The given topic name '" + topicName + "' cannot be represented in a request."));
topicFutures.put(topicName, future);
} else if (!topicFutures.containsKey(topicName)) {
topicFutures.put(topicName, new KafkaFutureImpl<Void>());
validTopicNames.add(topicName);
topicFutures.put(topicName.toUpperCase(), future);

} else if (!topicFutures.containsKey(topicName.toUpperCase())) {
topicFutures.put(topicName.toUpperCase(), new KafkaFutureImpl<Void>());
validTopicNames.add(topicName.toUpperCase());
}
}
final long now = time.milliseconds();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,19 +739,25 @@ public void subscribe(Collection<String> topics, ConsumerRebalanceListener liste
try {
if (topics == null) {
throw new IllegalArgumentException("Topic collection to subscribe to cannot be null");

} else if (topics.isEmpty()) {
// treat subscribing to empty topic list as the same as unsubscribing
this.unsubscribe();
} else {
if (topics.size() > 1)
throw new IllegalArgumentException("Only one topic can be subscribed");


Collection<String> topicsUp = new ArrayList<String>(topics.size());

for (String topic : topics) {
if (topic == null || topic.trim().isEmpty())
throw new IllegalArgumentException(
"Topic collection to subscribe to cannot contain null or empty topic");

topicsUp.add(topic.toUpperCase());
}

topics = topicsUp;

// Only one topic can be subscribed, unsubcribe to previous topics before
// subscribing to new topic
Set<String> Alltopics = subscriptions.metadataTopics();
Expand All @@ -765,7 +771,6 @@ public void subscribe(Collection<String> topics, ConsumerRebalanceListener liste
// metadata.setTopics(subscriptions.groupSubscription());
// Change for 2.8.1 groupSubscription() is not present any more
metadata.setTopics(subscribedTopicSet);

}
} finally {
release();
Expand Down
Loading

0 comments on commit d73eac9

Please sign in to comment.