Class ForwardingAdmin

  • All Implemented Interfaces:
    AutoCloseable, Admin

    public class ForwardingAdmin
    extends Object
    implements Admin
    ForwardingAdmin is the default value of forwarding.admin.class in MirrorMaker. Users who wish to customize the MirrorMaker behaviour for the creation of topics and access control lists can extend this class without needing to provide a whole implementation of Admin. The class must have a constructor with signature (Map<String, Object> config) for configuring a decorated KafkaAdminClient and any other clients needed for external resource management.
    • Constructor Detail

      • ForwardingAdmin

        public ForwardingAdmin​(Map<String,​Object> configs)
    • Method Detail

      • close

        public void close​(Duration timeout)
        Description copied from interface: Admin
        Close the Admin client and release all associated resources.

        The close operation has a grace period during which current operations will be allowed to complete, specified by the given duration. New operations will not be accepted during the grace period. Once the grace period is over, all operations that have not yet been completed will be aborted with a TimeoutException.

        Specified by:
        close in interface Admin
        Parameters:
        timeout - The time to use for the wait time.
      • createTopics

        public CreateTopicsResult createTopics​(Collection<NewTopic> newTopics,
                                               CreateTopicsOptions options)
        Description copied from interface: Admin
        Create a batch of new topics.

        This operation is not transactional so it may succeed for some topics while fail for others.

        It may take several seconds after CreateTopicsResult returns success for all the brokers to become aware that the topics have been created. During this time, Admin.listTopics() and Admin.describeTopics(Collection) may not return information about the new topics.

        This operation is supported by brokers with version 0.10.1.0 or higher. The validateOnly option is supported from version 0.10.2.0.

        Specified by:
        createTopics in interface Admin
        Parameters:
        newTopics - The new topics to create.
        options - The options to use when creating the new topics.
        Returns:
        The CreateTopicsResult.
      • deleteTopics

        public DeleteTopicsResult deleteTopics​(TopicCollection topics,
                                               DeleteTopicsOptions options)
        Description copied from interface: Admin
        Delete a batch of topics.

        This operation is not transactional so it may succeed for some topics while fail for others.

        It may take several seconds after the DeleteTopicsResult returns success for all the brokers to become aware that the topics are gone. During this time, Admin.listTopics() and Admin.describeTopics(Collection) may continue to return information about the deleted topics.

        If delete.topic.enable is false on the brokers, deleteTopics will mark the topics for deletion, but not actually delete them. The futures will return successfully in this case.

        When using topic IDs, this operation is supported by brokers with inter-broker protocol 2.8 or higher. When using topic names, this operation is supported by brokers with version 0.10.1.0 or higher.

        Specified by:
        deleteTopics in interface Admin
        Parameters:
        topics - The topics to delete.
        options - The options to use when deleting the topics.
        Returns:
        The DeleteTopicsResult.
      • listTopics

        public ListTopicsResult listTopics​(ListTopicsOptions options)
        Description copied from interface: Admin
        List the topics available in the cluster (or default stream if MapR).
        Specified by:
        listTopics in interface Admin
        Parameters:
        options - The options to use when listing the topics.
        Returns:
        The ListTopicsResult.
      • listTopics

        public ListTopicsResult listTopics​(String streamPath,
                                           ListTopicsOptions options)
        Description copied from interface: Admin
        MapR specific method, not available in Apache Kafka. List the topics available in the specified stream.
        Specified by:
        listTopics in interface Admin
        Parameters:
        streamPath - The name of the stream for which the topics should be listed
        options - The options to use when listing the topics.
        Returns:
        The ListTopicsResult.
      • describeTopics

        public DescribeTopicsResult describeTopics​(TopicCollection topics,
                                                   DescribeTopicsOptions options)
        Description copied from interface: Admin
        Describe some topics in the cluster. When using topic IDs, this operation is supported by brokers with version 3.1.0 or higher.
        Specified by:
        describeTopics in interface Admin
        Parameters:
        topics - The topics to describe.
        options - The options to use when describing the topics.
        Returns:
        The DescribeTopicsResult.
      • describeCluster

        public DescribeClusterResult describeCluster​(DescribeClusterOptions options)
        Description copied from interface: Admin
        Get information about the nodes in the cluster.
        Specified by:
        describeCluster in interface Admin
        Parameters:
        options - The options to use when getting information about the cluster.
        Returns:
        The DescribeClusterResult.
      • describeAcls

        public DescribeAclsResult describeAcls​(AclBindingFilter filter,
                                               DescribeAclsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Lists access control lists (ACLs) according to the supplied filter.

        Note: it may take some time for changes made by createAcls or deleteAcls to be reflected in the output of describeAcls.

        This operation is supported by brokers with version 0.11.0.0 or higher.

        Specified by:
        describeAcls in interface Admin
        Parameters:
        filter - The filter to use.
        options - The options to use when listing the ACLs.
        Returns:
        The DescribeAclsResult.
      • createAcls

        public CreateAclsResult createAcls​(Collection<AclBinding> acls,
                                           CreateAclsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Creates access control lists (ACLs) which are bound to specific resources.

        This operation is not transactional so it may succeed for some ACLs while fail for others.

        If you attempt to add an ACL that duplicates an existing ACL, no error will be raised, but no changes will be made.

        This operation is supported by brokers with version 0.11.0.0 or higher.

        Specified by:
        createAcls in interface Admin
        Parameters:
        acls - The ACLs to create
        options - The options to use when creating the ACLs.
        Returns:
        The CreateAclsResult.
      • deleteAcls

        public DeleteAclsResult deleteAcls​(Collection<AclBindingFilter> filters,
                                           DeleteAclsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Deletes access control lists (ACLs) according to the supplied filters.

        This operation is not transactional so it may succeed for some ACLs while fail for others.

        This operation is supported by brokers with version 0.11.0.0 or higher.

        Specified by:
        deleteAcls in interface Admin
        Parameters:
        filters - The filters to use.
        options - The options to use when deleting the ACLs.
        Returns:
        The DeleteAclsResult.
      • describeConfigs

        public DescribeConfigsResult describeConfigs​(Collection<ConfigResource> resources,
                                                     DescribeConfigsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Get the configuration for the specified resources.

        The returned configuration includes default values and the isDefault() method can be used to distinguish them from user supplied values.

        The value of config entries where isSensitive() is true is always null so that sensitive information is not disclosed.

        Config entries where isReadOnly() is true cannot be updated.

        This operation is supported by brokers with version 0.11.0.0 or higher.

        Specified by:
        describeConfigs in interface Admin
        Parameters:
        resources - The resources (topic and broker resource types are currently supported)
        options - The options to use when describing configs
        Returns:
        The DescribeConfigsResult
      • alterConfigs

        @Deprecated
        public AlterConfigsResult alterConfigs​(Map<ConfigResource,​Config> configs,
                                               AlterConfigsOptions options)
        Deprecated.
        Description copied from interface: Admin
        Not supported in MapR Admin. Update the configuration for the specified resources with the default options.

        Updates are not transactional so they may succeed for some resources while fail for others. The configs for a particular resource are updated atomically.

        This operation is supported by brokers with version 0.11.0.0 or higher.

        Specified by:
        alterConfigs in interface Admin
        Parameters:
        configs - The resources with their configs (topic is the only resource type with configs that can be updated currently)
        options - The options to use when describing configs
        Returns:
        The AlterConfigsResult
      • incrementalAlterConfigs

        public AlterConfigsResult incrementalAlterConfigs​(Map<ConfigResource,​Collection<AlterConfigOp>> configs,
                                                          AlterConfigsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Incrementally update the configuration for the specified resources.

        Updates are not transactional so they may succeed for some resources while fail for others. The configs for a particular resource are updated atomically.

        The following exceptions can be anticipated when calling get() on the futures obtained from the returned AlterConfigsResult:

        This operation is supported by brokers with version 2.3.0 or higher.

        Specified by:
        incrementalAlterConfigs in interface Admin
        Parameters:
        configs - The resources with their configs
        options - The options to use when altering configs
        Returns:
        The AlterConfigsResult
      • alterReplicaLogDirs

        public AlterReplicaLogDirsResult alterReplicaLogDirs​(Map<TopicPartitionReplica,​String> replicaAssignment,
                                                             AlterReplicaLogDirsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Change the log directory for the specified replicas. If the replica does not exist on the broker, the result shows REPLICA_NOT_AVAILABLE for the given replica and the replica will be created in the given log directory on the broker when it is created later. If the replica already exists on the broker, the replica will be moved to the given log directory if it is not already there. For detailed result, inspect the returned AlterReplicaLogDirsResult instance.

        This operation is not transactional so it may succeed for some replicas while fail for others.

        This operation is supported by brokers with version 1.1.0 or higher.

        Specified by:
        alterReplicaLogDirs in interface Admin
        Parameters:
        replicaAssignment - The replicas with their log directory absolute path
        options - The options to use when changing replica dir
        Returns:
        The AlterReplicaLogDirsResult
      • describeLogDirs

        public DescribeLogDirsResult describeLogDirs​(Collection<Integer> brokers,
                                                     DescribeLogDirsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Query the information of all log directories on the given set of brokers

        This operation is supported by brokers with version 1.0.0 or higher.

        Specified by:
        describeLogDirs in interface Admin
        Parameters:
        brokers - A list of brokers
        options - The options to use when querying log dir info
        Returns:
        The DescribeLogDirsResult
      • createPartitions

        public CreatePartitionsResult createPartitions​(Map<String,​NewPartitions> newPartitions,
                                                       CreatePartitionsOptions options)
        Description copied from interface: Admin
        Increase the number of partitions of the topics given as the keys of newPartitions according to the corresponding values. If partitions are increased for a topic that has a key, the partition logic or ordering of the messages will be affected.

        This operation is not transactional so it may succeed for some topics while fail for others.

        It may take several seconds after this method returns success for all the brokers to become aware that the partitions have been created. During this time, Admin.describeTopics(Collection) may not return information about the new partitions.

        This operation is supported by brokers with version 1.0.0 or higher.

        The following exceptions can be anticipated when calling get() on the futures obtained from the values() method of the returned CreatePartitionsResult

        Specified by:
        createPartitions in interface Admin
        Parameters:
        newPartitions - The topics which should have new partitions created, and corresponding parameters for the created partitions.
        options - The options to use when creating the new partitions.
        Returns:
        The CreatePartitionsResult.
      • deleteRecords

        public DeleteRecordsResult deleteRecords​(Map<TopicPartition,​RecordsToDelete> recordsToDelete,
                                                 DeleteRecordsOptions options)
        Description copied from interface: Admin
        Not supported in MapR Admin. Delete records whose offset is smaller than the given offset of the corresponding partition.

        This operation is supported by brokers with version 0.11.0.0 or higher.

        Specified by:
        deleteRecords in interface Admin
        Parameters:
        recordsToDelete - The topic partitions and related offsets from which records deletion starts.
        options - The options to use when deleting records.
        Returns:
        The DeleteRecordsResult.
      • electLeaders

        public ElectLeadersResult electLeaders​(ElectionType electionType,
                                               Set<TopicPartition> partitions,
                                               ElectLeadersOptions options)
        Description copied from interface: Admin
        Elect a replica as leader for the given partitions, or for all partitions if the argument to partitions is null.

        This operation is not transactional so it may succeed for some partitions while fail for others.

        It may take several seconds after this method returns success for all the brokers in the cluster to become aware that the partitions have new leaders. During this time, Admin.describeTopics(Collection) may not return information about the partitions' new leaders.

        This operation is supported by brokers with version 2.2.0 or later if preferred election is use; otherwise the brokers most be 2.4.0 or higher.

        The following exceptions can be anticipated when calling get() on the future obtained from the returned ElectLeadersResult:

        Specified by:
        electLeaders in interface Admin
        Parameters:
        electionType - The type of election to conduct.
        partitions - The topics and partitions for which to conduct elections.
        options - The options to use when electing the leaders.
        Returns:
        The ElectLeadersResult.
      • alterConsumerGroupOffsets

        public AlterConsumerGroupOffsetsResult alterConsumerGroupOffsets​(String groupId,
                                                                         Map<TopicPartition,​OffsetAndMetadata> offsets,
                                                                         AlterConsumerGroupOffsetsOptions options)
        Description copied from interface: Admin

        Alters offsets for the specified group. In order to succeed, the group must be empty.

        This operation is not transactional so it may succeed for some partitions while fail for others.

        Specified by:
        alterConsumerGroupOffsets in interface Admin
        Parameters:
        groupId - The group for which to alter offsets.
        offsets - A map of offsets by partition with associated metadata. Partitions not specified in the map are ignored.
        options - The options to use when altering the offsets.
        Returns:
        The AlterOffsetsResult.
      • listOffsets

        public ListOffsetsResult listOffsets​(Map<TopicPartition,​OffsetSpec> topicPartitionOffsets,
                                             ListOffsetsOptions options)
        Description copied from interface: Admin

        List offset for the specified partitions. This operation enables to find the beginning offset, end offset as well as the offset matching a timestamp in partitions. Note that in MapR Admin offset spec is ignored and this method returns only end offset regardless of offset spec

        Specified by:
        listOffsets in interface Admin
        Parameters:
        topicPartitionOffsets - The mapping from partition to the OffsetSpec to look up.
        options - The options to use when retrieving the offsets
        Returns:
        The ListOffsetsResult.
      • describeClientQuotas

        public DescribeClientQuotasResult describeClientQuotas​(ClientQuotaFilter filter,
                                                               DescribeClientQuotasOptions options)
        Description copied from interface: Admin
        Describes all entities matching the provided filter that have at least one client quota configuration value defined.

        The following exceptions can be anticipated when calling get() on the future from the returned DescribeClientQuotasResult:

        This operation is supported by brokers with version 2.6.0 or higher.

        Specified by:
        describeClientQuotas in interface Admin
        Parameters:
        filter - the filter to apply to match entities
        options - the options to use
        Returns:
        the DescribeClientQuotasResult containing the result
      • alterClientQuotas

        public AlterClientQuotasResult alterClientQuotas​(Collection<ClientQuotaAlteration> entries,
                                                         AlterClientQuotasOptions options)
        Description copied from interface: Admin
        Alters client quota configurations with the specified alterations.

        Alterations for a single entity are atomic, but across entities is not guaranteed. The resulting per-entity error code should be evaluated to resolve the success or failure of all updates.

        The following exceptions can be anticipated when calling get() on the futures obtained from the returned AlterClientQuotasResult:

        • ClusterAuthorizationException If the authenticated user didn't have alter access to the cluster.
        • InvalidRequestException If the request details are invalid. e.g., a configuration key was specified more than once for an entity.
        • TimeoutException If the request timed out before the alterations could finish. It cannot be guaranteed whether the update succeed or not.

        This operation is supported by brokers with version 2.6.0 or higher.

        Specified by:
        alterClientQuotas in interface Admin
        Parameters:
        entries - the alterations to perform
        Returns:
        the AlterClientQuotasResult containing the result
      • updateFeatures

        public UpdateFeaturesResult updateFeatures​(Map<String,​FeatureUpdate> featureUpdates,
                                                   UpdateFeaturesOptions options)
        Description copied from interface: Admin
        Applies specified updates to finalized features. This operation is not transactional so some updates may succeed while the rest may fail.

        The API takes in a map of finalized feature names to FeatureUpdate that needs to be applied. Each entry in the map specifies the finalized feature to be added or updated or deleted, along with the new max feature version level value. This request is issued only to the controller since the API is only served by the controller. The return value contains an error code for each supplied FeatureUpdate, and the code indicates if the update succeeded or failed in the controller.

        • Downgrade of feature version level is not a regular operation/intent. It is only allowed in the controller if the FeatureUpdate has the allowDowngrade flag set. Setting this flag conveys user intent to attempt downgrade of a feature max version level. Note that despite the allowDowngrade flag being set, certain downgrades may be rejected by the controller if it is deemed impossible.
        • Deletion of a finalized feature version is not a regular operation/intent. It could be done by setting the allowDowngrade flag to true in the FeatureUpdate, and, setting the max version level to a value less than 1.

        The following exceptions can be anticipated when calling get() on the futures obtained from the returned UpdateFeaturesResult:

        This operation is supported by brokers with version 2.7.0 or higher.

        Specified by:
        updateFeatures in interface Admin
        Parameters:
        featureUpdates - the map of finalized feature name to FeatureUpdate
        options - the options to use
        Returns:
        the UpdateFeaturesResult containing the result
      • unregisterBroker

        public UnregisterBrokerResult unregisterBroker​(int brokerId,
                                                       UnregisterBrokerOptions options)
        Description copied from interface: Admin
        Unregister a broker.

        This operation does not have any effect on partition assignments. It is supported only on Kafka clusters which use Raft to store metadata, rather than ZooKeeper. The following exceptions can be anticipated when calling get() on the future from the returned UnregisterBrokerResult:

        • TimeoutException If the request timed out before the describe operation could finish.
        • UnsupportedVersionException If the software is too old to support the unregistration API, or if the cluster is not using Raft to store metadata.

        Specified by:
        unregisterBroker in interface Admin
        Parameters:
        brokerId - the broker id to unregister.
        options - the options to use.
        Returns:
        the UnregisterBrokerResult containing the result
      • describeTransactions

        public DescribeTransactionsResult describeTransactions​(Collection<String> transactionalIds,
                                                               DescribeTransactionsOptions options)
        Description copied from interface: Admin
        Describe the state of a set of transactional IDs from the respective transaction coordinators, which are dynamically discovered.
        Specified by:
        describeTransactions in interface Admin
        Parameters:
        transactionalIds - The set of transactional IDs to query
        options - Options to control the method behavior
        Returns:
        The result
      • abortTransaction

        public AbortTransactionResult abortTransaction​(AbortTransactionSpec spec,
                                                       AbortTransactionOptions options)
        Description copied from interface: Admin
        Forcefully abort a transaction which is open on a topic partition. This will send a `WriteTxnMarkers` request to the partition leader in order to abort the transaction. This requires administrative privileges.
        Specified by:
        abortTransaction in interface Admin
        Parameters:
        spec - The transaction specification including topic partition and producer details
        options - Options to control the method behavior (including filters)
        Returns:
        The result
      • fenceProducers

        public FenceProducersResult fenceProducers​(Collection<String> transactionalIds,
                                                   FenceProducersOptions options)
        Description copied from interface: Admin
        Fence out all active producers that use any of the provided transactional IDs.
        Specified by:
        fenceProducers in interface Admin
        Parameters:
        transactionalIds - The IDs of the producers to fence.
        options - The options to use when fencing the producers.
        Returns:
        The FenceProducersResult.
      • metrics

        public Map<MetricName,​? extends Metric> metrics()
        Description copied from interface: Admin
        Get the metrics kept by the adminClient
        Specified by:
        metrics in interface Admin