@@ -1116,56 +1116,108 @@ public void setRecordObservationsInBatch(boolean recordObservationsInBatch) {
11161116
11171117 @ Override
11181118 public String toString () {
1119- return "ContainerProperties ["
1120- + renderProperties ()
1121- + "\n ackMode=" + this .ackMode
1122- + "\n ackCount=" + this .ackCount
1123- + "\n ackTime=" + this .ackTime
1124- + "\n consumerStartTimeout=" + this .consumerStartTimeout
1125- + "\n messageListener=" + this .messageListener
1126- + (this .listenerTaskExecutor != null
1127- ? "\n listenerTaskExecutor=" + this .listenerTaskExecutor
1128- : "" )
1129- + "\n shutdownTimeout=" + this .shutdownTimeout
1130- + "\n idleEventInterval="
1131- + (this .idleEventInterval == null ? "not enabled" : this .idleEventInterval )
1132- + "\n idlePartitionEventInterval="
1133- + (this .idlePartitionEventInterval == null ? "not enabled" : this .idlePartitionEventInterval )
1134- + (this .transactionManager != null
1135- ? "\n transactionManager=" + this .transactionManager
1136- : "" )
1137- + (this .kafkaAwareTransactionManager != null
1138- ? "\n kafkaAwareTransactionManager=" + this .kafkaAwareTransactionManager
1139- : "" )
1140- + "\n monitorInterval=" + this .monitorInterval
1141- + (this .scheduler != null ? "\n scheduler=" + this .scheduler : "" )
1142- + "\n noPollThreshold=" + this .noPollThreshold
1143- + "\n pauseImmediate=" + this .pauseImmediate
1144- + "\n pollTimeoutWhilePaused=" + this .pollTimeoutWhilePaused
1145- + "\n subBatchPerPartition=" + this .subBatchPerPartition
1146- + "\n assignmentCommitOption=" + this .assignmentCommitOption
1147- + "\n deliveryAttemptHeader=" + this .deliveryAttemptHeader
1148- + "\n batchRecoverAfterRollback=" + this .batchRecoverAfterRollback
1149- + "\n eosMode=" + this .eosMode
1150- + "\n transactionDefinition=" + this .transactionDefinition
1151- + "\n stopContainerWhenFenced=" + this .stopContainerWhenFenced
1152- + "\n stopImmediate=" + this .stopImmediate
1153- + "\n asyncAcks=" + this .asyncAcks
1154- + "\n logContainerConfig=" + this .logContainerConfig
1155- + "\n missingTopicsFatal=" + this .missingTopicsFatal
1156- + "\n idleBeforeDataMultiplier=" + this .idleBeforeDataMultiplier
1157- + "\n idleBetweenPolls=" + this .idleBetweenPolls
1158- + "\n micrometerEnabled=" + this .micrometerEnabled
1159- + "\n observationEnabled=" + this .observationEnabled
1160- + (this .observationConvention != null
1161- ? "\n observationConvention=" + this .observationConvention
1162- : "" )
1163- + (this .observationRegistry != null
1164- ? "\n observationRegistry=" + this .observationRegistry
1165- : "" )
1166- + "\n restartAfterAuthExceptions=" + this .restartAfterAuthExceptions
1167- + "\n recordObservationsInBatch=" + this .recordObservationsInBatch
1168- + "\n ]" ;
1119+ StringBuilder sb = new StringBuilder ("ContainerProperties [" );
1120+ sb .append (renderProperties ());
1121+
1122+ // Core acknowledgment properties
1123+ appendProperty (sb , "ackMode" , this .ackMode );
1124+ appendProperty (sb , "ackCount" , this .ackCount );
1125+ appendProperty (sb , "ackTime" , this .ackTime );
1126+
1127+ // Timeout and startup properties
1128+ appendProperty (sb , "consumerStartTimeout" , this .consumerStartTimeout );
1129+ appendProperty (sb , "shutdownTimeout" , this .shutdownTimeout );
1130+
1131+ // Listener configuration
1132+ appendOptionalProperty (sb , "messageListener" , this .messageListener );
1133+ appendOptionalProperty (sb , "listenerTaskExecutor" , this .listenerTaskExecutor );
1134+
1135+ // Idle event configuration
1136+ appendEnabledProperty (sb , "idleEventInterval" , this .idleEventInterval );
1137+ appendEnabledProperty (sb , "idlePartitionEventInterval" , this .idlePartitionEventInterval );
1138+
1139+ // Transaction management
1140+ appendOptionalProperty (sb , "transactionManager" , this .transactionManager );
1141+ appendOptionalProperty (sb , "kafkaAwareTransactionManager" , this .kafkaAwareTransactionManager );
1142+ appendOptionalProperty (sb , "transactionDefinition" , this .transactionDefinition );
1143+
1144+ // Monitoring and scheduling
1145+ appendProperty (sb , "monitorInterval" , this .monitorInterval );
1146+ appendOptionalProperty (sb , "scheduler" , this .scheduler );
1147+ appendProperty (sb , "noPollThreshold" , this .noPollThreshold );
1148+
1149+ // Container behavior flags
1150+ appendProperty (sb , "pauseImmediate" , this .pauseImmediate );
1151+ appendProperty (sb , "stopImmediate" , this .stopImmediate );
1152+ appendProperty (sb , "stopContainerWhenFenced" , this .stopContainerWhenFenced );
1153+ appendProperty (sb , "asyncAcks" , this .asyncAcks );
1154+
1155+ // Polling and partition configuration
1156+ appendProperty (sb , "pollTimeoutWhilePaused" , this .pollTimeoutWhilePaused );
1157+ appendOptionalProperty (sb , "subBatchPerPartition" , this .subBatchPerPartition );
1158+ appendProperty (sb , "assignmentCommitOption" , this .assignmentCommitOption );
1159+ appendProperty (sb , "idleBetweenPolls" , this .idleBetweenPolls );
1160+
1161+ // Header and recovery configuration
1162+ appendProperty (sb , "deliveryAttemptHeader" , this .deliveryAttemptHeader );
1163+ appendProperty (sb , "batchRecoverAfterRollback" , this .batchRecoverAfterRollback );
1164+
1165+ // Exactly-once semantics
1166+ appendProperty (sb , "eosMode" , this .eosMode );
1167+
1168+ // Logging and error handling
1169+ appendProperty (sb , "logContainerConfig" , this .logContainerConfig );
1170+ appendProperty (sb , "missingTopicsFatal" , this .missingTopicsFatal );
1171+ appendProperty (sb , "restartAfterAuthExceptions" , this .restartAfterAuthExceptions );
1172+
1173+ // Metrics and observation
1174+ appendProperty (sb , "micrometerEnabled" , this .micrometerEnabled );
1175+ appendProperty (sb , "observationEnabled" , this .observationEnabled );
1176+ appendProperty (sb , "recordObservationsInBatch" , this .recordObservationsInBatch );
1177+ appendOptionalProperty (sb , "observationConvention" , this .observationConvention );
1178+ appendOptionalProperty (sb , "observationRegistry" , this .observationRegistry );
1179+
1180+ // Data multiplier
1181+ appendProperty (sb , "idleBeforeDataMultiplier" , this .idleBeforeDataMultiplier );
1182+
1183+ sb .append ("\n ]" );
1184+ return sb .toString ();
1185+ }
1186+
1187+ /**
1188+ * Append a property to the StringBuilder with consistent formatting.
1189+ *
1190+ * @param sb the StringBuilder
1191+ * @param name the property name
1192+ * @param value the property value
1193+ */
1194+ private void appendProperty (StringBuilder sb , String name , Object value ) {
1195+ sb .append ("\n " ).append (name ).append ("=" ).append (value );
1196+ }
1197+
1198+ /**
1199+ * Append an optional property only if it's not null.
1200+ *
1201+ * @param sb the StringBuilder
1202+ * @param name the property name
1203+ * @param value the property value (nullable)
1204+ */
1205+ private void appendOptionalProperty (StringBuilder sb , String name , @ Nullable Object value ) {
1206+ if (value != null ) {
1207+ appendProperty (sb , name , value );
1208+ }
1209+ }
1210+
1211+ /**
1212+ * Append a property with "enabled/not enabled" formatting for nullable values.
1213+ *
1214+ * @param sb the StringBuilder
1215+ * @param name the property name
1216+ * @param value the property value (nullable)
1217+ */
1218+ private void appendEnabledProperty (StringBuilder sb , String name , @ Nullable Object value ) {
1219+ sb .append ("\n " ).append (name ).append ("=" )
1220+ .append (value == null ? "not enabled" : value );
11691221 }
11701222
11711223}
0 commit comments