63
63
import org .oracle .okafka .clients .KafkaClient ;
64
64
import org .oracle .okafka .clients .Metadata ;
65
65
import org .oracle .okafka .clients .NetworkClient ;
66
+ import org .oracle .okafka .clients .TopicTeqParameters ;
66
67
import org .oracle .okafka .clients .consumer .KafkaConsumer .FetchManagerMetrics ;
67
68
import org .oracle .okafka .clients .consumer .internals .SubscriptionState .FetchPosition ;
68
69
import org .apache .kafka .clients .RequestCompletionHandler ;
@@ -250,7 +251,9 @@ public void onComplete(ClientResponse response) {
250
251
Node node = poll .getKey ();
251
252
log .debug ("Fetch Records for topic " + poll .getValue () + " from host " + node );
252
253
String topic = poll .getValue ();
253
- if (metadata .topicParaMap .get (topic ).getStickyDeq () != 2 ) {
254
+ TopicTeqParameters teqParam = metadata .topicParaMap .get (topic );
255
+ int stickyDeqParam = teqParam != null ? teqParam .getStickyDeq (): 2 ;
256
+ if (stickyDeqParam == 0 ) {
254
257
String errMsg = "Topic " + topic + " is not an Oracle kafka topic, Please drop and re-create topic"
255
258
+" using Admin.createTopics() or dbms_aqadm.create_database_kafka_topic procedure" ;
256
259
throw new InvalidTopicException (errMsg );
@@ -278,7 +281,7 @@ public void onComplete(ClientResponse response) {
278
281
279
282
return this .messages ;
280
283
}
281
-
284
+
282
285
/**
283
286
*
284
287
* @return map of <node , topic> . Every node is leader for its corresponding topic.
@@ -397,7 +400,6 @@ private void joinGroupifNeeded(ClientResponse response, long timeoutMs) {
397
400
long elapsed = response .requestLatencyMs ();
398
401
long prevTime = time .milliseconds ();
399
402
long current ;
400
-
401
403
while (elapsed < timeoutMs && rejoinNeeded (exception )) {
402
404
log .debug ("JoinGroup Is Needed" );
403
405
if (needsJoinPrepare ) {
@@ -415,6 +417,7 @@ private void joinGroupifNeeded(ClientResponse response, long timeoutMs) {
415
417
elapsed = elapsed + (current - prevTime );
416
418
prevTime = current ;
417
419
}
420
+
418
421
} catch (Exception e )
419
422
{
420
423
log .error (e .getMessage (), e );
@@ -691,7 +694,6 @@ public boolean mayBeTriggerSubcription(long timeout) {
691
694
692
695
if (!subscriptions .subscription ().equals (subscriptionSnapshot )) {
693
696
boolean noSubExist = false ;
694
- rejoin = true ;
695
697
String topic = getSubscribableTopics ();
696
698
long now = time .milliseconds ();
697
699
Node node = client .leastLoadedNode (now );
0 commit comments