├── .gitignore ├── learn1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── kafka │ │ │ └── learn │ │ │ ├── LearnApplication.java │ │ │ └── learn1 │ │ │ ├── QuickStartConsumer.java │ │ │ ├── QuickStartProducer.java │ │ │ ├── clientadmin │ │ │ └── TopicHandle.java │ │ │ └── quickStart │ │ │ ├── QuickStartConsumer.java │ │ │ └── QuickStartProducer.java │ └── resources │ │ ├── application.properties │ │ └── log4j.properties │ └── test │ └── java │ └── com │ └── kafka │ └── learn │ └── learn │ └── LearnApplicationTests.java └── learn2 ├── pom.xml ├── src ├── main │ ├── java │ │ └── org │ │ │ ├── apache │ │ │ ├── example │ │ │ │ ├── LearnApplication.java │ │ │ │ ├── admin │ │ │ │ │ └── TopicAdmin.java │ │ │ │ └── learn2 │ │ │ │ │ ├── admin │ │ │ │ │ └── TopicAdmin.java │ │ │ │ │ ├── config │ │ │ │ │ └── KafkaConsumerConfig.java │ │ │ │ │ ├── consumer │ │ │ │ │ ├── Consumer.java │ │ │ │ │ ├── ConsumerConf.java │ │ │ │ │ ├── KryoDeserializer.java │ │ │ │ │ ├── ProtostuffDerializer.java │ │ │ │ │ └── spring │ │ │ │ │ │ ├── AbstractConsumer.java │ │ │ │ │ │ ├── SpringConsumer.java │ │ │ │ │ │ └── SpringKafkaConsumer.java │ │ │ │ │ ├── entity │ │ │ │ │ └── KafkaMessage.java │ │ │ │ │ ├── producer │ │ │ │ │ ├── Interceptor.java │ │ │ │ │ ├── KryoSerializer.java │ │ │ │ │ ├── Producer.java │ │ │ │ │ ├── ProducerConf.java │ │ │ │ │ └── ProtostuffSerializer.java │ │ │ │ │ └── util │ │ │ │ │ └── ProtostuffUtil.java │ │ │ └── kafka │ │ │ │ ├── README.md │ │ │ │ ├── clients │ │ │ │ ├── ApiVersions.java │ │ │ │ ├── ClientRequest.java │ │ │ │ ├── ClientResponse.java │ │ │ │ ├── ClientUtils.java │ │ │ │ ├── ClusterConnectionStates.java │ │ │ │ ├── CommonClientConfigs.java │ │ │ │ ├── ConnectionState.java │ │ │ │ ├── FetchSessionHandler.java │ │ │ │ ├── InFlightRequests.java │ │ │ │ ├── KafkaClient.java │ │ │ │ ├── ManualMetadataUpdater.java │ │ │ │ ├── Metadata.java │ │ │ │ ├── MetadataUpdater.java │ │ │ │ ├── NetworkClient.java │ │ │ │ ├── NetworkClientUtils.java │ │ │ │ ├── NodeApiVersions.java │ │ │ │ ├── RequestCompletionHandler.java │ │ │ │ ├── StaleMetadataException.java │ │ │ │ ├── admin │ │ │ │ │ ├── AbstractOptions.java │ │ │ │ │ ├── AdminClient.java │ │ │ │ │ ├── AdminClientConfig.java │ │ │ │ │ ├── AlterConfigsOptions.java │ │ │ │ │ ├── AlterConfigsResult.java │ │ │ │ │ ├── AlterReplicaLogDirsOptions.java │ │ │ │ │ ├── AlterReplicaLogDirsResult.java │ │ │ │ │ ├── Config.java │ │ │ │ │ ├── ConfigEntry.java │ │ │ │ │ ├── ConsumerGroupDescription.java │ │ │ │ │ ├── ConsumerGroupListing.java │ │ │ │ │ ├── CreateAclsOptions.java │ │ │ │ │ ├── CreateAclsResult.java │ │ │ │ │ ├── CreateDelegationTokenOptions.java │ │ │ │ │ ├── CreateDelegationTokenResult.java │ │ │ │ │ ├── CreatePartitionsOptions.java │ │ │ │ │ ├── CreatePartitionsResult.java │ │ │ │ │ ├── CreateTopicsOptions.java │ │ │ │ │ ├── CreateTopicsResult.java │ │ │ │ │ ├── DeleteAclsOptions.java │ │ │ │ │ ├── DeleteAclsResult.java │ │ │ │ │ ├── DeleteConsumerGroupsOptions.java │ │ │ │ │ ├── DeleteConsumerGroupsResult.java │ │ │ │ │ ├── DeleteRecordsOptions.java │ │ │ │ │ ├── DeleteRecordsResult.java │ │ │ │ │ ├── DeleteTopicsOptions.java │ │ │ │ │ ├── DeleteTopicsResult.java │ │ │ │ │ ├── DeletedRecords.java │ │ │ │ │ ├── DescribeAclsOptions.java │ │ │ │ │ ├── DescribeAclsResult.java │ │ │ │ │ ├── DescribeClusterOptions.java │ │ │ │ │ ├── DescribeClusterResult.java │ │ │ │ │ ├── DescribeConfigsOptions.java │ │ │ │ │ ├── DescribeConfigsResult.java │ │ │ │ │ ├── DescribeConsumerGroupsOptions.java │ │ │ │ │ ├── DescribeConsumerGroupsResult.java │ │ │ │ │ ├── DescribeDelegationTokenOptions.java │ │ │ │ │ ├── DescribeDelegationTokenResult.java │ │ │ │ │ ├── DescribeLogDirsOptions.java │ │ │ │ │ ├── DescribeLogDirsResult.java │ │ │ │ │ ├── DescribeReplicaLogDirsOptions.java │ │ │ │ │ ├── DescribeReplicaLogDirsResult.java │ │ │ │ │ ├── DescribeTopicsOptions.java │ │ │ │ │ ├── DescribeTopicsResult.java │ │ │ │ │ ├── ExpireDelegationTokenOptions.java │ │ │ │ │ ├── ExpireDelegationTokenResult.java │ │ │ │ │ ├── KafkaAdminClient.java │ │ │ │ │ ├── ListConsumerGroupOffsetsOptions.java │ │ │ │ │ ├── ListConsumerGroupOffsetsResult.java │ │ │ │ │ ├── ListConsumerGroupsOptions.java │ │ │ │ │ ├── ListConsumerGroupsResult.java │ │ │ │ │ ├── ListTopicsOptions.java │ │ │ │ │ ├── ListTopicsResult.java │ │ │ │ │ ├── MemberAssignment.java │ │ │ │ │ ├── MemberDescription.java │ │ │ │ │ ├── NewPartitions.java │ │ │ │ │ ├── NewTopic.java │ │ │ │ │ ├── RecordsToDelete.java │ │ │ │ │ ├── RenewDelegationTokenOptions.java │ │ │ │ │ ├── RenewDelegationTokenResult.java │ │ │ │ │ ├── TopicDescription.java │ │ │ │ │ ├── TopicListing.java │ │ │ │ │ └── internals │ │ │ │ │ │ └── AdminMetadataManager.java │ │ │ │ ├── consumer │ │ │ │ │ ├── CommitFailedException.java │ │ │ │ │ ├── Consumer.java │ │ │ │ │ ├── ConsumerConfig.java │ │ │ │ │ ├── ConsumerInterceptor.java │ │ │ │ │ ├── ConsumerRebalanceListener.java │ │ │ │ │ ├── ConsumerRecord.java │ │ │ │ │ ├── ConsumerRecords.java │ │ │ │ │ ├── InvalidOffsetException.java │ │ │ │ │ ├── KafkaConsumer.java │ │ │ │ │ ├── MockConsumer.java │ │ │ │ │ ├── NoOffsetForPartitionException.java │ │ │ │ │ ├── OffsetAndMetadata.java │ │ │ │ │ ├── OffsetAndTimestamp.java │ │ │ │ │ ├── OffsetCommitCallback.java │ │ │ │ │ ├── OffsetOutOfRangeException.java │ │ │ │ │ ├── OffsetResetStrategy.java │ │ │ │ │ ├── RangeAssignor.java │ │ │ │ │ ├── RetriableCommitFailedException.java │ │ │ │ │ ├── RoundRobinAssignor.java │ │ │ │ │ ├── StickyAssignor.java │ │ │ │ │ └── internals │ │ │ │ │ │ ├── AbstractCoordinator.java │ │ │ │ │ │ ├── AbstractPartitionAssignor.java │ │ │ │ │ │ ├── ConsumerCoordinator.java │ │ │ │ │ │ ├── ConsumerInterceptors.java │ │ │ │ │ │ ├── ConsumerMetrics.java │ │ │ │ │ │ ├── ConsumerNetworkClient.java │ │ │ │ │ │ ├── ConsumerProtocol.java │ │ │ │ │ │ ├── Fetcher.java │ │ │ │ │ │ ├── FetcherMetricsRegistry.java │ │ │ │ │ │ ├── Heartbeat.java │ │ │ │ │ │ ├── NoAvailableBrokersException.java │ │ │ │ │ │ ├── NoOpConsumerRebalanceListener.java │ │ │ │ │ │ ├── PartitionAssignor.java │ │ │ │ │ │ ├── RequestFuture.java │ │ │ │ │ │ ├── RequestFutureAdapter.java │ │ │ │ │ │ ├── RequestFutureListener.java │ │ │ │ │ │ └── SubscriptionState.java │ │ │ │ └── producer │ │ │ │ │ ├── BufferExhaustedException.java │ │ │ │ │ ├── Callback.java │ │ │ │ │ ├── KafkaProducer.java │ │ │ │ │ ├── MockProducer.java │ │ │ │ │ ├── Partitioner.java │ │ │ │ │ ├── Producer.java │ │ │ │ │ ├── ProducerConfig.java │ │ │ │ │ ├── ProducerInterceptor.java │ │ │ │ │ ├── ProducerRecord.java │ │ │ │ │ ├── RecordMetadata.java │ │ │ │ │ └── internals │ │ │ │ │ ├── BufferPool.java │ │ │ │ │ ├── DefaultPartitioner.java │ │ │ │ │ ├── ErrorLoggingCallback.java │ │ │ │ │ ├── FutureRecordMetadata.java │ │ │ │ │ ├── IncompleteBatches.java │ │ │ │ │ ├── ProduceRequestResult.java │ │ │ │ │ ├── ProducerBatch.java │ │ │ │ │ ├── ProducerIdAndEpoch.java │ │ │ │ │ ├── ProducerInterceptors.java │ │ │ │ │ ├── ProducerMetrics.java │ │ │ │ │ ├── RecordAccumulator.java │ │ │ │ │ ├── Sender.java │ │ │ │ │ ├── SenderMetricsRegistry.java │ │ │ │ │ ├── TransactionManager.java │ │ │ │ │ └── TransactionalRequestResult.java │ │ │ │ ├── common │ │ │ │ ├── Cluster.java │ │ │ │ ├── ClusterResource.java │ │ │ │ ├── ClusterResourceListener.java │ │ │ │ ├── Configurable.java │ │ │ │ ├── ConsumerGroupState.java │ │ │ │ ├── KafkaException.java │ │ │ │ ├── KafkaFuture.java │ │ │ │ ├── Metric.java │ │ │ │ ├── MetricName.java │ │ │ │ ├── MetricNameTemplate.java │ │ │ │ ├── Node.java │ │ │ │ ├── PartitionInfo.java │ │ │ │ ├── Reconfigurable.java │ │ │ │ ├── TopicPartition.java │ │ │ │ ├── TopicPartitionInfo.java │ │ │ │ ├── TopicPartitionReplica.java │ │ │ │ ├── acl │ │ │ │ │ ├── AccessControlEntry.java │ │ │ │ │ ├── AccessControlEntryData.java │ │ │ │ │ ├── AccessControlEntryFilter.java │ │ │ │ │ ├── AclBinding.java │ │ │ │ │ ├── AclBindingFilter.java │ │ │ │ │ ├── AclOperation.java │ │ │ │ │ └── AclPermissionType.java │ │ │ │ ├── annotation │ │ │ │ │ └── InterfaceStability.java │ │ │ │ ├── cache │ │ │ │ │ ├── Cache.java │ │ │ │ │ ├── LRUCache.java │ │ │ │ │ └── SynchronizedCache.java │ │ │ │ ├── config │ │ │ │ │ ├── AbstractConfig.java │ │ │ │ │ ├── Config.java │ │ │ │ │ ├── ConfigChangeCallback.java │ │ │ │ │ ├── ConfigData.java │ │ │ │ │ ├── ConfigDef.java │ │ │ │ │ ├── ConfigException.java │ │ │ │ │ ├── ConfigResource.java │ │ │ │ │ ├── ConfigTransformer.java │ │ │ │ │ ├── ConfigTransformerResult.java │ │ │ │ │ ├── ConfigValue.java │ │ │ │ │ ├── SaslConfigs.java │ │ │ │ │ ├── SslConfigs.java │ │ │ │ │ ├── TopicConfig.java │ │ │ │ │ ├── internals │ │ │ │ │ │ └── BrokerSecurityConfigs.java │ │ │ │ │ ├── provider │ │ │ │ │ │ ├── ConfigProvider.java │ │ │ │ │ │ └── FileConfigProvider.java │ │ │ │ │ └── types │ │ │ │ │ │ └── Password.java │ │ │ │ ├── errors │ │ │ │ │ ├── ApiException.java │ │ │ │ │ ├── AuthenticationException.java │ │ │ │ │ ├── AuthorizationException.java │ │ │ │ │ ├── BrokerNotAvailableException.java │ │ │ │ │ ├── ClusterAuthorizationException.java │ │ │ │ │ ├── ConcurrentTransactionsException.java │ │ │ │ │ ├── ControllerMovedException.java │ │ │ │ │ ├── CoordinatorLoadInProgressException.java │ │ │ │ │ ├── CoordinatorNotAvailableException.java │ │ │ │ │ ├── CorruptRecordException.java │ │ │ │ │ ├── DelegationTokenAuthorizationException.java │ │ │ │ │ ├── DelegationTokenDisabledException.java │ │ │ │ │ ├── DelegationTokenExpiredException.java │ │ │ │ │ ├── DelegationTokenNotFoundException.java │ │ │ │ │ ├── DelegationTokenOwnerMismatchException.java │ │ │ │ │ ├── DisconnectException.java │ │ │ │ │ ├── DuplicateSequenceException.java │ │ │ │ │ ├── FetchSessionIdNotFoundException.java │ │ │ │ │ ├── GroupAuthorizationException.java │ │ │ │ │ ├── GroupIdNotFoundException.java │ │ │ │ │ ├── GroupNotEmptyException.java │ │ │ │ │ ├── IllegalGenerationException.java │ │ │ │ │ ├── IllegalSaslStateException.java │ │ │ │ │ ├── InconsistentGroupProtocolException.java │ │ │ │ │ ├── InterruptException.java │ │ │ │ │ ├── InvalidCommitOffsetSizeException.java │ │ │ │ │ ├── InvalidConfigurationException.java │ │ │ │ │ ├── InvalidFetchSessionEpochException.java │ │ │ │ │ ├── InvalidFetchSizeException.java │ │ │ │ │ ├── InvalidGroupIdException.java │ │ │ │ │ ├── InvalidMetadataException.java │ │ │ │ │ ├── InvalidOffsetException.java │ │ │ │ │ ├── InvalidPartitionsException.java │ │ │ │ │ ├── InvalidPidMappingException.java │ │ │ │ │ ├── InvalidPrincipalTypeException.java │ │ │ │ │ ├── InvalidReplicaAssignmentException.java │ │ │ │ │ ├── InvalidReplicationFactorException.java │ │ │ │ │ ├── InvalidRequestException.java │ │ │ │ │ ├── InvalidRequiredAcksException.java │ │ │ │ │ ├── InvalidSessionTimeoutException.java │ │ │ │ │ ├── InvalidTimestampException.java │ │ │ │ │ ├── InvalidTopicException.java │ │ │ │ │ ├── InvalidTxnStateException.java │ │ │ │ │ ├── InvalidTxnTimeoutException.java │ │ │ │ │ ├── KafkaStorageException.java │ │ │ │ │ ├── LeaderNotAvailableException.java │ │ │ │ │ ├── ListenerNotFoundException.java │ │ │ │ │ ├── LogDirNotFoundException.java │ │ │ │ │ ├── NetworkException.java │ │ │ │ │ ├── NotControllerException.java │ │ │ │ │ ├── NotCoordinatorException.java │ │ │ │ │ ├── NotEnoughReplicasAfterAppendException.java │ │ │ │ │ ├── NotEnoughReplicasException.java │ │ │ │ │ ├── NotLeaderForPartitionException.java │ │ │ │ │ ├── OffsetMetadataTooLarge.java │ │ │ │ │ ├── OffsetOutOfRangeException.java │ │ │ │ │ ├── OperationNotAttemptedException.java │ │ │ │ │ ├── OutOfOrderSequenceException.java │ │ │ │ │ ├── PolicyViolationException.java │ │ │ │ │ ├── ProducerFencedException.java │ │ │ │ │ ├── ReassignmentInProgressException.java │ │ │ │ │ ├── RebalanceInProgressException.java │ │ │ │ │ ├── RecordBatchTooLargeException.java │ │ │ │ │ ├── RecordTooLargeException.java │ │ │ │ │ ├── ReplicaNotAvailableException.java │ │ │ │ │ ├── RetriableException.java │ │ │ │ │ ├── SaslAuthenticationException.java │ │ │ │ │ ├── SecurityDisabledException.java │ │ │ │ │ ├── SerializationException.java │ │ │ │ │ ├── SslAuthenticationException.java │ │ │ │ │ ├── TimeoutException.java │ │ │ │ │ ├── TopicAuthorizationException.java │ │ │ │ │ ├── TopicExistsException.java │ │ │ │ │ ├── TransactionCoordinatorFencedException.java │ │ │ │ │ ├── TransactionalIdAuthorizationException.java │ │ │ │ │ ├── UnknownMemberIdException.java │ │ │ │ │ ├── UnknownProducerIdException.java │ │ │ │ │ ├── UnknownServerException.java │ │ │ │ │ ├── UnknownTopicOrPartitionException.java │ │ │ │ │ ├── UnsupportedByAuthenticationException.java │ │ │ │ │ ├── UnsupportedForMessageFormatException.java │ │ │ │ │ ├── UnsupportedSaslMechanismException.java │ │ │ │ │ ├── UnsupportedVersionException.java │ │ │ │ │ └── WakeupException.java │ │ │ │ ├── header │ │ │ │ │ ├── Header.java │ │ │ │ │ ├── Headers.java │ │ │ │ │ └── internals │ │ │ │ │ │ ├── RecordHeader.java │ │ │ │ │ │ └── RecordHeaders.java │ │ │ │ ├── internals │ │ │ │ │ ├── ClusterResourceListeners.java │ │ │ │ │ ├── FatalExitError.java │ │ │ │ │ ├── KafkaFutureImpl.java │ │ │ │ │ ├── PartitionStates.java │ │ │ │ │ └── Topic.java │ │ │ │ ├── memory │ │ │ │ │ ├── GarbageCollectedMemoryPool.java │ │ │ │ │ ├── MemoryPool.java │ │ │ │ │ └── SimpleMemoryPool.java │ │ │ │ ├── metrics │ │ │ │ │ ├── CompoundStat.java │ │ │ │ │ ├── Gauge.java │ │ │ │ │ ├── JmxReporter.java │ │ │ │ │ ├── KafkaMetric.java │ │ │ │ │ ├── Measurable.java │ │ │ │ │ ├── MeasurableStat.java │ │ │ │ │ ├── MetricConfig.java │ │ │ │ │ ├── MetricValueProvider.java │ │ │ │ │ ├── Metrics.java │ │ │ │ │ ├── MetricsReporter.java │ │ │ │ │ ├── Quota.java │ │ │ │ │ ├── QuotaViolationException.java │ │ │ │ │ ├── Sensor.java │ │ │ │ │ ├── Stat.java │ │ │ │ │ └── stats │ │ │ │ │ │ ├── Avg.java │ │ │ │ │ │ ├── Count.java │ │ │ │ │ │ ├── Frequencies.java │ │ │ │ │ │ ├── Frequency.java │ │ │ │ │ │ ├── Histogram.java │ │ │ │ │ │ ├── Max.java │ │ │ │ │ │ ├── Meter.java │ │ │ │ │ │ ├── Min.java │ │ │ │ │ │ ├── Percentile.java │ │ │ │ │ │ ├── Percentiles.java │ │ │ │ │ │ ├── Rate.java │ │ │ │ │ │ ├── SampledStat.java │ │ │ │ │ │ ├── SimpleRate.java │ │ │ │ │ │ ├── Sum.java │ │ │ │ │ │ ├── Total.java │ │ │ │ │ │ └── Value.java │ │ │ │ ├── network │ │ │ │ │ ├── Authenticator.java │ │ │ │ │ ├── ByteBufferSend.java │ │ │ │ │ ├── ChannelBuilder.java │ │ │ │ │ ├── ChannelBuilders.java │ │ │ │ │ ├── ChannelState.java │ │ │ │ │ ├── InvalidReceiveException.java │ │ │ │ │ ├── KafkaChannel.java │ │ │ │ │ ├── ListenerName.java │ │ │ │ │ ├── ListenerReconfigurable.java │ │ │ │ │ ├── Mode.java │ │ │ │ │ ├── NetworkReceive.java │ │ │ │ │ ├── NetworkSend.java │ │ │ │ │ ├── PlaintextChannelBuilder.java │ │ │ │ │ ├── PlaintextTransportLayer.java │ │ │ │ │ ├── Receive.java │ │ │ │ │ ├── SaslChannelBuilder.java │ │ │ │ │ ├── Selectable.java │ │ │ │ │ ├── Selector.java │ │ │ │ │ ├── Send.java │ │ │ │ │ ├── SslChannelBuilder.java │ │ │ │ │ ├── SslTransportLayer.java │ │ │ │ │ ├── TransportLayer.java │ │ │ │ │ └── TransportLayers.java │ │ │ │ ├── protocol │ │ │ │ │ ├── ApiKeys.java │ │ │ │ │ ├── CommonFields.java │ │ │ │ │ ├── Errors.java │ │ │ │ │ ├── Protocol.java │ │ │ │ │ └── types │ │ │ │ │ │ ├── ArrayOf.java │ │ │ │ │ │ ├── BoundField.java │ │ │ │ │ │ ├── Field.java │ │ │ │ │ │ ├── Schema.java │ │ │ │ │ │ ├── SchemaException.java │ │ │ │ │ │ ├── Struct.java │ │ │ │ │ │ └── Type.java │ │ │ │ ├── record │ │ │ │ │ ├── AbstractLegacyRecordBatch.java │ │ │ │ │ ├── AbstractRecordBatch.java │ │ │ │ │ ├── AbstractRecords.java │ │ │ │ │ ├── BaseRecords.java │ │ │ │ │ ├── BufferSupplier.java │ │ │ │ │ ├── ByteBufferLogInputStream.java │ │ │ │ │ ├── CompressionRatioEstimator.java │ │ │ │ │ ├── CompressionType.java │ │ │ │ │ ├── ControlRecordType.java │ │ │ │ │ ├── ConvertedRecords.java │ │ │ │ │ ├── DefaultRecord.java │ │ │ │ │ ├── DefaultRecordBatch.java │ │ │ │ │ ├── DefaultRecordsSend.java │ │ │ │ │ ├── EndTransactionMarker.java │ │ │ │ │ ├── FileLogInputStream.java │ │ │ │ │ ├── FileRecords.java │ │ │ │ │ ├── InvalidRecordException.java │ │ │ │ │ ├── KafkaLZ4BlockInputStream.java │ │ │ │ │ ├── KafkaLZ4BlockOutputStream.java │ │ │ │ │ ├── LazyDownConversionRecords.java │ │ │ │ │ ├── LazyDownConversionRecordsSend.java │ │ │ │ │ ├── LegacyRecord.java │ │ │ │ │ ├── LogInputStream.java │ │ │ │ │ ├── MemoryRecords.java │ │ │ │ │ ├── MemoryRecordsBuilder.java │ │ │ │ │ ├── MultiRecordsSend.java │ │ │ │ │ ├── MutableRecordBatch.java │ │ │ │ │ ├── Record.java │ │ │ │ │ ├── RecordBatch.java │ │ │ │ │ ├── RecordBatchIterator.java │ │ │ │ │ ├── RecordConversionStats.java │ │ │ │ │ ├── RecordVersion.java │ │ │ │ │ ├── Records.java │ │ │ │ │ ├── RecordsSend.java │ │ │ │ │ ├── RecordsUtil.java │ │ │ │ │ ├── SimpleRecord.java │ │ │ │ │ └── TimestampType.java │ │ │ │ ├── requests │ │ │ │ │ ├── AbstractRequest.java │ │ │ │ │ ├── AbstractRequestResponse.java │ │ │ │ │ ├── AbstractResponse.java │ │ │ │ │ ├── AddOffsetsToTxnRequest.java │ │ │ │ │ ├── AddOffsetsToTxnResponse.java │ │ │ │ │ ├── AddPartitionsToTxnRequest.java │ │ │ │ │ ├── AddPartitionsToTxnResponse.java │ │ │ │ │ ├── AlterConfigsRequest.java │ │ │ │ │ ├── AlterConfigsResponse.java │ │ │ │ │ ├── AlterReplicaLogDirsRequest.java │ │ │ │ │ ├── AlterReplicaLogDirsResponse.java │ │ │ │ │ ├── ApiError.java │ │ │ │ │ ├── ApiVersionsRequest.java │ │ │ │ │ ├── ApiVersionsResponse.java │ │ │ │ │ ├── BasePartitionState.java │ │ │ │ │ ├── ControlledShutdownRequest.java │ │ │ │ │ ├── ControlledShutdownResponse.java │ │ │ │ │ ├── CreateAclsRequest.java │ │ │ │ │ ├── CreateAclsResponse.java │ │ │ │ │ ├── CreateDelegationTokenRequest.java │ │ │ │ │ ├── CreateDelegationTokenResponse.java │ │ │ │ │ ├── CreatePartitionsRequest.java │ │ │ │ │ ├── CreatePartitionsResponse.java │ │ │ │ │ ├── CreateTopicsRequest.java │ │ │ │ │ ├── CreateTopicsResponse.java │ │ │ │ │ ├── DeleteAclsRequest.java │ │ │ │ │ ├── DeleteAclsResponse.java │ │ │ │ │ ├── DeleteGroupsRequest.java │ │ │ │ │ ├── DeleteGroupsResponse.java │ │ │ │ │ ├── DeleteRecordsRequest.java │ │ │ │ │ ├── DeleteRecordsResponse.java │ │ │ │ │ ├── DeleteTopicsRequest.java │ │ │ │ │ ├── DeleteTopicsResponse.java │ │ │ │ │ ├── DescribeAclsRequest.java │ │ │ │ │ ├── DescribeAclsResponse.java │ │ │ │ │ ├── DescribeConfigsRequest.java │ │ │ │ │ ├── DescribeConfigsResponse.java │ │ │ │ │ ├── DescribeDelegationTokenRequest.java │ │ │ │ │ ├── DescribeDelegationTokenResponse.java │ │ │ │ │ ├── DescribeGroupsRequest.java │ │ │ │ │ ├── DescribeGroupsResponse.java │ │ │ │ │ ├── DescribeLogDirsRequest.java │ │ │ │ │ ├── DescribeLogDirsResponse.java │ │ │ │ │ ├── EndTxnRequest.java │ │ │ │ │ ├── EndTxnResponse.java │ │ │ │ │ ├── EpochEndOffset.java │ │ │ │ │ ├── ExpireDelegationTokenRequest.java │ │ │ │ │ ├── ExpireDelegationTokenResponse.java │ │ │ │ │ ├── FetchMetadata.java │ │ │ │ │ ├── FetchRequest.java │ │ │ │ │ ├── FetchResponse.java │ │ │ │ │ ├── FindCoordinatorRequest.java │ │ │ │ │ ├── FindCoordinatorResponse.java │ │ │ │ │ ├── HeartbeatRequest.java │ │ │ │ │ ├── HeartbeatResponse.java │ │ │ │ │ ├── InitProducerIdRequest.java │ │ │ │ │ ├── InitProducerIdResponse.java │ │ │ │ │ ├── IsolationLevel.java │ │ │ │ │ ├── JoinGroupRequest.java │ │ │ │ │ ├── JoinGroupResponse.java │ │ │ │ │ ├── LeaderAndIsrRequest.java │ │ │ │ │ ├── LeaderAndIsrResponse.java │ │ │ │ │ ├── LeaveGroupRequest.java │ │ │ │ │ ├── LeaveGroupResponse.java │ │ │ │ │ ├── ListGroupsRequest.java │ │ │ │ │ ├── ListGroupsResponse.java │ │ │ │ │ ├── ListOffsetRequest.java │ │ │ │ │ ├── ListOffsetResponse.java │ │ │ │ │ ├── MetadataRequest.java │ │ │ │ │ ├── MetadataResponse.java │ │ │ │ │ ├── OffsetCommitRequest.java │ │ │ │ │ ├── OffsetCommitResponse.java │ │ │ │ │ ├── OffsetFetchRequest.java │ │ │ │ │ ├── OffsetFetchResponse.java │ │ │ │ │ ├── OffsetsForLeaderEpochRequest.java │ │ │ │ │ ├── OffsetsForLeaderEpochResponse.java │ │ │ │ │ ├── ProduceRequest.java │ │ │ │ │ ├── ProduceResponse.java │ │ │ │ │ ├── RenewDelegationTokenRequest.java │ │ │ │ │ ├── RenewDelegationTokenResponse.java │ │ │ │ │ ├── RequestAndSize.java │ │ │ │ │ ├── RequestContext.java │ │ │ │ │ ├── RequestHeader.java │ │ │ │ │ ├── RequestUtils.java │ │ │ │ │ ├── ResponseHeader.java │ │ │ │ │ ├── SaslAuthenticateRequest.java │ │ │ │ │ ├── SaslAuthenticateResponse.java │ │ │ │ │ ├── SaslHandshakeRequest.java │ │ │ │ │ ├── SaslHandshakeResponse.java │ │ │ │ │ ├── StopReplicaRequest.java │ │ │ │ │ ├── StopReplicaResponse.java │ │ │ │ │ ├── SyncGroupRequest.java │ │ │ │ │ ├── SyncGroupResponse.java │ │ │ │ │ ├── TransactionResult.java │ │ │ │ │ ├── TxnOffsetCommitRequest.java │ │ │ │ │ ├── TxnOffsetCommitResponse.java │ │ │ │ │ ├── UpdateMetadataRequest.java │ │ │ │ │ ├── UpdateMetadataResponse.java │ │ │ │ │ ├── WriteTxnMarkersRequest.java │ │ │ │ │ └── WriteTxnMarkersResponse.java │ │ │ │ ├── resource │ │ │ │ │ ├── PatternType.java │ │ │ │ │ ├── Resource.java │ │ │ │ │ ├── ResourceFilter.java │ │ │ │ │ ├── ResourcePattern.java │ │ │ │ │ ├── ResourcePatternFilter.java │ │ │ │ │ └── ResourceType.java │ │ │ │ ├── security │ │ │ │ │ ├── JaasConfig.java │ │ │ │ │ ├── JaasContext.java │ │ │ │ │ ├── JaasUtils.java │ │ │ │ │ ├── auth │ │ │ │ │ │ ├── AuthenticateCallbackHandler.java │ │ │ │ │ │ ├── AuthenticationContext.java │ │ │ │ │ │ ├── DefaultPrincipalBuilder.java │ │ │ │ │ │ ├── KafkaPrincipal.java │ │ │ │ │ │ ├── KafkaPrincipalBuilder.java │ │ │ │ │ │ ├── Login.java │ │ │ │ │ │ ├── PlaintextAuthenticationContext.java │ │ │ │ │ │ ├── PrincipalBuilder.java │ │ │ │ │ │ ├── SaslAuthenticationContext.java │ │ │ │ │ │ ├── SecurityProtocol.java │ │ │ │ │ │ └── SslAuthenticationContext.java │ │ │ │ │ ├── authenticator │ │ │ │ │ │ ├── AbstractLogin.java │ │ │ │ │ │ ├── CredentialCache.java │ │ │ │ │ │ ├── DefaultKafkaPrincipalBuilder.java │ │ │ │ │ │ ├── DefaultLogin.java │ │ │ │ │ │ ├── LoginManager.java │ │ │ │ │ │ ├── SaslClientAuthenticator.java │ │ │ │ │ │ ├── SaslClientCallbackHandler.java │ │ │ │ │ │ ├── SaslServerAuthenticator.java │ │ │ │ │ │ └── SaslServerCallbackHandler.java │ │ │ │ │ ├── kerberos │ │ │ │ │ │ ├── BadFormatString.java │ │ │ │ │ │ ├── KerberosClientCallbackHandler.java │ │ │ │ │ │ ├── KerberosLogin.java │ │ │ │ │ │ ├── KerberosName.java │ │ │ │ │ │ ├── KerberosRule.java │ │ │ │ │ │ ├── KerberosShortNamer.java │ │ │ │ │ │ └── NoMatchingRule.java │ │ │ │ │ ├── oauthbearer │ │ │ │ │ │ ├── OAuthBearerLoginModule.java │ │ │ │ │ │ ├── OAuthBearerToken.java │ │ │ │ │ │ ├── OAuthBearerTokenCallback.java │ │ │ │ │ │ ├── OAuthBearerValidatorCallback.java │ │ │ │ │ │ └── internals │ │ │ │ │ │ │ ├── OAuthBearerClientInitialResponse.java │ │ │ │ │ │ │ ├── OAuthBearerRefreshingLogin.java │ │ │ │ │ │ │ ├── OAuthBearerSaslClient.java │ │ │ │ │ │ │ ├── OAuthBearerSaslClientCallbackHandler.java │ │ │ │ │ │ │ ├── OAuthBearerSaslClientProvider.java │ │ │ │ │ │ │ ├── OAuthBearerSaslServer.java │ │ │ │ │ │ │ ├── OAuthBearerSaslServerProvider.java │ │ │ │ │ │ │ ├── expiring │ │ │ │ │ │ │ ├── ExpiringCredential.java │ │ │ │ │ │ │ ├── ExpiringCredentialRefreshConfig.java │ │ │ │ │ │ │ └── ExpiringCredentialRefreshingLogin.java │ │ │ │ │ │ │ └── unsecured │ │ │ │ │ │ │ ├── OAuthBearerConfigException.java │ │ │ │ │ │ │ ├── OAuthBearerIllegalTokenException.java │ │ │ │ │ │ │ ├── OAuthBearerScopeUtils.java │ │ │ │ │ │ │ ├── OAuthBearerUnsecuredJws.java │ │ │ │ │ │ │ ├── OAuthBearerUnsecuredLoginCallbackHandler.java │ │ │ │ │ │ │ ├── OAuthBearerUnsecuredValidatorCallbackHandler.java │ │ │ │ │ │ │ ├── OAuthBearerValidationResult.java │ │ │ │ │ │ │ └── OAuthBearerValidationUtils.java │ │ │ │ │ ├── plain │ │ │ │ │ │ ├── PlainAuthenticateCallback.java │ │ │ │ │ │ ├── PlainLoginModule.java │ │ │ │ │ │ └── internals │ │ │ │ │ │ │ ├── PlainSaslServer.java │ │ │ │ │ │ │ ├── PlainSaslServerProvider.java │ │ │ │ │ │ │ └── PlainServerCallbackHandler.java │ │ │ │ │ ├── scram │ │ │ │ │ │ ├── ScramCredential.java │ │ │ │ │ │ ├── ScramCredentialCallback.java │ │ │ │ │ │ ├── ScramExtensionsCallback.java │ │ │ │ │ │ ├── ScramLoginModule.java │ │ │ │ │ │ └── internals │ │ │ │ │ │ │ ├── ScramCredentialUtils.java │ │ │ │ │ │ │ ├── ScramExtensions.java │ │ │ │ │ │ │ ├── ScramFormatter.java │ │ │ │ │ │ │ ├── ScramMechanism.java │ │ │ │ │ │ │ ├── ScramMessages.java │ │ │ │ │ │ │ ├── ScramSaslClient.java │ │ │ │ │ │ │ ├── ScramSaslClientProvider.java │ │ │ │ │ │ │ ├── ScramSaslServer.java │ │ │ │ │ │ │ ├── ScramSaslServerProvider.java │ │ │ │ │ │ │ └── ScramServerCallbackHandler.java │ │ │ │ │ ├── ssl │ │ │ │ │ │ └── SslFactory.java │ │ │ │ │ └── token │ │ │ │ │ │ └── delegation │ │ │ │ │ │ ├── DelegationToken.java │ │ │ │ │ │ ├── TokenInformation.java │ │ │ │ │ │ └── internals │ │ │ │ │ │ ├── DelegationTokenCache.java │ │ │ │ │ │ └── DelegationTokenCredentialCallback.java │ │ │ │ ├── serialization │ │ │ │ │ ├── ByteArrayDeserializer.java │ │ │ │ │ ├── ByteArraySerializer.java │ │ │ │ │ ├── ByteBufferDeserializer.java │ │ │ │ │ ├── ByteBufferSerializer.java │ │ │ │ │ ├── BytesDeserializer.java │ │ │ │ │ ├── BytesSerializer.java │ │ │ │ │ ├── Deserializer.java │ │ │ │ │ ├── DoubleDeserializer.java │ │ │ │ │ ├── DoubleSerializer.java │ │ │ │ │ ├── ExtendedDeserializer.java │ │ │ │ │ ├── ExtendedSerializer.java │ │ │ │ │ ├── FloatDeserializer.java │ │ │ │ │ ├── FloatSerializer.java │ │ │ │ │ ├── IntegerDeserializer.java │ │ │ │ │ ├── IntegerSerializer.java │ │ │ │ │ ├── LongDeserializer.java │ │ │ │ │ ├── LongSerializer.java │ │ │ │ │ ├── Serde.java │ │ │ │ │ ├── Serdes.java │ │ │ │ │ ├── Serializer.java │ │ │ │ │ ├── ShortDeserializer.java │ │ │ │ │ ├── ShortSerializer.java │ │ │ │ │ ├── StringDeserializer.java │ │ │ │ │ └── StringSerializer.java │ │ │ │ └── utils │ │ │ │ │ ├── AbstractIterator.java │ │ │ │ │ ├── AppInfoParser.java │ │ │ │ │ ├── ByteBufferInputStream.java │ │ │ │ │ ├── ByteBufferOutputStream.java │ │ │ │ │ ├── ByteUtils.java │ │ │ │ │ ├── Bytes.java │ │ │ │ │ ├── Checksums.java │ │ │ │ │ ├── CircularIterator.java │ │ │ │ │ ├── CloseableIterator.java │ │ │ │ │ ├── CollectionUtils.java │ │ │ │ │ ├── CopyOnWriteMap.java │ │ │ │ │ ├── Crc32.java │ │ │ │ │ ├── Crc32C.java │ │ │ │ │ ├── Exit.java │ │ │ │ │ ├── ImplicitLinkedHashSet.java │ │ │ │ │ ├── Java.java │ │ │ │ │ ├── KafkaThread.java │ │ │ │ │ ├── LogContext.java │ │ │ │ │ ├── LoggingSignalHandler.java │ │ │ │ │ ├── MappedByteBuffers.java │ │ │ │ │ ├── OperatingSystem.java │ │ │ │ │ ├── PureJavaCrc32C.java │ │ │ │ │ ├── Sanitizer.java │ │ │ │ │ ├── Scheduler.java │ │ │ │ │ ├── SecurityUtils.java │ │ │ │ │ ├── Shell.java │ │ │ │ │ ├── SystemScheduler.java │ │ │ │ │ ├── SystemTime.java │ │ │ │ │ ├── Time.java │ │ │ │ │ └── Utils.java │ │ │ │ └── server │ │ │ │ ├── policy │ │ │ │ ├── AlterConfigPolicy.java │ │ │ │ └── CreateTopicPolicy.java │ │ │ │ └── quota │ │ │ │ ├── ClientQuotaCallback.java │ │ │ │ ├── ClientQuotaEntity.java │ │ │ │ └── ClientQuotaType.java │ │ │ └── springframework │ │ │ ├── example │ │ │ ├── MyAcknowledgingMessageListener.java │ │ │ ├── MyMessageListener.java │ │ │ ├── SpringKafkaTest.java │ │ │ ├── config │ │ │ │ ├── KConsumerConfig.java │ │ │ │ ├── KafkaTemplateConfig.java │ │ │ │ └── TopicConfig.java │ │ │ ├── consumer │ │ │ │ ├── ConsumerErrorHander.java │ │ │ │ └── ConsumerListener.java │ │ │ └── producer │ │ │ │ ├── MyproducerListener.java │ │ │ │ ├── ProducerCallback.java │ │ │ │ └── SpringKafkaTemplate.java │ │ │ └── kafka │ │ │ ├── KafkaException.java │ │ │ ├── annotation │ │ │ ├── EnableKafka.java │ │ │ ├── EnableKafkaStreams.java │ │ │ ├── KafkaBootstrapConfiguration.java │ │ │ ├── KafkaHandler.java │ │ │ ├── KafkaListener.java │ │ │ ├── KafkaListenerAnnotationBeanPostProcessor.java │ │ │ ├── KafkaListenerConfigurer.java │ │ │ ├── KafkaListeners.java │ │ │ ├── KafkaStreamsDefaultConfiguration.java │ │ │ ├── PartitionOffset.java │ │ │ ├── TopicPartition.java │ │ │ └── package-info.java │ │ │ ├── config │ │ │ ├── AbstractKafkaListenerContainerFactory.java │ │ │ ├── AbstractKafkaListenerEndpoint.java │ │ │ ├── CompositeKafkaStreamsCustomizer.java │ │ │ ├── ConcurrentKafkaListenerContainerFactory.java │ │ │ ├── KafkaListenerConfigUtils.java │ │ │ ├── KafkaListenerContainerFactory.java │ │ │ ├── KafkaListenerEndpoint.java │ │ │ ├── KafkaListenerEndpointAdapter.java │ │ │ ├── KafkaListenerEndpointRegistrar.java │ │ │ ├── KafkaListenerEndpointRegistry.java │ │ │ ├── KafkaStreamsConfiguration.java │ │ │ ├── KafkaStreamsCustomizer.java │ │ │ ├── MethodKafkaListenerEndpoint.java │ │ │ ├── MultiMethodKafkaListenerEndpoint.java │ │ │ ├── StreamsBuilderFactoryBean.java │ │ │ └── package-info.java │ │ │ ├── core │ │ │ ├── CleanupConfig.java │ │ │ ├── ConsumerFactory.java │ │ │ ├── DefaultKafkaConsumerFactory.java │ │ │ ├── DefaultKafkaProducerFactory.java │ │ │ ├── KafkaAdmin.java │ │ │ ├── KafkaOperations.java │ │ │ ├── KafkaProducerException.java │ │ │ ├── KafkaResourceHolder.java │ │ │ ├── KafkaTemplate.java │ │ │ ├── ProducerFactory.java │ │ │ ├── ProducerFactoryUtils.java │ │ │ └── package-info.java │ │ │ ├── event │ │ │ ├── ConsumerPausedEvent.java │ │ │ ├── ConsumerResumedEvent.java │ │ │ ├── ConsumerStoppedEvent.java │ │ │ ├── KafkaEvent.java │ │ │ ├── ListenerContainerIdleEvent.java │ │ │ ├── NonResponsiveConsumerEvent.java │ │ │ └── package-info.java │ │ │ ├── listener │ │ │ ├── AbstractMessageListenerContainer.java │ │ │ ├── AcknowledgingConsumerAwareMessageListener.java │ │ │ ├── AcknowledgingMessageListener.java │ │ │ ├── AfterRollbackProcessor.java │ │ │ ├── BatchAcknowledgingConsumerAwareMessageListener.java │ │ │ ├── BatchAcknowledgingMessageListener.java │ │ │ ├── BatchConsumerAwareMessageListener.java │ │ │ ├── BatchErrorHandler.java │ │ │ ├── BatchLoggingErrorHandler.java │ │ │ ├── BatchMessageListener.java │ │ │ ├── ConcurrentMessageListenerContainer.java │ │ │ ├── ConsumerAwareBatchErrorHandler.java │ │ │ ├── ConsumerAwareErrorHandler.java │ │ │ ├── ConsumerAwareListenerErrorHandler.java │ │ │ ├── ConsumerAwareMessageListener.java │ │ │ ├── ConsumerAwareRebalanceListener.java │ │ │ ├── ConsumerSeekAware.java │ │ │ ├── ContainerAwareBatchErrorHandler.java │ │ │ ├── ContainerAwareErrorHandler.java │ │ │ ├── ContainerProperties.java │ │ │ ├── ContainerStoppingBatchErrorHandler.java │ │ │ ├── ContainerStoppingErrorHandler.java │ │ │ ├── DeadLetterPublishingRecoverer.java │ │ │ ├── DefaultAfterRollbackProcessor.java │ │ │ ├── DelegatingMessageListener.java │ │ │ ├── ErrorHandler.java │ │ │ ├── FailedRecordTracker.java │ │ │ ├── GenericErrorHandler.java │ │ │ ├── GenericMessageListener.java │ │ │ ├── GenericMessageListenerContainer.java │ │ │ ├── KafkaListenerErrorHandler.java │ │ │ ├── KafkaMessageListenerContainer.java │ │ │ ├── ListenerExecutionFailedException.java │ │ │ ├── ListenerType.java │ │ │ ├── ListenerUtils.java │ │ │ ├── LoggingErrorHandler.java │ │ │ ├── MessageListener.java │ │ │ ├── MessageListenerContainer.java │ │ │ ├── RemainingRecordsErrorHandler.java │ │ │ ├── SeekToCurrentBatchErrorHandler.java │ │ │ ├── SeekToCurrentErrorHandler.java │ │ │ ├── adapter │ │ │ │ ├── AbstractDelegatingMessageListenerAdapter.java │ │ │ │ ├── AbstractFilteringMessageListener.java │ │ │ │ ├── AbstractRetryingMessageListenerAdapter.java │ │ │ │ ├── BatchMessagingMessageListenerAdapter.java │ │ │ │ ├── DelegatingInvocableHandler.java │ │ │ │ ├── FilteringBatchMessageListenerAdapter.java │ │ │ │ ├── FilteringMessageListenerAdapter.java │ │ │ │ ├── HandlerAdapter.java │ │ │ │ ├── InvocationResult.java │ │ │ │ ├── MessagingMessageListenerAdapter.java │ │ │ │ ├── RecordFilterStrategy.java │ │ │ │ ├── RecordMessagingMessageListenerAdapter.java │ │ │ │ ├── ReplyHeadersConfigurer.java │ │ │ │ ├── RetryingMessageListenerAdapter.java │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── requestreply │ │ │ ├── CorrelationKey.java │ │ │ ├── ReplyingKafkaOperations.java │ │ │ ├── ReplyingKafkaTemplate.java │ │ │ ├── RequestReplyFuture.java │ │ │ └── package-info.java │ │ │ ├── security │ │ │ └── jaas │ │ │ │ ├── KafkaJaasLoginModuleInitializer.java │ │ │ │ └── package-info.java │ │ │ ├── support │ │ │ ├── AbstractKafkaHeaderMapper.java │ │ │ ├── Acknowledgment.java │ │ │ ├── CompositeProducerListener.java │ │ │ ├── DefaultKafkaHeaderMapper.java │ │ │ ├── JacksonPresent.java │ │ │ ├── KafkaHeaderMapper.java │ │ │ ├── KafkaHeaders.java │ │ │ ├── KafkaNull.java │ │ │ ├── KafkaUtils.java │ │ │ ├── LogIfLevelEnabled.java │ │ │ ├── LoggingProducerListener.java │ │ │ ├── ProducerListener.java │ │ │ ├── ProducerListenerAdapter.java │ │ │ ├── SeekUtils.java │ │ │ ├── SendResult.java │ │ │ ├── SimpleKafkaHeaderMapper.java │ │ │ ├── TopicPartitionInitialOffset.java │ │ │ ├── TransactionSupport.java │ │ │ ├── converter │ │ │ │ ├── AbstractJavaTypeMapper.java │ │ │ │ ├── BatchMessageConverter.java │ │ │ │ ├── BatchMessagingMessageConverter.java │ │ │ │ ├── BytesJsonMessageConverter.java │ │ │ │ ├── ClassMapper.java │ │ │ │ ├── ConversionException.java │ │ │ │ ├── DefaultJackson2JavaTypeMapper.java │ │ │ │ ├── Jackson2JavaTypeMapper.java │ │ │ │ ├── KafkaMessageHeaders.java │ │ │ │ ├── MessageConverter.java │ │ │ │ ├── MessagingMessageConverter.java │ │ │ │ ├── ProjectingMessageConverter.java │ │ │ │ ├── RecordMessageConverter.java │ │ │ │ ├── StringJsonMessageConverter.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── serializer │ │ │ │ ├── DeserializationException.java │ │ │ │ ├── ErrorHandlingDeserializer.java │ │ │ │ ├── JsonDeserializer.java │ │ │ │ ├── JsonSerde.java │ │ │ │ └── JsonSerializer.java │ │ │ └── transaction │ │ │ ├── ChainedKafkaTransactionManager.java │ │ │ ├── KafkaAwareTransactionManager.java │ │ │ ├── KafkaTransactionManager.java │ │ │ └── package-info.java │ └── resources │ │ ├── application.properties │ │ ├── log4j.properties │ │ └── logback.xml └── test │ └── java │ └── org │ └── apache │ └── example │ └── learn │ └── learn │ └── LearnApplicationTests.java └── target └── classes ├── application.properties └── log4j.properties /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | *.class 3 | *.jar 4 | *.log 5 | /logs/* 6 | /target/* 7 | .gitignore 8 | .classpath 9 | .settings* 10 | .project 11 | /.idea/* 12 | */wrapper/* 13 | /learn2/.idea/libraries 14 | /learn2/.idea 15 | *.iml 16 | *HELP.md 17 | *mvnw.cmd 18 | *mvnw 19 | *maven-wrapper.jar 20 | *maven-wrapper.properties 21 | *.jar 22 | /learn1/.mvn/wrapper/*.jar 23 | /learn1/.mvn/wrapper 24 | -------------------------------------------------------------------------------- /learn1/src/main/java/com/kafka/learn/LearnApplication.java: -------------------------------------------------------------------------------- 1 | package com.kafka.learn; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class LearnApplication { 8 | 9 | public static void main(String[] args) { 10 | 11 | SpringApplication.run(LearnApplication.class, args); 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /learn1/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicklyc/kafka_client/d4dad256a1166fb79a87823f955820367d23b331/learn1/src/main/resources/application.properties -------------------------------------------------------------------------------- /learn1/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | log4j.rootLogger=info,error,CONSOLE 16 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 17 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 18 | log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n 19 | log4j.logger.org.apache.kafka=info 20 | -------------------------------------------------------------------------------- /learn1/src/test/java/com/kafka/learn/learn/LearnApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.kafka.learn.learn; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class LearnApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/LearnApplication.java: -------------------------------------------------------------------------------- 1 | package org.apache.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | /** 6 | * 启动类 7 | * 8 | * @author maochao 9 | * @date 2019/6/19 10 | */ 11 | @SpringBootApplication 12 | public class LearnApplication { 13 | public static void main(String[] args) { 14 | SpringApplication.run(LearnApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/admin/TopicAdmin.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.admin; 2 | 3 | import org.apache.kafka.clients.admin.*; 4 | 5 | import java.util.Arrays; 6 | import java.util.Properties; 7 | 8 | /** 9 | * 操作topic的类 10 | * 11 | * @author maochao 12 | * @since 2019/7/31 21:02 13 | */ 14 | public class TopicAdmin { 15 | public static final String url = "39.100.104.199:9092"; 16 | public static AdminClient client; 17 | 18 | public static void main(String[] args) { 19 | createTopics(); 20 | } 21 | 22 | 23 | /*** 24 | * 创建 topics 25 | */ 26 | static void createTopics() { 27 | NewTopic topic = new NewTopic("admin_create", 4, (short)1); 28 | CreateTopicsResult result = client.createTopics(Arrays.asList(topic)); 29 | try { 30 | result.all().get(); 31 | } catch (Exception e) { 32 | e.printStackTrace(); 33 | } 34 | } 35 | 36 | /** 37 | * 初始化 client 38 | */ 39 | static { 40 | Properties properties = new Properties(); 41 | properties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, url); 42 | properties.put(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, 3000); 43 | // 创建topic 44 | client = KafkaAdminClient.create(properties); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/config/KafkaConsumerConfig.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.config; 2 | 3 | /** 4 | * @author maochao 5 | * @since 2019/8/6 13:42 6 | */ 7 | 8 | import org.apache.example.learn2.consumer.ConsumerConf; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.kafka.annotation.EnableKafka; 12 | import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory; 13 | import org.springframework.kafka.core.ConsumerFactory; 14 | import org.springframework.kafka.core.DefaultKafkaConsumerFactory; 15 | 16 | @Configuration 17 | @EnableKafka 18 | public class KafkaConsumerConfig { 19 | 20 | @Bean 21 | public ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory() { 22 | ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); 23 | factory.setConsumerFactory(consumerFactory()); 24 | return factory; 25 | } 26 | 27 | @Bean 28 | public ConsumerFactory consumerFactory() { 29 | return new DefaultKafkaConsumerFactory(ConsumerConf.initProperties()); 30 | } 31 | 32 | 33 | } -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/consumer/ConsumerConf.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.consumer; 2 | 3 | import org.apache.kafka.clients.consumer.ConsumerConfig; 4 | import org.apache.kafka.common.serialization.StringDeserializer; 5 | 6 | import java.util.Properties; 7 | import java.util.UUID; 8 | 9 | /** 10 | * 消费者配置 11 | * 12 | * @author maochao 13 | * @date 2019/6/15 14 | */ 15 | public class ConsumerConf { 16 | public static final String url = "39.100.104.199:9092"; 17 | public static final String topic = "learn2"; 18 | 19 | public static Properties initProperties() { 20 | Properties properties = new Properties(); 21 | properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); 22 | properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, url); 23 | properties.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID().toString()); 24 | properties.put(org.apache.kafka.clients.consumer.ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); 25 | 26 | // 自定义解码器 27 | // properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, KryoDeserializer.class.getName()); 28 | properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ProtostuffDerializer.class.getName()); 29 | return properties; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/consumer/ProtostuffDerializer.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.consumer; 2 | 3 | import org.apache.example.learn2.entity.KafkaMessage; 4 | import org.apache.example.learn2.util.ProtostuffUtil; 5 | import org.apache.kafka.common.serialization.Deserializer; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * @author maochao 11 | * @since 2019/7/8 19:29 12 | */ 13 | public class ProtostuffDerializer implements Deserializer { 14 | @Override 15 | public void configure(Map configs, boolean isKey) { 16 | 17 | } 18 | 19 | @Override 20 | public Object deserialize(String topic, byte[] data) { 21 | return ProtostuffUtil.deserialize(data, KafkaMessage.class); 22 | } 23 | 24 | @Override 25 | public void close() { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/consumer/spring/AbstractConsumer.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.consumer.spring; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.kafka.clients.consumer.ConsumerRecord; 6 | 7 | /** 8 | * @author maochao 9 | * @since 2019/8/6 12:48 10 | */ 11 | 12 | public class AbstractConsumer implements SpringKafkaConsumer { 13 | 14 | @Override 15 | public void onMessageBatch(List> consumerRecords) { 16 | 17 | } 18 | 19 | @Override 20 | public void onMessage(ConsumerRecord record) { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/consumer/spring/SpringConsumer.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.consumer.spring; 2 | 3 | import org.apache.kafka.clients.consumer.ConsumerRecord; 4 | import org.springframework.kafka.annotation.KafkaListener; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * @author maochao 9 | * @since 2019/8/6 12:45 10 | */ 11 | @Service 12 | public class SpringConsumer extends AbstractConsumer { 13 | 14 | 15 | @Override 16 | 17 | public void onMessage(ConsumerRecord record) { 18 | System.out.println(record); 19 | } 20 | 21 | @KafkaListener( 22 | topics = "learn2", 23 | groupId = "learn") 24 | public void listen(Object data) { 25 | System.out.println(data); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/consumer/spring/SpringKafkaConsumer.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.consumer.spring; 2 | 3 | import org.apache.kafka.clients.consumer.ConsumerRecord; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author maochao 9 | * @since 2019/8/6 12:42 10 | */ 11 | public interface SpringKafkaConsumer { 12 | 13 | /** 14 | * 监听接口 15 | * @param records 16 | */ 17 | public void onMessageBatch(List> records); 18 | 19 | public void onMessage(ConsumerRecord record); 20 | } 21 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/entity/KafkaMessage.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 消息对象 7 | * 8 | * @author 9 | * @date 2019/6/15 10 | */ 11 | 12 | public class KafkaMessage implements Serializable { 13 | private String id; 14 | // 消息对象 15 | private Message message; 16 | // .....其他属性 17 | 18 | public String getId() { 19 | return id; 20 | } 21 | 22 | public void setId(String id) { 23 | this.id = id; 24 | } 25 | 26 | public Message getMessage() { 27 | return message; 28 | } 29 | 30 | public void setMessage(Message message) { 31 | this.message = message; 32 | } 33 | 34 | public class Message implements Serializable { 35 | 36 | public Long getValue() { 37 | return value; 38 | } 39 | 40 | public void setValue(Long value) { 41 | this.value = value; 42 | } 43 | 44 | private Long value; 45 | // ....其他属性 46 | } 47 | 48 | public Message builder() { 49 | return new Message(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/producer/Producer.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.producer; 2 | 3 | import org.apache.example.learn2.entity.KafkaMessage; 4 | import org.apache.kafka.clients.producer.KafkaProducer; 5 | import org.apache.kafka.clients.producer.ProducerRecord; 6 | 7 | /** 8 | * 生产者 9 | * 10 | * @author 11 | * @date 2019/6/15 12 | */ 13 | 14 | public class Producer { 15 | public static void main(String[] args) throws InterruptedException { 16 | 17 | KafkaProducer producer = new KafkaProducer(ProducerConf.initProperties()); 18 | KafkaMessage kafkaMessage = new KafkaMessage(); 19 | kafkaMessage.setId("测试id"); 20 | KafkaMessage.Message message = kafkaMessage.builder(); 21 | message.setValue(99999L); 22 | 23 | ProducerRecord record = new ProducerRecord(ProducerConf.topic, "hellotest", kafkaMessage); 24 | int i=0; 25 | while (true) { 26 | System.out.println("第"+ ++i +"次发送开始"); 27 | producer.send(record, (metadata, exception) -> { 28 | System.out.println("exception ==》" + exception); 29 | System.out.println("metadata ==》" + metadata); 30 | }); 31 | System.out.println("第"+ i +"次发送结束"); 32 | //producer.flush(); 33 | Thread.sleep(1000); 34 | // producer.close(); 35 | } 36 | 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/example/learn2/producer/ProtostuffSerializer.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn2.producer; 2 | 3 | import org.apache.kafka.common.serialization.Serializer; 4 | import org.apache.example.learn2.util.ProtostuffUtil; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * 10 | * ProtostuffSerializer 编码器 11 | * 12 | * @author maochao 13 | * @since 2019/7/8 17:58 14 | * 15 | */ 16 | public class ProtostuffSerializer implements Serializer { 17 | 18 | @Override 19 | public void configure(Map configs, boolean isKey) { 20 | 21 | } 22 | 23 | @Override 24 | public byte[] serialize(String topic, Object data) { 25 | return ProtostuffUtil.serialize(data); 26 | } 27 | 28 | @Override 29 | public void close() { 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/README.md: -------------------------------------------------------------------------------- 1 | 从maven仓库解压的kafka-clients-2.0.0-sources.jar 然后将代码拷贝到此处 2 | 去除kafka-clients的maven依赖,拷入maven仓库中kafka-clients-2.0.0.pom所使用的依赖 -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/RequestCompletionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.clients; 18 | 19 | /** 20 | * A callback interface for attaching an action to be executed when a request is complete and the corresponding response 21 | * has been received. This handler will also be invoked if there is a disconnection while handling the request. 22 | */ 23 | public interface RequestCompletionHandler { 24 | 25 | public void onComplete(ClientResponse response); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/StaleMetadataException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.clients; 18 | 19 | import org.apache.kafka.common.errors.InvalidMetadataException; 20 | 21 | /** 22 | * Thrown when current metadata cannot be used. This is often used as a way to trigger a metadata 23 | * update before retrying another operation. 24 | *

25 | * Note: this is not a public API. 26 | */ 27 | public class StaleMetadataException extends InvalidMetadataException { 28 | private static final long serialVersionUID = 1L; 29 | 30 | public StaleMetadataException() { 31 | } 32 | 33 | public StaleMetadataException(String message) { 34 | super(message); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/admin/AlterReplicaLogDirsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.clients.admin; 19 | 20 | import org.apache.kafka.common.annotation.InterfaceStability; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * Options for {@link AdminClient#alterReplicaLogDirs(Map, AlterReplicaLogDirsOptions)}. 26 | */ 27 | @InterfaceStability.Evolving 28 | public class AlterReplicaLogDirsOptions extends AbstractOptions { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/admin/DeleteConsumerGroupsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.clients.admin; 18 | 19 | import org.apache.kafka.common.annotation.InterfaceStability; 20 | 21 | import java.util.Collection; 22 | 23 | /** 24 | * Options for the {@link AdminClient#deleteConsumerGroups(Collection)} call. 25 | *

26 | * The API of this class is evolving, see {@link AdminClient} for details. 27 | */ 28 | @InterfaceStability.Evolving 29 | public class DeleteConsumerGroupsOptions extends AbstractOptions { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/admin/DeleteRecordsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.clients.admin; 19 | 20 | import org.apache.kafka.common.annotation.InterfaceStability; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * Options for {@link AdminClient#deleteRecords(Map, DeleteRecordsOptions)}. 26 | *

27 | * The API of this class is evolving, see {@link AdminClient} for details. 28 | */ 29 | @InterfaceStability.Evolving 30 | public class DeleteRecordsOptions extends AbstractOptions { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.clients.admin; 19 | 20 | import org.apache.kafka.common.annotation.InterfaceStability; 21 | 22 | import java.util.Collection; 23 | 24 | /** 25 | * Options for {@link AdminClient#describeConsumerGroups(Collection, DescribeConsumerGroupsOptions)}. 26 | *

27 | * The API of this class is evolving, see {@link AdminClient} for details. 28 | */ 29 | @InterfaceStability.Evolving 30 | public class DescribeConsumerGroupsOptions extends AbstractOptions { 31 | } -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/admin/DescribeLogDirsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.clients.admin; 19 | 20 | import org.apache.kafka.common.annotation.InterfaceStability; 21 | 22 | import java.util.Collection; 23 | 24 | 25 | /** 26 | * Options for {@link AdminClient#describeLogDirs(Collection)} 27 | *

28 | * The API of this class is evolving, see {@link AdminClient} for details. 29 | */ 30 | @InterfaceStability.Evolving 31 | public class DescribeLogDirsOptions extends AbstractOptions { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/admin/DescribeReplicaLogDirsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.clients.admin; 19 | 20 | import org.apache.kafka.common.annotation.InterfaceStability; 21 | 22 | import java.util.Collection; 23 | 24 | /** 25 | * Options for {@link AdminClient#describeReplicaLogDirs(Collection)}. 26 | *

27 | * The API of this class is evolving, see {@link AdminClient} for details. 28 | */ 29 | @InterfaceStability.Evolving 30 | public class DescribeReplicaLogDirsOptions extends AbstractOptions { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/admin/ListConsumerGroupsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.clients.admin; 19 | 20 | import org.apache.kafka.common.annotation.InterfaceStability; 21 | 22 | /** 23 | * Options for {@link AdminClient#listConsumerGroups()}. 24 | *

25 | * The API of this class is evolving, see {@link AdminClient} for details. 26 | */ 27 | @InterfaceStability.Evolving 28 | public class ListConsumerGroupsOptions extends AbstractOptions { 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/consumer/OffsetResetStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.apache.kafka.clients.consumer; 14 | 15 | /** 16 | * 重置offset 策略 对应---> auto.offset.reset的三种配置 17 | */ 18 | public enum OffsetResetStrategy { 19 | /** 20 | * 重置到LATEST 的偏移量 21 | * 自动重置偏移到最新的偏移 22 | */ 23 | LATEST, 24 | /** 25 | * 自动将偏移重置为最早的偏移量 26 | * 意味着:重头开始消费 27 | */ 28 | EARLIEST, 29 | /** 30 | * 不进行重置 31 | * 如果没有找到消费者组的先前偏移量,则向消费者抛出异常 32 | */ 33 | NONE 34 | } 35 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/consumer/internals/NoAvailableBrokersException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.clients.consumer.internals; 18 | 19 | import org.apache.kafka.common.errors.InvalidMetadataException; 20 | 21 | /** 22 | * No brokers were available to complete a request. 23 | */ 24 | public class NoAvailableBrokersException extends InvalidMetadataException { 25 | private static final long serialVersionUID = 1L; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/consumer/internals/NoOpConsumerRebalanceListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.clients.consumer.internals; 18 | 19 | import org.apache.kafka.clients.consumer.ConsumerRebalanceListener; 20 | import org.apache.kafka.common.TopicPartition; 21 | 22 | import java.util.Collection; 23 | 24 | public class NoOpConsumerRebalanceListener implements ConsumerRebalanceListener { 25 | 26 | @Override 27 | public void onPartitionsAssigned(Collection partitions) { 28 | } 29 | 30 | @Override 31 | public void onPartitionsRevoked(Collection partitions) { 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/consumer/internals/RequestFutureAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.clients.consumer.internals; 18 | 19 | /** 20 | * Adapt from a request future of one type to another. 21 | * 22 | * @param Type to adapt from 23 | * @param Type to adapt to 24 | */ 25 | public abstract class RequestFutureAdapter { 26 | 27 | public abstract void onSuccess(F value, RequestFuture future); 28 | 29 | public void onFailure(RuntimeException e, RequestFuture future) { 30 | future.raise(e); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/consumer/internals/RequestFutureListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.clients.consumer.internals; 18 | 19 | /** 20 | * Listener interface to hook into RequestFuture completion. 21 | */ 22 | public interface RequestFutureListener { 23 | 24 | void onSuccess(T value); 25 | 26 | void onFailure(RuntimeException e); 27 | } 28 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/clients/producer/BufferExhaustedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.apache.kafka.clients.producer; 14 | 15 | import org.apache.kafka.common.KafkaException; 16 | 17 | /** 18 | * This exception is thrown if the producer is in non-blocking mode and the rate of data production exceeds the rate at 19 | * which data can be sent for long enough for the allocated buffer to be exhausted. Buffer 20 | * 21 | * 耗尽时候抛出的异常 如果生产者处于非阻塞模式并且数据生成速率超过数据发送的速率足够长的时间以使分配的缓冲区耗尽,则抛出此异常。 22 | */ 23 | public class BufferExhaustedException extends KafkaException { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | public BufferExhaustedException(String message) { 28 | super(message); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/Configurable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.apache.kafka.common; 14 | 15 | import java.util.Map; 16 | 17 | /** 18 | * A Mix-in style interface for classes that are instantiated by reflection and need to take configuration parameters 19 | */ 20 | public interface Configurable { 21 | 22 | /** 23 | * 初始化配置 24 | * 25 | * 将配置初始化到自己的成员中进行持有 26 | */ 27 | void configure(Map configs); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/KafkaException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common; 18 | 19 | /** 20 | * The base class of all other Kafka exceptions 21 | */ 22 | public class KafkaException extends RuntimeException { 23 | 24 | private final static long serialVersionUID = 1L; 25 | 26 | public KafkaException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public KafkaException(String message) { 31 | super(message); 32 | } 33 | 34 | public KafkaException(Throwable cause) { 35 | super(cause); 36 | } 37 | 38 | public KafkaException() { 39 | super(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/Metric.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common; 18 | 19 | /** 20 | * A metric tracked for monitoring purposes. 21 | */ 22 | public interface Metric { 23 | 24 | /** 25 | * A name for this metric 26 | */ 27 | MetricName metricName(); 28 | 29 | /** 30 | * The value of the metric as double if the metric is measurable and `0.0` otherwise. 31 | * 32 | * @deprecated As of 1.0.0, use {@link #metricValue()} instead. This will be removed in a future major release. 33 | */ 34 | @Deprecated 35 | double value(); 36 | 37 | /** 38 | * The value of the metric, which may be measurable or a non-measurable gauge 39 | */ 40 | Object metricValue(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/config/Config.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.config; 18 | 19 | import java.util.List; 20 | 21 | public class Config { 22 | private final List configValues; 23 | 24 | public Config(List configValues) { 25 | this.configValues = configValues; 26 | } 27 | 28 | public List configValues() { 29 | return configValues; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/config/ConfigChangeCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.config; 18 | 19 | import org.apache.kafka.common.config.provider.ConfigProvider; 20 | 21 | /** 22 | * A callback passed to {@link ConfigProvider} for subscribing to changes. 23 | */ 24 | public interface ConfigChangeCallback { 25 | 26 | /** 27 | * Performs an action when configuration data changes. 28 | * 29 | * @param path the path at which the data resides 30 | * @param data the configuration data 31 | */ 32 | void onChange(String path, ConfigData data); 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/AuthorizationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class AuthorizationException extends ApiException { 20 | 21 | public AuthorizationException(String message) { 22 | super(message); 23 | } 24 | 25 | public AuthorizationException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/BrokerNotAvailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class BrokerNotAvailableException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public BrokerNotAvailableException(String message) { 24 | super(message); 25 | } 26 | 27 | public BrokerNotAvailableException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/ClusterAuthorizationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class ClusterAuthorizationException extends AuthorizationException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public ClusterAuthorizationException(String message) { 24 | super(message); 25 | } 26 | 27 | public ClusterAuthorizationException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/ConcurrentTransactionsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class ConcurrentTransactionsException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public ConcurrentTransactionsException(final String message) { 23 | super(message); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/ControllerMovedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class ControllerMovedException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public ControllerMovedException(String message) { 24 | super(message); 25 | } 26 | 27 | public ControllerMovedException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/DelegationTokenAuthorizationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class DelegationTokenAuthorizationException extends AuthorizationException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public DelegationTokenAuthorizationException(String message) { 24 | super(message); 25 | } 26 | 27 | public DelegationTokenAuthorizationException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/DelegationTokenDisabledException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class DelegationTokenDisabledException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public DelegationTokenDisabledException(String message) { 24 | super(message); 25 | } 26 | 27 | public DelegationTokenDisabledException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/DelegationTokenExpiredException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class DelegationTokenExpiredException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public DelegationTokenExpiredException(String message) { 24 | super(message); 25 | } 26 | 27 | public DelegationTokenExpiredException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/DelegationTokenNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class DelegationTokenNotFoundException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public DelegationTokenNotFoundException(String message) { 24 | super(message); 25 | } 26 | 27 | public DelegationTokenNotFoundException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/DelegationTokenOwnerMismatchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class DelegationTokenOwnerMismatchException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public DelegationTokenOwnerMismatchException(String message) { 24 | super(message); 25 | } 26 | 27 | public DelegationTokenOwnerMismatchException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/DuplicateSequenceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class DuplicateSequenceException extends ApiException { 20 | 21 | public DuplicateSequenceException(String message) { 22 | super(message); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/FetchSessionIdNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.common.errors; 19 | 20 | public class FetchSessionIdNotFoundException extends RetriableException { 21 | private static final long serialVersionUID = 1L; 22 | 23 | public FetchSessionIdNotFoundException() { 24 | } 25 | 26 | public FetchSessionIdNotFoundException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/GroupAuthorizationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class GroupAuthorizationException extends AuthorizationException { 20 | private final String groupId; 21 | 22 | public GroupAuthorizationException(String groupId) { 23 | super("Not authorized to access group: " + groupId); 24 | this.groupId = groupId; 25 | } 26 | 27 | public String groupId() { 28 | return groupId; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/GroupIdNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class GroupIdNotFoundException extends ApiException { 20 | public GroupIdNotFoundException(String message) { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/GroupNotEmptyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class GroupNotEmptyException extends ApiException { 20 | public GroupNotEmptyException(String message) { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/IllegalGenerationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class IllegalGenerationException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public IllegalGenerationException() { 23 | super(); 24 | } 25 | 26 | public IllegalGenerationException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public IllegalGenerationException(String message) { 31 | super(message); 32 | } 33 | 34 | public IllegalGenerationException(Throwable cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/IllegalSaslStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * This exception indicates unexpected requests prior to SASL authentication. 21 | * This could be due to misconfigured security, e.g. if PLAINTEXT protocol 22 | * is used to connect to a SASL endpoint. 23 | */ 24 | public class IllegalSaslStateException extends AuthenticationException { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | public IllegalSaslStateException(String message) { 29 | super(message); 30 | } 31 | 32 | public IllegalSaslStateException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InconsistentGroupProtocolException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InconsistentGroupProtocolException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public InconsistentGroupProtocolException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public InconsistentGroupProtocolException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidCommitOffsetSizeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidCommitOffsetSizeException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public InvalidCommitOffsetSizeException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public InvalidCommitOffsetSizeException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidConfigurationException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public InvalidConfigurationException(String message) { 24 | super(message); 25 | } 26 | 27 | public InvalidConfigurationException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidFetchSessionEpochException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.common.errors; 19 | 20 | public class InvalidFetchSessionEpochException extends RetriableException { 21 | private static final long serialVersionUID = 1L; 22 | 23 | public InvalidFetchSessionEpochException() { 24 | } 25 | 26 | public InvalidFetchSessionEpochException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidFetchSizeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidFetchSizeException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public InvalidFetchSizeException(String message) { 24 | super(message); 25 | } 26 | 27 | public InvalidFetchSizeException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidGroupIdException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidGroupIdException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public InvalidGroupIdException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public InvalidGroupIdException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidOffsetException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Thrown when the offset for a set of partitions is invalid (either undefined or out of range), 21 | * and no reset policy has been configured. 22 | * 23 | * @see OffsetOutOfRangeException 24 | */ 25 | public class InvalidOffsetException extends ApiException { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | public InvalidOffsetException(String message) { 30 | super(message); 31 | } 32 | 33 | public InvalidOffsetException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidPartitionsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidPartitionsException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public InvalidPartitionsException(String message) { 24 | super(message); 25 | } 26 | 27 | public InvalidPartitionsException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidPidMappingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidPidMappingException extends ApiException { 20 | public InvalidPidMappingException(String message) { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidPrincipalTypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidPrincipalTypeException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public InvalidPrincipalTypeException(String message) { 24 | super(message); 25 | } 26 | 27 | public InvalidPrincipalTypeException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidReplicaAssignmentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidReplicaAssignmentException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public InvalidReplicaAssignmentException(String message) { 24 | super(message); 25 | } 26 | 27 | public InvalidReplicaAssignmentException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidReplicationFactorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidReplicationFactorException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public InvalidReplicationFactorException(String message) { 24 | super(message); 25 | } 26 | 27 | public InvalidReplicationFactorException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Thrown when a request breaks basic wire protocol rules. 21 | * This most likely occurs because of a request being malformed by the client library or 22 | * the message was sent to an incompatible broker. 23 | */ 24 | public class InvalidRequestException extends ApiException { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | public InvalidRequestException(String message) { 29 | super(message); 30 | } 31 | 32 | public InvalidRequestException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidRequiredAcksException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidRequiredAcksException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public InvalidRequiredAcksException(String message) { 23 | super(message); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidSessionTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidSessionTimeoutException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public InvalidSessionTimeoutException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public InvalidSessionTimeoutException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidTimestampException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Indicate the timestamp of a record is invalid. 21 | */ 22 | public class InvalidTimestampException extends ApiException { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | public InvalidTimestampException(String message) { 27 | super(message); 28 | } 29 | 30 | public InvalidTimestampException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidTxnStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class InvalidTxnStateException extends ApiException { 20 | public InvalidTxnStateException(String message) { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/InvalidTxnTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * The transaction coordinator returns this error code if the timeout received via the InitProducerIdRequest is larger than 21 | * the `transaction.max.timeout.ms` config value. 22 | */ 23 | public class InvalidTxnTimeoutException extends ApiException { 24 | private static final long serialVersionUID = 1L; 25 | 26 | public InvalidTxnTimeoutException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public InvalidTxnTimeoutException(String message) { 31 | super(message); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/LeaderNotAvailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * There is no currently available leader for the given partition (either because a leadership election is in progress 21 | * or because all replicas are down). 22 | * 23 | * 给定分区目前没有可用的领导者(因为领导选举正在进行中,或者因为所有副本都已关闭) 24 | */ 25 | public class LeaderNotAvailableException extends InvalidMetadataException { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | public LeaderNotAvailableException(String message) { 30 | super(message); 31 | } 32 | 33 | public LeaderNotAvailableException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/LogDirNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Thrown when a request is made for a log directory that is not present on the broker 21 | */ 22 | public class LogDirNotFoundException extends ApiException { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | public LogDirNotFoundException(String message) { 27 | super(message); 28 | } 29 | 30 | public LogDirNotFoundException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public LogDirNotFoundException(Throwable cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/NotControllerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class NotControllerException extends RetriableException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public NotControllerException(String message) { 24 | super(message); 25 | } 26 | 27 | public NotControllerException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/NotEnoughReplicasAfterAppendException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Number of insync replicas for the partition is lower than min.insync.replicas This exception is raised when the low 21 | * ISR size is discovered *after* the message was already appended to the log. Producer retries will cause duplicates. 22 | */ 23 | public class NotEnoughReplicasAfterAppendException extends RetriableException { 24 | private static final long serialVersionUID = 1L; 25 | 26 | public NotEnoughReplicasAfterAppendException(String message) { 27 | super(message); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/OffsetOutOfRangeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * No reset policy has been defined, and the offsets for these partitions are either larger or smaller 21 | * than the range of offsets the server has for the given partition. 22 | */ 23 | public class OffsetOutOfRangeException extends InvalidOffsetException { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | public OffsetOutOfRangeException(String message) { 28 | super(message); 29 | } 30 | 31 | public OffsetOutOfRangeException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/OperationNotAttemptedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Indicates that the broker did not attempt to execute this operation. This may happen for batched RPCs where some 21 | * operations in the batch failed, causing the broker to respond without trying the rest. 22 | */ 23 | public class OperationNotAttemptedException extends ApiException { 24 | public OperationNotAttemptedException(final String message) { 25 | super(message); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/PolicyViolationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Exception thrown if a create topics request does not satisfy the configured policy for a topic. 21 | */ 22 | public class PolicyViolationException extends ApiException { 23 | 24 | public PolicyViolationException(String message) { 25 | super(message); 26 | } 27 | 28 | public PolicyViolationException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/ProducerFencedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * This fatal exception indicates that another producer with the same transactional.id has been 21 | * started. It is only possible to have one producer instance with a transactional.id at any 22 | * given time, and the latest one to be started "fences" the previous instances so that they can no longer 23 | * make transactional requests. When you encounter this exception, you must close the producer instance. 24 | */ 25 | public class ProducerFencedException extends ApiException { 26 | 27 | public ProducerFencedException(String msg) { 28 | super(msg); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/ReassignmentInProgressException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.kafka.common.errors; 19 | 20 | /** 21 | * Thrown if a request cannot be completed because a partition reassignment is in progress. 22 | */ 23 | public class ReassignmentInProgressException extends ApiException { 24 | 25 | public ReassignmentInProgressException(String msg) { 26 | super(msg); 27 | } 28 | 29 | public ReassignmentInProgressException(String msg, Throwable cause) { 30 | super(msg, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/RebalanceInProgressException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class RebalanceInProgressException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public RebalanceInProgressException() { 23 | super(); 24 | } 25 | 26 | public RebalanceInProgressException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public RebalanceInProgressException(String message) { 31 | super(message); 32 | } 33 | 34 | public RebalanceInProgressException(Throwable cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/ReplicaNotAvailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class ReplicaNotAvailableException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public ReplicaNotAvailableException(String message) { 24 | super(message); 25 | } 26 | 27 | public ReplicaNotAvailableException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public ReplicaNotAvailableException(Throwable cause) { 32 | super(cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/RetriableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * A retryable exception is a transient exception that if retried may succeed. 21 | */ 22 | public abstract class RetriableException extends ApiException { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | public RetriableException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public RetriableException(String message) { 31 | super(message); 32 | } 33 | 34 | public RetriableException(Throwable cause) { 35 | super(cause); 36 | } 37 | 38 | public RetriableException() { 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/SecurityDisabledException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * An error indicating that security is disabled on the broker. 21 | */ 22 | public class SecurityDisabledException extends ApiException { 23 | private static final long serialVersionUID = 1L; 24 | 25 | public SecurityDisabledException(String message) { 26 | super(message); 27 | } 28 | 29 | public SecurityDisabledException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/TimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Indicates that a request timed out. 21 | * 请求超时异常 22 | */ 23 | public class TimeoutException extends RetriableException { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | public TimeoutException() { 28 | super(); 29 | } 30 | 31 | public TimeoutException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | 35 | public TimeoutException(String message) { 36 | super(message); 37 | } 38 | 39 | public TimeoutException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/TopicExistsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class TopicExistsException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public TopicExistsException(String message) { 24 | super(message); 25 | } 26 | 27 | public TopicExistsException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/TransactionCoordinatorFencedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class TransactionCoordinatorFencedException extends ApiException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public TransactionCoordinatorFencedException(String message) { 24 | super(message); 25 | } 26 | 27 | public TransactionCoordinatorFencedException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/TransactionalIdAuthorizationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class TransactionalIdAuthorizationException extends AuthorizationException { 20 | public TransactionalIdAuthorizationException(final String message) { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/UnknownMemberIdException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | public class UnknownMemberIdException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public UnknownMemberIdException() { 23 | super(); 24 | } 25 | 26 | public UnknownMemberIdException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public UnknownMemberIdException(String message) { 31 | super(message); 32 | } 33 | 34 | public UnknownMemberIdException(Throwable cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/UnsupportedByAuthenticationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * Authentication mechanism does not support the requested function. 21 | */ 22 | public class UnsupportedByAuthenticationException extends ApiException { 23 | private static final long serialVersionUID = 1L; 24 | 25 | public UnsupportedByAuthenticationException(String message) { 26 | super(message); 27 | } 28 | 29 | public UnsupportedByAuthenticationException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/UnsupportedSaslMechanismException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | /** 20 | * This exception indicates that the SASL mechanism requested by the client 21 | * is not enabled on the broker. 22 | */ 23 | public class UnsupportedSaslMechanismException extends AuthenticationException { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | public UnsupportedSaslMechanismException(String message) { 28 | super(message); 29 | } 30 | 31 | public UnsupportedSaslMechanismException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/errors/WakeupException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.errors; 18 | 19 | import org.apache.kafka.common.KafkaException; 20 | 21 | /** 22 | * Exception used to indicate preemption of a blocking operation by an external thread. 23 | * For example, {@link org.apache.kafka.clients.consumer.KafkaConsumer#wakeup} 24 | * can be used to break out of an active {@link org.apache.kafka.clients.consumer.KafkaConsumer#poll(java.time.Duration)}, 25 | * which would raise an instance of this exception. 26 | */ 27 | public class WakeupException extends KafkaException { 28 | private static final long serialVersionUID = 1L; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/header/Header.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.header; 18 | 19 | public interface Header { 20 | 21 | String key(); 22 | 23 | byte[] value(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/metrics/Gauge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.metrics; 18 | 19 | /** 20 | * A gauge metric is an instantaneous reading of a particular value. 21 | */ 22 | public interface Gauge extends MetricValueProvider { 23 | 24 | /** 25 | * Returns the current value associated with this gauge. 26 | * 27 | * @param config The configuration for this metric 28 | * @param now The POSIX time in milliseconds the measurement is being taken 29 | */ 30 | T value(MetricConfig config, long now); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/metrics/Measurable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.metrics; 18 | 19 | /** 20 | * A measurable quantity that can be registered as a metric 21 | */ 22 | public interface Measurable extends MetricValueProvider { 23 | 24 | /** 25 | * Measure this quantity and return the result as a double 26 | * 27 | * @param config The configuration for this metric 28 | * @param now The POSIX time in milliseconds the measurement is being taken 29 | * @return The measured value 30 | */ 31 | double measure(MetricConfig config, long now); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/metrics/MeasurableStat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.metrics; 18 | 19 | /** 20 | * A MeasurableStat is a {@link Stat} that is also {@link Measurable} (i.e. can produce a single floating point value). 21 | * This is the interface used for most of the simple statistics such as {@link org.apache.kafka.common.metrics.stats.Avg}, 22 | * {@link org.apache.kafka.common.metrics.stats.Max}, {@link org.apache.kafka.common.metrics.stats.Count}, etc. 23 | */ 24 | public interface MeasurableStat extends Stat, Measurable { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/metrics/MetricValueProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.metrics; 18 | 19 | /** 20 | * Super-interface for {@link Measurable} or {@link Gauge} that provides 21 | * metric values. 22 | *

23 | * In the future for Java8 and above, {@link Gauge#value(MetricConfig, long)} will be 24 | * moved to this interface with a default implementation in {@link Measurable} that returns 25 | * {@link Measurable#measure(MetricConfig, long)}. 26 | *

27 | */ 28 | public interface MetricValueProvider { 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/metrics/Stat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.metrics; 18 | 19 | /** 20 | * A Stat is a quantity such as average, max, etc that is computed off the stream of updates to a sensor 21 | */ 22 | public interface Stat { 23 | 24 | /** 25 | * Record the given value 26 | * 27 | * @param config The configuration to use for this metric 28 | * @param value The value to record 29 | * @param timeMs The POSIX time in milliseconds this value occurred 30 | */ 31 | public void record(MetricConfig config, double value, long timeMs); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/metrics/stats/Percentile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.metrics.stats; 18 | 19 | import org.apache.kafka.common.MetricName; 20 | 21 | public class Percentile { 22 | 23 | private final MetricName name; 24 | private final double percentile; 25 | 26 | public Percentile(MetricName name, double percentile) { 27 | super(); 28 | this.name = name; 29 | this.percentile = percentile; 30 | } 31 | 32 | public MetricName name() { 33 | return this.name; 34 | } 35 | 36 | public double percentile() { 37 | return this.percentile; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/metrics/stats/Value.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.metrics.stats; 18 | 19 | import org.apache.kafka.common.metrics.MeasurableStat; 20 | import org.apache.kafka.common.metrics.MetricConfig; 21 | 22 | /** 23 | * An instantaneous value. 24 | */ 25 | public class Value implements MeasurableStat { 26 | private double value = 0; 27 | 28 | @Override 29 | public double measure(MetricConfig config, long now) { 30 | return value; 31 | } 32 | 33 | @Override 34 | public void record(MetricConfig config, double value, long timeMs) { 35 | this.value = value; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/network/InvalidReceiveException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.network; 18 | 19 | import org.apache.kafka.common.KafkaException; 20 | 21 | public class InvalidReceiveException extends KafkaException { 22 | 23 | public InvalidReceiveException(String message) { 24 | super(message); 25 | } 26 | 27 | public InvalidReceiveException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/network/ListenerReconfigurable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.network; 18 | 19 | import org.apache.kafka.common.Reconfigurable; 20 | 21 | /** 22 | * Interface for reconfigurable entities associated with a listener. 23 | */ 24 | public interface ListenerReconfigurable extends Reconfigurable { 25 | 26 | /** 27 | * Returns the listener name associated with this reconfigurable. Listener-specific 28 | * configs corresponding to this listener name are provided for reconfiguration. 29 | */ 30 | ListenerName listenerName(); 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/network/Mode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.network; 18 | 19 | /** 20 | * SSL和SASL连接 连接模式。 21 | */ 22 | public enum Mode {CLIENT, SERVER} 23 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/protocol/types/BoundField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.protocol.types; 18 | 19 | /** 20 | * A field definition bound to a particular schema. 21 | */ 22 | public class BoundField { 23 | public final Field def; 24 | final int index; 25 | final Schema schema; 26 | 27 | public BoundField(Field def, Schema schema, int index) { 28 | this.def = def; 29 | this.schema = schema; 30 | this.index = index; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return def.name + ":" + def.type; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/protocol/types/SchemaException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.protocol.types; 18 | 19 | import org.apache.kafka.common.KafkaException; 20 | 21 | /** 22 | * Thrown if the protocol schema validation fails while parsing request or response. 23 | */ 24 | public class SchemaException extends KafkaException { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | public SchemaException(String message) { 29 | super(message); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/record/AbstractRecordBatch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.record; 18 | 19 | abstract class AbstractRecordBatch implements RecordBatch { 20 | 21 | @Override 22 | public boolean hasProducerId() { 23 | return RecordBatch.NO_PRODUCER_ID < producerId(); 24 | } 25 | 26 | @Override 27 | public long nextOffset() { 28 | return lastOffset() + 1; 29 | } 30 | 31 | @Override 32 | public boolean isCompressed() { 33 | return compressionType() != CompressionType.NONE; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/record/BaseRecords.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.record; 18 | 19 | /** 20 | * Base interface for accessing records which could be contained in the log, or an in-memory materialization of log records. 21 | */ 22 | public interface BaseRecords { 23 | /** 24 | * The size of these records in bytes. 25 | * 26 | * @return The size in bytes of the records 27 | */ 28 | int sizeInBytes(); 29 | 30 | /** 31 | * Encapsulate this {@link BaseRecords} object into {@link RecordsSend} 32 | * 33 | * @return Initialized {@link RecordsSend} object 34 | */ 35 | RecordsSend toSend(String destination); 36 | } 37 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/record/ConvertedRecords.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.record; 18 | 19 | public class ConvertedRecords { 20 | 21 | private final T records; 22 | private final RecordConversionStats recordConversionStats; 23 | 24 | public ConvertedRecords(T records, RecordConversionStats recordConversionStats) { 25 | this.records = records; 26 | this.recordConversionStats = recordConversionStats; 27 | } 28 | 29 | public T records() { 30 | return records; 31 | } 32 | 33 | public RecordConversionStats recordConversionStats() { 34 | return recordConversionStats; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/record/InvalidRecordException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.record; 18 | 19 | import org.apache.kafka.common.errors.CorruptRecordException; 20 | 21 | public class InvalidRecordException extends CorruptRecordException { 22 | 23 | private static final long serialVersionUID = 1; 24 | 25 | public InvalidRecordException(String s) { 26 | super(s); 27 | } 28 | 29 | public InvalidRecordException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/requests/IsolationLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.requests; 18 | 19 | public enum IsolationLevel { 20 | READ_UNCOMMITTED((byte) 0), READ_COMMITTED((byte) 1); 21 | 22 | private final byte id; 23 | 24 | IsolationLevel(byte id) { 25 | this.id = id; 26 | } 27 | 28 | public byte id() { 29 | return id; 30 | } 31 | 32 | public static IsolationLevel forId(byte id) { 33 | switch (id) { 34 | case 0: 35 | return READ_UNCOMMITTED; 36 | case 1: 37 | return READ_COMMITTED; 38 | default: 39 | throw new IllegalArgumentException("Unknown isolation level " + id); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/requests/RequestAndSize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.requests; 18 | 19 | public class RequestAndSize { 20 | public final AbstractRequest request; 21 | public final int size; 22 | 23 | public RequestAndSize(AbstractRequest request, int size) { 24 | this.request = request; 25 | this.size = size; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/requests/TransactionResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.requests; 18 | 19 | public enum TransactionResult { 20 | ABORT(false), COMMIT(true); 21 | 22 | public final boolean id; 23 | 24 | TransactionResult(boolean id) { 25 | this.id = id; 26 | } 27 | 28 | public static TransactionResult forId(boolean id) { 29 | if (id) { 30 | return TransactionResult.COMMIT; 31 | } 32 | return TransactionResult.ABORT; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/security/authenticator/DefaultLogin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.security.authenticator; 18 | 19 | public class DefaultLogin extends AbstractLogin { 20 | 21 | @Override 22 | public String serviceName() { 23 | return "kafka"; 24 | } 25 | 26 | @Override 27 | public void close() { 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/security/kerberos/BadFormatString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.security.kerberos; 18 | 19 | import java.io.IOException; 20 | 21 | public class BadFormatString extends IOException { 22 | BadFormatString(String msg) { 23 | super(msg); 24 | } 25 | 26 | BadFormatString(String msg, Throwable err) { 27 | super(msg, err); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/security/kerberos/NoMatchingRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.security.kerberos; 18 | 19 | import java.io.IOException; 20 | 21 | public class NoMatchingRule extends IOException { 22 | NoMatchingRule(String msg) { 23 | super(msg); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/security/token/delegation/internals/DelegationTokenCredentialCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.security.token.delegation.internals; 18 | 19 | import org.apache.kafka.common.security.scram.ScramCredentialCallback; 20 | 21 | public class DelegationTokenCredentialCallback extends ScramCredentialCallback { 22 | private String tokenOwner; 23 | 24 | public void tokenOwner(String tokenOwner) { 25 | this.tokenOwner = tokenOwner; 26 | } 27 | 28 | public String tokenOwner() { 29 | return tokenOwner; 30 | } 31 | } -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/serialization/ByteArrayDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.serialization; 18 | 19 | import java.util.Map; 20 | 21 | public class ByteArrayDeserializer implements Deserializer { 22 | 23 | @Override 24 | public void configure(Map configs, boolean isKey) { 25 | // nothing to do 26 | } 27 | 28 | @Override 29 | public byte[] deserialize(String topic, byte[] data) { 30 | return data; 31 | } 32 | 33 | @Override 34 | public void close() { 35 | // nothing to do 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/serialization/ByteArraySerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.serialization; 18 | 19 | import java.util.Map; 20 | 21 | public class ByteArraySerializer implements Serializer { 22 | 23 | @Override 24 | public void configure(Map configs, boolean isKey) { 25 | // nothing to do 26 | } 27 | 28 | @Override 29 | public byte[] serialize(String topic, byte[] data) { 30 | return data; 31 | } 32 | 33 | @Override 34 | public void close() { 35 | // nothing to do 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/serialization/ByteBufferDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.serialization; 18 | 19 | import java.nio.ByteBuffer; 20 | import java.util.Map; 21 | 22 | public class ByteBufferDeserializer implements Deserializer { 23 | 24 | public void configure(Map configs, boolean isKey) { 25 | // nothing to do 26 | } 27 | 28 | public ByteBuffer deserialize(String topic, byte[] data) { 29 | if (data == null) 30 | return null; 31 | 32 | return ByteBuffer.wrap(data); 33 | } 34 | 35 | public void close() { 36 | // nothing to do 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/serialization/BytesDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.serialization; 18 | 19 | import org.apache.kafka.common.utils.Bytes; 20 | 21 | import java.util.Map; 22 | 23 | public class BytesDeserializer implements Deserializer { 24 | 25 | public void configure(Map configs, boolean isKey) { 26 | // nothing to do 27 | } 28 | 29 | public Bytes deserialize(String topic, byte[] data) { 30 | if (data == null) 31 | return null; 32 | 33 | return new Bytes(data); 34 | } 35 | 36 | public void close() { 37 | // nothing to do 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/serialization/BytesSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.serialization; 18 | 19 | import org.apache.kafka.common.utils.Bytes; 20 | 21 | import java.util.Map; 22 | 23 | public class BytesSerializer implements Serializer { 24 | 25 | public void configure(Map configs, boolean isKey) { 26 | // nothing to do 27 | } 28 | 29 | public byte[] serialize(String topic, Bytes data) { 30 | if (data == null) 31 | return null; 32 | 33 | return data.get(); 34 | } 35 | 36 | public void close() { 37 | // nothing to do 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/serialization/ShortSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.serialization; 18 | 19 | import java.util.Map; 20 | 21 | public class ShortSerializer implements Serializer { 22 | 23 | public void configure(Map configs, boolean isKey) { 24 | // nothing to do 25 | } 26 | 27 | public byte[] serialize(String topic, Short data) { 28 | if (data == null) 29 | return null; 30 | 31 | return new byte[]{ 32 | (byte) (data >>> 8), 33 | data.byteValue() 34 | }; 35 | } 36 | 37 | public void close() { 38 | // nothing to do 39 | } 40 | } -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/utils/CloseableIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.utils; 18 | 19 | import java.io.Closeable; 20 | import java.util.Iterator; 21 | 22 | /** 23 | * Iterators that need to be closed in order to release resources should implement this interface. 24 | *

25 | * Warning: before implementing this interface, consider if there are better options. The chance of misuse is 26 | * a bit high since people are used to iterating without closing. 27 | */ 28 | public interface CloseableIterator extends Iterator, Closeable { 29 | void close(); 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/common/utils/OperatingSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.common.utils; 18 | 19 | import java.util.Locale; 20 | 21 | public final class OperatingSystem { 22 | 23 | private OperatingSystem() { 24 | } 25 | 26 | public static final String NAME; 27 | 28 | public static final boolean IS_WINDOWS; 29 | 30 | static { 31 | NAME = System.getProperty("os.name").toLowerCase(Locale.ROOT); 32 | IS_WINDOWS = NAME.startsWith("windows"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/apache/kafka/server/quota/ClientQuotaType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.kafka.server.quota; 18 | 19 | /** 20 | * Types of quotas that may be configured on brokers for client requests. 21 | */ 22 | public enum ClientQuotaType { 23 | PRODUCE, 24 | FETCH, 25 | REQUEST 26 | } 27 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/example/MyMessageListener.java: -------------------------------------------------------------------------------- 1 | package org.springframework.example; 2 | 3 | import org.apache.kafka.clients.consumer.ConsumerRecord; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.kafka.listener.MessageListener; 7 | 8 | import java.util.concurrent.CountDownLatch; 9 | 10 | /** 11 | * 自动提交 ,或者容器管理提交 12 | * 13 | * @author maochao 14 | * @since 2019/8/6 16:41 15 | */ 16 | public class MyMessageListener implements MessageListener { 17 | private static final Logger logger = LoggerFactory.getLogger(SpringKafkaTest.class); 18 | 19 | private CountDownLatch latch; 20 | 21 | public MyMessageListener(CountDownLatch latch) { 22 | this.latch = latch; 23 | } 24 | 25 | @Override 26 | public void onMessage(ConsumerRecord data) { 27 | logger.info("收到消息===>" + data.toString()); 28 | latch.countDown(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/example/config/TopicConfig.java: -------------------------------------------------------------------------------- 1 | package org.springframework.example.config; 2 | 3 | import org.apache.kafka.clients.admin.AdminClientConfig; 4 | import org.apache.kafka.clients.admin.NewTopic; 5 | import org.apache.example.learn2.producer.ProducerConf; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.kafka.core.KafkaAdmin; 9 | 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | /** 14 | * Topic 配置 15 | * @author maochao 16 | * @since 2019/8/6 20:11 17 | */ 18 | @Configuration 19 | public class TopicConfig { 20 | 21 | @Bean 22 | public KafkaAdmin admin() { 23 | Map configs = new HashMap<>(); 24 | configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, ProducerConf.url); 25 | return new KafkaAdmin(configs); 26 | } 27 | 28 | @Bean(name="learn") 29 | public NewTopic topicLearn() { 30 | return new NewTopic("foo", 10, (short) 1); 31 | } 32 | 33 | @Bean(name="bar") 34 | public NewTopic TopciBar() { 35 | return new NewTopic("bar", 10, (short) 1); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/example/consumer/ConsumerErrorHander.java: -------------------------------------------------------------------------------- 1 | package org.springframework.example.consumer; 2 | 3 | import org.apache.kafka.clients.consumer.Consumer; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.kafka.listener.KafkaListenerErrorHandler; 7 | import org.springframework.kafka.listener.ListenerExecutionFailedException; 8 | import org.springframework.messaging.Message; 9 | import org.springframework.stereotype.Component; 10 | 11 | /** 12 | * 消费者异常处理 13 | * 14 | * @author maochao 15 | * @since 2019/8/7 15:05 16 | */ 17 | @Component 18 | public class ConsumerErrorHander implements KafkaListenerErrorHandler { 19 | private static final Logger logger = LoggerFactory.getLogger(ConsumerErrorHander.class); 20 | 21 | @Override 22 | public Object handleError(Message message, ListenerExecutionFailedException exception) throws Exception { 23 | logger.info("message : "+message.toString()); 24 | logger.info("exception : "+exception.getMessage(),exception); 25 | return null; 26 | } 27 | 28 | @Override 29 | public Object handleError(Message message, ListenerExecutionFailedException exception, Consumer consumer) throws Exception { 30 | 31 | logger.info("消费出现异常 : 异常处理 "); 32 | logger.info("message : "+message.toString()); 33 | logger.info("consumer : "+consumer.toString()); 34 | logger.info("exception : "+exception.getMessage(),exception); 35 | return null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/example/producer/MyproducerListener.java: -------------------------------------------------------------------------------- 1 | package org.springframework.example.producer; 2 | 3 | import org.apache.kafka.clients.producer.ProducerRecord; 4 | import org.apache.kafka.clients.producer.RecordMetadata; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.kafka.support.ProducerListener; 8 | 9 | /** 10 | * 监听的是template 11 | * 12 | * @author maochao 13 | * @since 2019/8/7 11:06 14 | */ 15 | public class MyproducerListener implements ProducerListener { 16 | private static final Logger logger = LoggerFactory.getLogger(MyproducerListener.class); 17 | 18 | @Override 19 | public void onSuccess(ProducerRecord producerRecord, RecordMetadata recordMetadata) { 20 | logger.info("发送成功" + producerRecord.toString()); 21 | } 22 | 23 | @Override 24 | public void onSuccess(String topic, Integer partition, Object key, Object value, RecordMetadata recordMetadata) { 25 | logger.info("发送成功 topic: " + topic + " value: " + value); 26 | } 27 | 28 | @Override 29 | public void onError(ProducerRecord producerRecord, Exception exception) { 30 | logger.info("发送失败 topic: " + producerRecord.toString()); 31 | } 32 | 33 | @Override 34 | public void onError(String topic, Integer partition, Object key, Object value, Exception exception) { 35 | logger.info("发送失败 topic: " + topic + " value: " + value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/example/producer/ProducerCallback.java: -------------------------------------------------------------------------------- 1 | package org.springframework.example.producer; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.kafka.support.SendResult; 6 | import org.springframework.util.concurrent.ListenableFutureCallback; 7 | 8 | /** 9 | * future 的回调 生产者发送消息回调 10 | * 11 | * @author maochao 12 | * @since 2019/8/6 20:29 13 | */ 14 | public class ProducerCallback implements ListenableFutureCallback> { 15 | private static final Logger logger = LoggerFactory.getLogger(ProducerCallback.class); 16 | 17 | @Override 18 | public void onFailure(Throwable throwable) { 19 | logger.info(throwable.getMessage(), throwable); 20 | // 返回失败处理 21 | } 22 | 23 | @Override 24 | public void onSuccess(SendResult result) { 25 | logger.info("发送成功"); 26 | logger.info(result.toString()); 27 | 28 | // 返回成功处理 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/KafkaException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka; 18 | 19 | import org.springframework.core.NestedRuntimeException; 20 | 21 | /** 22 | * The Spring Kafka specific {@link NestedRuntimeException} implementation. 23 | * 24 | * @author Gary Russell 25 | * @author Artem Bilan 26 | */ 27 | @SuppressWarnings("serial") 28 | public class KafkaException extends NestedRuntimeException { 29 | 30 | public KafkaException(String message) { 31 | super(message); 32 | } 33 | 34 | public KafkaException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/annotation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for kafka annotations 3 | */ 4 | package org.springframework.kafka.annotation; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/config/KafkaListenerConfigUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.config; 18 | 19 | /** 20 | * Configuration constants for internal sharing across subpackages. 21 | * 22 | * @author Juergen Hoeller 23 | * @author Gary Russell 24 | */ 25 | public abstract class KafkaListenerConfigUtils { 26 | 27 | /** 28 | * The bean name of the internally managed Kafka listener annotation processor. 29 | */ 30 | public static final String KAFKA_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME = 31 | "org.springframework.kafka.config.internalKafkaListenerAnnotationProcessor"; 32 | 33 | /** 34 | * The bean name of the internally managed Kafka listener endpoint registry. 35 | */ 36 | public static final String KAFKA_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME = 37 | "org.springframework.kafka.config.internalKafkaListenerEndpointRegistry"; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/config/KafkaStreamsCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.config; 18 | 19 | import org.apache.kafka.streams.KafkaStreams; 20 | 21 | /** 22 | * Callback interface that can be used to configure {@link KafkaStreams} directly. 23 | * 24 | * @author Nurettin Yilmaz 25 | * 26 | * @since 2.1.5 27 | * 28 | * @see StreamsBuilderFactoryBean 29 | */ 30 | @FunctionalInterface 31 | public interface KafkaStreamsCustomizer { 32 | 33 | void customize(KafkaStreams kafkaStreams); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/config/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for kafka configuration 3 | */ 4 | package org.springframework.kafka.config; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/core/CleanupConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.core; 18 | 19 | /** 20 | * Specifies time of {@link org.apache.kafka.streams.KafkaStreams#cleanUp()} execution. 21 | * 22 | * @author Pawel Szymczyk 23 | */ 24 | public class CleanupConfig { 25 | 26 | private final boolean onStart; 27 | 28 | private final boolean onStop; 29 | 30 | public CleanupConfig() { 31 | this(false, true); 32 | } 33 | 34 | public CleanupConfig(boolean onStart, boolean onStop) { 35 | this.onStart = onStart; 36 | this.onStop = onStop; 37 | } 38 | 39 | public boolean cleanupOnStart() { 40 | return this.onStart; 41 | } 42 | 43 | public boolean cleanupOnStop() { 44 | return this.onStop; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/core/KafkaProducerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.core; 18 | 19 | import org.apache.kafka.clients.producer.ProducerRecord; 20 | 21 | import org.springframework.kafka.KafkaException; 22 | 23 | /** 24 | * Exceptions when producing. 25 | * 26 | * @author Gary Russell 27 | * 28 | */ 29 | @SuppressWarnings("serial") 30 | public class KafkaProducerException extends KafkaException { 31 | 32 | private final ProducerRecord producerRecord; 33 | 34 | public KafkaProducerException(ProducerRecord failedProducerRecord, String message, Throwable cause) { 35 | super(message, cause); 36 | this.producerRecord = failedProducerRecord; 37 | } 38 | 39 | public ProducerRecord getProducerRecord() { 40 | return this.producerRecord; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/core/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for kafka core components 3 | */ 4 | @org.springframework.lang.NonNullApi 5 | package org.springframework.kafka.core; 6 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/event/KafkaEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.event; 18 | 19 | import org.springframework.context.ApplicationEvent; 20 | 21 | 22 | /** 23 | * Base class for events. 24 | * 25 | * @author Gary Russell 26 | * 27 | */ 28 | @SuppressWarnings("serial") 29 | public abstract class KafkaEvent extends ApplicationEvent { 30 | 31 | public KafkaEvent(Object source) { 32 | super(source); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/event/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Application Events. 3 | */ 4 | package org.springframework.kafka.event; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/ConsumerAwareListenerErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | import org.apache.kafka.clients.consumer.Consumer; 20 | 21 | import org.springframework.messaging.Message; 22 | 23 | /** 24 | * An error handler that has access to the consumer, for example to adjust 25 | * offsets after an error. 26 | * 27 | * @author Gary Russell 28 | * @since 2.0 29 | * 30 | */ 31 | @FunctionalInterface 32 | public interface ConsumerAwareListenerErrorHandler extends KafkaListenerErrorHandler { 33 | 34 | @Override 35 | default Object handleError(Message message, ListenerExecutionFailedException exception) throws Exception { 36 | throw new UnsupportedOperationException("Container should never call this"); 37 | } 38 | 39 | @Override 40 | Object handleError(Message message, ListenerExecutionFailedException exception, Consumer consumer); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/DelegatingMessageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | /** 20 | * Classes implementing this interface allow containers to determine the type of the 21 | * ultimate listener. 22 | * 23 | * @param the type received by the listener. 24 | * 25 | * @author Gary Russell 26 | * @since 2.0 27 | * 28 | */ 29 | public interface DelegatingMessageListener { 30 | 31 | /** 32 | * Return the delegate. 33 | * @return the delegate. 34 | */ 35 | T getDelegate(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/GenericErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | import org.apache.kafka.clients.consumer.Consumer; 20 | 21 | /** 22 | * A generic error handler. 23 | * 24 | * @param the data type. 25 | * 26 | * @author Gary Russell 27 | * @since 1.1 28 | * 29 | */ 30 | @FunctionalInterface 31 | public interface GenericErrorHandler { 32 | 33 | /** 34 | * Handle the exception. 35 | * @param thrownException The exception. 36 | * @param data the data. 37 | */ 38 | void handle(Exception thrownException, T data); 39 | 40 | /** 41 | * Handle the exception. 42 | * @param thrownException The exception. 43 | * @param data the data. 44 | * @param consumer the consumer. 45 | */ 46 | default void handle(Exception thrownException, T data, Consumer consumer) { 47 | handle(thrownException, data); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/GenericMessageListenerContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | /** 20 | * Generic message listener container; adds parameters. 21 | * 22 | * @param the key type. 23 | * @param the value type. 24 | * 25 | * @author Gary Russell 26 | * @since 2.1.3 27 | * 28 | */ 29 | public interface GenericMessageListenerContainer extends MessageListenerContainer { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/ListenerExecutionFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | import org.springframework.kafka.KafkaException; 20 | 21 | /** 22 | * The listener specific {@link KafkaException} extension. 23 | * 24 | * @author Gary Russell 25 | */ 26 | @SuppressWarnings("serial") 27 | public class ListenerExecutionFailedException extends KafkaException { 28 | 29 | public ListenerExecutionFailedException(String message) { 30 | super(message); 31 | } 32 | 33 | public ListenerExecutionFailedException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/ListenerType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | /** 20 | * Defines the listener type. 21 | * 22 | * @author Gary Russell 23 | * @since 2.0 24 | * 25 | */ 26 | public enum ListenerType { 27 | 28 | /** 29 | * Acknowledging and consumer aware. 30 | */ 31 | ACKNOWLEDGING_CONSUMER_AWARE, 32 | 33 | /** 34 | * Consumer aware. 35 | */ 36 | CONSUMER_AWARE, 37 | 38 | /** 39 | * Acknowledging. 40 | */ 41 | ACKNOWLEDGING, 42 | 43 | /** 44 | * Simple. 45 | */ 46 | SIMPLE 47 | 48 | } 49 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/LoggingErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | import org.apache.commons.logging.Log; 20 | import org.apache.commons.logging.LogFactory; 21 | import org.apache.kafka.clients.consumer.ConsumerRecord; 22 | 23 | import org.springframework.util.ObjectUtils; 24 | 25 | /** 26 | * The {@link ErrorHandler} implementation for logging purpose. 27 | * 28 | * @author Marius Bogoevici 29 | * @author Gary Russell 30 | */ 31 | public class LoggingErrorHandler implements ErrorHandler { 32 | 33 | private static final Log log = LogFactory.getLog(LoggingErrorHandler.class); 34 | 35 | @Override 36 | public void handle(Exception thrownException, ConsumerRecord record) { 37 | log.error("Error while processing: " + ObjectUtils.nullSafeToString(record), thrownException); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/MessageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener; 18 | 19 | import org.apache.kafka.clients.consumer.ConsumerRecord; 20 | 21 | /** 22 | * Listener for handling individual incoming Kafka messages. 23 | * 24 | * @param the key type. 25 | * @param the value type. 26 | * 27 | * @author Marius Bogoevici 28 | * @author Gary Russell 29 | */ 30 | @FunctionalInterface 31 | public interface MessageListener extends GenericMessageListener> { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/adapter/RecordFilterStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.listener.adapter; 18 | 19 | import org.apache.kafka.clients.consumer.ConsumerRecord; 20 | 21 | /** 22 | * Implementations of this interface can signal that a record about 23 | * to be delivered to a message listener should be discarded instead 24 | * of being delivered. 25 | * 26 | * @param the key type. 27 | * @param the value type. 28 | * 29 | * @author Gary Russell 30 | * 31 | */ 32 | public interface RecordFilterStrategy { 33 | 34 | /** 35 | * Return true if the record should be discarded. 36 | * @param consumerRecord the record. 37 | * @return true to discard. 38 | */ 39 | boolean filter(ConsumerRecord consumerRecord); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/adapter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides classes for adapting listeners. 3 | */ 4 | package org.springframework.kafka.listener.adapter; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/listener/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for kafka listeners 3 | */ 4 | package org.springframework.kafka.listener; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Base package for kafka 3 | */ 4 | package org.springframework.kafka; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/requestreply/ReplyingKafkaOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.requestreply; 18 | 19 | import org.apache.kafka.clients.producer.ProducerRecord; 20 | 21 | /** 22 | * Request/reply operations. 23 | * 24 | * @param the key type. 25 | * @param the outbound data type. 26 | * @param the reply data type. 27 | * 28 | * @author Gary Russell 29 | * @since 2.1.3 30 | * 31 | */ 32 | public interface ReplyingKafkaOperations { 33 | 34 | /** 35 | * Send a request and receive a reply. 36 | * @param record the record to send. 37 | * @return a RequestReplyFuture. 38 | */ 39 | RequestReplyFuture sendAndReceive(ProducerRecord record); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/requestreply/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides classes for request/reply semantics. 3 | */ 4 | package org.springframework.kafka.requestreply; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/security/jaas/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides classes related to jaas. 3 | */ 4 | package org.springframework.kafka.security.jaas; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/Acknowledgment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support; 18 | 19 | /** 20 | * Handle for acknowledging the processing of a 21 | * {@link org.apache.kafka.clients.consumer.ConsumerRecord}. Recipients can store the 22 | * reference in asynchronous scenarios, but the internal state should be assumed transient 23 | * (i.e. it cannot be serialized and deserialized later) 24 | * 25 | * @author Marius Bogoevici 26 | * @author Gary Russell 27 | */ 28 | public interface Acknowledgment { 29 | 30 | /** 31 | * Invoked when the message for which the acknowledgment has been created has been processed. 32 | * Calling this method implies that all the previous messages in the partition have been processed already. 33 | */ 34 | void acknowledge(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/JacksonPresent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support; 18 | 19 | import org.springframework.util.ClassUtils; 20 | 21 | /** 22 | * The utility to check if Jackson JSON processor is present in the classpath. 23 | * 24 | * @author Artem Bilan 25 | * @author Gary Russell 26 | * 27 | * @since 1.3 28 | */ 29 | public final class JacksonPresent { 30 | 31 | private static final ClassLoader classLoader = JacksonPresent.class.getClassLoader(); 32 | 33 | private static final boolean jackson2Present = 34 | ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader) && 35 | ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", classLoader); 36 | 37 | public static boolean isJackson2Present() { 38 | return jackson2Present; 39 | } 40 | 41 | private JacksonPresent() { 42 | super(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/KafkaNull.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support; 18 | 19 | /** 20 | * This class represents NULL Kafka payload. 21 | * 22 | * @author Dariusz Szablinski 23 | * @since 1.0.3 24 | */ 25 | public final class KafkaNull { 26 | 27 | /** 28 | * Instance of KafkaNull. 29 | */ 30 | public final static KafkaNull INSTANCE = new KafkaNull(); 31 | 32 | private KafkaNull() { 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/ProducerListenerAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support; 18 | 19 | /** 20 | * No-op implementation of {@link ProducerListener}, to be used as base class for other implementations. 21 | * 22 | * @deprecated as the {@link ProducerListener} has default methods and can be implemented directly without the need for this adapter 23 | * 24 | * @param the key type. 25 | * @param the value type. 26 | * 27 | * @author Marius Bogoevici 28 | * @author Gary Russell 29 | * @author Artem Bilan 30 | * @author Endika Gutiérrez 31 | */ 32 | @Deprecated 33 | public abstract class ProducerListenerAdapter implements ProducerListener { 34 | } 35 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/TransactionSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support; 18 | 19 | /** 20 | * Utilities for supporting transactions. 21 | * 22 | * @author Gary Russell 23 | * @since 1.3.7 24 | * 25 | */ 26 | public final class TransactionSupport { 27 | 28 | private static final ThreadLocal transactionIdSuffix = new ThreadLocal<>(); 29 | 30 | private TransactionSupport() { 31 | super(); 32 | } 33 | 34 | public static void setTransactionIdSuffix(String suffix) { 35 | transactionIdSuffix.set(suffix); 36 | } 37 | 38 | public static String getTransactionIdSuffix() { 39 | return transactionIdSuffix.get(); 40 | } 41 | 42 | public static void clearTransactionIdSuffix() { 43 | transactionIdSuffix.remove(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/converter/ClassMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support.converter; 18 | 19 | import org.apache.kafka.common.header.Headers; 20 | 21 | /** 22 | * Strategy for setting metadata on messages such that one can create the class 23 | * that needs to be instantiated when receiving a message. 24 | * 25 | * @author Mark Pollack 26 | * @author James Carr 27 | * @author Gary Russell 28 | * 29 | * @since 2.1 30 | */ 31 | public interface ClassMapper { 32 | 33 | void fromClass(Class clazz, Headers headers); 34 | 35 | Class toClass(Headers headers); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/converter/ConversionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support.converter; 18 | 19 | import org.springframework.kafka.KafkaException; 20 | 21 | /** 22 | * Exception for conversions. 23 | * 24 | * @author Gary Russell 25 | * 26 | */ 27 | @SuppressWarnings("serial") 28 | public class ConversionException extends KafkaException { 29 | 30 | public ConversionException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/converter/MessageConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.support.converter; 18 | 19 | /** 20 | * A top level interface for message converters. 21 | * 22 | * @author Gary Russell 23 | * @since 1.1 24 | * 25 | */ 26 | public interface MessageConverter { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/converter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for kafka converters 3 | */ 4 | package org.springframework.kafka.support.converter; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/support/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for kafka support 3 | */ 4 | package org.springframework.kafka.support; 5 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/transaction/KafkaAwareTransactionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.kafka.transaction; 18 | 19 | import org.springframework.kafka.core.ProducerFactory; 20 | import org.springframework.transaction.support.ResourceTransactionManager; 21 | 22 | /** 23 | * A transaction manager that can provide a {@link ProducerFactory}. 24 | * Currently a sub-interface of {@link ResourceTransactionManager} 25 | * for backwards compatibility. 26 | * 27 | * @param the key type. 28 | * @param the value type. 29 | * 30 | * @author Gary Russell 31 | * @since 2.1.3 32 | * 33 | */ 34 | public interface KafkaAwareTransactionManager extends ResourceTransactionManager { 35 | 36 | /** 37 | * Get the producer factory. 38 | * @return the producerFactory 39 | */ 40 | ProducerFactory getProducerFactory(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /learn2/src/main/java/org/springframework/kafka/transaction/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides classes related to transactions. 3 | */ 4 | package org.springframework.kafka.transaction; 5 | -------------------------------------------------------------------------------- /learn2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | logging.level.root=INFO 2 | server.port=9091 3 | logging.config=classpath:logback.xml 4 | info=true -------------------------------------------------------------------------------- /learn2/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | log4j.rootLogger=info,error,CONSOLE 16 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 17 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 18 | log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n 19 | log4j.logger.org.apache.kafka=info 20 | -------------------------------------------------------------------------------- /learn2/src/test/java/org/apache/example/learn/learn/LearnApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.apache.example.learn.learn; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class LearnApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /learn2/target/classes/application.properties: -------------------------------------------------------------------------------- 1 | logging.level.root=INFO 2 | server.port=9091 3 | logging.config=classpath:logback.xml 4 | info=true -------------------------------------------------------------------------------- /learn2/target/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | log4j.rootLogger=info,error,CONSOLE 16 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 17 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 18 | log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n 19 | log4j.logger.org.apache.kafka=info 20 | --------------------------------------------------------------------------------