クラス AbstractMessageListenerContainer<K,V>

java.lang.ObjectSE
org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V>
型パラメーター:
K - 鍵の型。
V - 値の型。
実装されたすべてのインターフェース:
AwareBeanNameAwareDisposableBeanApplicationContextAwareApplicationEventPublisherAwareLifecyclePhasedSmartLifecycleGenericMessageListenerContainer<K,V>MessageListenerContainer
既知の直属サブクラス
ConcurrentMessageListenerContainerKafkaMessageListenerContainer

public abstract class AbstractMessageListenerContainer<K,V> extends ObjectSE implements GenericMessageListenerContainer<K,V>, BeanNameAware, ApplicationEventPublisherAware, ApplicationContextAware
MessageListenerContainer の基本実装。
作成者:
Gary Russell, Marius Bogoevici, Artem Bilan, Tomaz Fernandes, Wang Zhiyang, Soby Chacko
  • フィールドの詳細

  • コンストラクターの詳細

    • AbstractMessageListenerContainer

      protected AbstractMessageListenerContainer(ConsumerFactory<? super K,? super V> consumerFactory, ContainerProperties containerProperties)
      提供されたファクトリとプロパティを使用してインスタンスを構築します。
      パラメーター:
      consumerFactory - ファクトリ。
      containerProperties - プロパティ。
  • メソッドの詳細

    • setApplicationContext

      public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
      次で指定:
      インターフェース ApplicationContextAwaresetApplicationContext 
      例外:
      BeansException
    • getApplicationContext

      @Nullable protected ApplicationContext getApplicationContext()
    • setBeanName

      public void setBeanName(StringSE name)
      次で指定:
      インターフェース BeanNameAwaresetBeanName 
    • getBeanName

      @Nullable public StringSE getBeanName()
      Bean 名を返します。
      戻り値:
      Bean 名。
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
      次で指定:
      インターフェース ApplicationEventPublisherAwaresetApplicationEventPublisher 
    • getApplicationEventPublisher

      @Nullable public ApplicationEventPublisher getApplicationEventPublisher()
      イベントの発行元を取得します。
      戻り値:
      パブリッシャー
    • getCommonErrorHandler

      @Nullable public CommonErrorHandler getCommonErrorHandler()
      CommonErrorHandler を取得します。
      戻り値:
      ハンドラー。
      導入:
      2.8
    • setCommonErrorHandler

      public void setCommonErrorHandler(@Nullable CommonErrorHandler commonErrorHandler)
      レコードリスナーとバッチリスナーの両方のエラーを処理できる CommonErrorHandler を設定します。
      パラメーター:
      commonErrorHandler - ハンドラー。
      導入:
      2.8
    • isStoppedNormally

      protected boolean isStoppedNormally()
    • setStoppedNormally

      protected void setStoppedNormally(boolean stoppedNormally)
    • isAutoStartup

      public boolean isAutoStartup()
      次で指定:
      インターフェース SmartLifecycleisAutoStartup 
    • setAutoStartup

      public void setAutoStartup(boolean autoStartup)
      インターフェースからコピーされた説明: MessageListenerContainer
      autoStartup を設定します。
      次で指定:
      インターフェース MessageListenerContainersetAutoStartup 
      パラメーター:
      autoStartup - 設定する autoStartup。
      関連事項:
    • setRunning

      protected void setRunning(boolean running)
    • isRunning

      public boolean isRunning()
      次で指定:
      インターフェース LifecycleisRunning 
    • isPaused

      @DeprecatedSE(since="3.2", forRemoval=true) protected boolean isPaused()
      非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。
    • isPartitionPauseRequested

      public boolean isPartitionPauseRequested(org.apache.kafka.common.TopicPartition topicPartition)
      インターフェースからコピーされた説明: MessageListenerContainer
      このトピックのパーティションの一時停止がリクエストされているかどうか。
      次で指定:
      インターフェース MessageListenerContainerisPartitionPauseRequested 
      パラメーター:
      topicPartition - チェックするトピックパーティション
      戻り値:
      この TopicPartition の一時停止がリクエストされた場合は true
    • pausePartition

      public void pausePartition(org.apache.kafka.common.TopicPartition topicPartition)
      インターフェースからコピーされた説明: MessageListenerContainer
      次の poll() の前にこのパーティションを一時停止します。これはスレッドセーフな操作であり、実際の一時停止はコンシューマースレッドによって処理されます。
      次で指定:
      インターフェース MessageListenerContainerpausePartition 
      パラメーター:
      topicPartition - 一時停止する topicPartition。
    • resumePartition

      public void resumePartition(org.apache.kafka.common.TopicPartition topicPartition)
      インターフェースからコピーされた説明: MessageListenerContainer
      次の poll() の後で、一時停止している場合は、このパーティションを再開します。これはスレッドセーフな操作であり、実際の一時停止はコンシューマースレッドによって処理されます。
      次で指定:
      インターフェース MessageListenerContainerresumePartition 
      パラメーター:
      topicPartition - 再開する topicPartition。
    • isPauseRequested

      public boolean isPauseRequested()
      インターフェースからコピーされた説明: MessageListenerContainer
      MessageListenerContainer.pause() が呼び出された場合は true を返します。コンテナーは実際にはまだ一時停止していない可能性があります。
      次で指定:
      インターフェース MessageListenerContainerisPauseRequested 
      戻り値:
      一時停止がリクエストされた場合は true。
    • setPhase

      public void setPhase(int phase)
    • getPhase

      public int getPhase()
      次で指定:
      インターフェース PhasedgetPhase 
      次で指定:
      インターフェース SmartLifecyclegetPhase 
    • getAfterRollbackProcessor

      public AfterRollbackProcessor<? super K,? super V> getAfterRollbackProcessor()
      現在構成されている AfterRollbackProcessor を返します。
      戻り値:
      アフターロールバックプロセッサー。
      導入:
      2.2.14
    • setAfterRollbackProcessor

      public void setAfterRollbackProcessor(AfterRollbackProcessor<? super K,? super V> afterRollbackProcessor)
      ロールバック後に未処理のレコードに対してシークを実行するようにプロセッサーを設定します。デフォルトでは、失敗したレコードを含むすべてのトピック / パーティションを現在の位置に配置しようとします。
      パラメーター:
      afterRollbackProcessor - プロセッサー。
      導入:
      1.3.5
    • getContainerProperties

      public ContainerProperties getContainerProperties()
      インターフェースからコピーされた説明: MessageListenerContainer
      このコンテナーのコンテナープロパティを返します。
      次で指定:
      インターフェース MessageListenerContainergetContainerProperties 
      戻り値:
      プロパティ。
    • getGroupId

      @Nullable public StringSE getGroupId()
      インターフェースからコピーされた説明: MessageListenerContainer
      コンテナーに明示的に設定されているか、コンシューマーファクトリのコンシューマープロパティを介して設定されているかにかかわらず、このコンテナーの group.id プロパティを返します。
      次で指定:
      インターフェース MessageListenerContainergetGroupId 
      戻り値:
      グループ ID。
    • getListenerId

      public StringSE getListenerId()
      インターフェースからコピーされた説明: MessageListenerContainer
      @KafkaListener の 'id' 属性 または spring-managed コンテナーの Bean 名。
      次で指定:
      インターフェース MessageListenerContainergetListenerId 
      戻り値:
      ID または Bean 名。
    • setMainListenerId

      public void setMainListenerId(StringSE id)
      このコンテナーが再試行トピック用の場合、メインリスナー ID を設定します。
      パラメーター:
      id - ID。
      導入:
      3.0.
    • getMainListenerId

      @Nullable public StringSE getMainListenerId()
      インターフェースからコピーされた説明: MessageListenerContainer
      メイン @KafkaListener コンテナーの 'id' 属性 (このコンテナーが再試行トピック用の場合)。それ以外の場合は null。
      次で指定:
      インターフェース MessageListenerContainergetMainListenerId 
      戻り値:
      ID。
    • getListenerInfo

      @Nullable public byte[] getListenerInfo()
      インターフェースからコピーされた説明: MessageListenerContainer
      すべてのレコードの KafkaHeaders.LISTENER_INFO ヘッダーに追加される任意の静的情報を取得します。
      次で指定:
      インターフェース MessageListenerContainergetListenerInfo 
      戻り値:
      情報。
    • setListenerInfo

      public void setListenerInfo(@Nullable byte[] listenerInfo)
      すべてのレコードの KafkaHeaders.LISTENER_INFO ヘッダーに追加される任意の情報を設定します。
      パラメーター:
      listenerInfo - 情報。
      導入:
      2.8.4
    • setTopicCheckTimeout

      public void setTopicCheckTimeout(int topicCheckTimeout)
      Admin.describeTopics(Collection) 結果先物が完了するまで待機する時間。
      パラメーター:
      topicCheckTimeout - 秒単位のタイムアウト。デフォルトは 30 です。
      導入:
      2.3
    • isChangeConsumerThreadName

      public boolean isChangeConsumerThreadName()
      初期化中にコンテナーがコンシューマースレッド名を変更する必要がある場合は、true を返します。
      戻り値:
      変更するのは本当です。
      導入:
      3.0.1
    • setChangeConsumerThreadName

      public void setChangeConsumerThreadName(boolean changeConsumerThreadName)
      初期化中にコンシューマースレッド名を変更するようコンテナーに指示するには、true に設定します。
      パラメーター:
      changeConsumerThreadName - 変更するのは本当です。
      導入:
      3.0.1
      関連事項:
    • getThreadNameSupplier

      public FunctionSE<MessageListenerContainer,StringSE> getThreadNameSupplier()
      コンシューマースレッド名を変更するために使用される関数を返します。
      戻り値:
      関数。
      導入:
      3.0.1
    • setThreadNameSupplier

      public void setThreadNameSupplier(FunctionSE<MessageListenerContainer,StringSE> threadNameSupplier)
      コンシューマースレッド名を変更するために使用する関数を設定します。デフォルトではコンテナー listenerId が返されます。
      パラメーター:
      threadNameSupplier - 関数。
      導入:
      3.0.1
      関連事項:
    • getKafkaAdmin

      @Nullable public KafkaAdmin getKafkaAdmin()
      存在する場合、観測用のクラスター ID を見つけるために使用される KafkaAdmin を返します。
      戻り値:
      カフカ管理者
      導入:
      3.0.5
    • setKafkaAdmin

      public void setKafkaAdmin(KafkaAdmin kafkaAdmin)
      存在する場合、観測用のクラスター ID を見つけるために使用される KafkaAdmin を設定します。
      パラメーター:
      kafkaAdmin - 管理者。
    • getRecordInterceptor

      protected RecordInterceptor<K,V> getRecordInterceptor()
    • setRecordInterceptor

      public void setRecordInterceptor(RecordInterceptor<K,V> recordInterceptor)
      レコードリスナーを呼び出す前に呼び出されるインターセプターを設定します。バッチリスナーには適用されません。
      パラメーター:
      recordInterceptor - インターセプター。
      導入:
      2.2.7
      関連事項:
    • getBatchInterceptor

      protected BatchInterceptor<K,V> getBatchInterceptor()
    • setBatchInterceptor

      public void setBatchInterceptor(BatchInterceptor<K,V> batchInterceptor)
      レコードリスナーを呼び出す前に呼び出されるインターセプターを設定します。
      パラメーター:
      batchInterceptor - インターセプター。
      導入:
      2.6.6
      関連事項:
    • isInterceptBeforeTx

      protected boolean isInterceptBeforeTx()
    • setInterceptBeforeTx

      public void setInterceptBeforeTx(boolean interceptBeforeTx)
      false の場合、トランザクションの開始後にインターセプターを呼び出します。
      パラメーター:
      interceptBeforeTx - トランザクション内でインターセプトする場合は false。2.8 以降のデフォルトは true。
      導入:
      2.3.4
      関連事項:
    • setupMessageListener

      public void setupMessageListener(ObjectSE messageListener)
      インターフェースからコピーされた説明: MessageListenerContainer
      使用するメッセージリスナーを設定します。そのメッセージリスナ型がサポートされていない場合、IllegalArgumentExceptionSE をスローします。
      次で指定:
      インターフェース MessageListenerContainersetupMessageListener 
      パラメーター:
      messageListener - object を MessageListener にラップします。
    • start

      public final void start()
      次で指定:
      インターフェース Lifecyclestart 
    • checkTopics

      protected void checkTopics()
    • checkGroupId

      public void checkGroupId()
    • doStart

      protected abstract void doStart()
    • stop

      public final void stop()
      次で指定:
      インターフェース Lifecyclestop 
    • stop

      public final void stop(boolean wait)
      コンテナーを停止します。
      パラメーター:
      wait - リスナーが終了するのを待ちます。
      導入:
      2.3.8
    • pause

      public void pause()
      インターフェースからコピーされた説明: MessageListenerContainer
      次の poll() の前に、このコンテナーを一時停止します。これはスレッドセーフな操作であり、実際の一時停止はコンシューマースレッドによって処理されます。
      次で指定:
      インターフェース MessageListenerContainerpause 
      関連事項:
      • KafkaConsumer.pause(Collection)
    • resume

      public void resume()
      インターフェースからコピーされた説明: MessageListenerContainer
      次の poll() の後で、一時停止している場合は、このコンテナーを再開します。これはスレッドセーフな操作であり、実際の再開はコンシューマースレッドによって処理されます。
      次で指定:
      インターフェース MessageListenerContainerresume 
      関連事項:
      • KafkaConsumer.resume(Collection)
    • stop

      public void stop(RunnableSE callback)
      次で指定:
      インターフェース SmartLifecyclestop 
    • stopAbnormally

      public void stopAbnormally(RunnableSE callback)
      インターフェースからコピーされた説明: MessageListenerContainer
      MessageListenerContainer.isInExpectedState() が false を返すように、いくつかの例外の後でコンテナーを停止します。
      次で指定:
      インターフェース MessageListenerContainerstopAbnormally 
      パラメーター:
      callback - コールバック。
      関連事項:
    • doStop

      protected void doStop(RunnableSE callback)
    • doStop

      protected abstract void doStop(RunnableSE callback, boolean normal)
      コンテナーを正常または異常に停止します。
      パラメーター:
      callback - コールバック。
      normal - 予想される停止については true。
      導入:
      2.8
    • createSimpleLoggingConsumerRebalanceListener

      protected final org.apache.kafka.clients.consumer.ConsumerRebalanceListener createSimpleLoggingConsumerRebalanceListener()
      ConsumerRebalanceListener インスタンスのデフォルトの実装を返します。
      戻り値:
      現在このコンテナーに割り当てられている ConsumerRebalanceListener
    • publishContainerStoppedEvent

      protected void publishContainerStoppedEvent()
    • parentOrThis

      protected AbstractMessageListenerContainer<?,?> parentOrThis()
      これまたはこれに親がある場合は親コンテナーを返します。
      戻り値:
      親かこれ。
      導入:
      2.2.1
    • propertiesFromConsumerPropertyOverrides

      protected PropertiesSE propertiesFromConsumerPropertyOverrides()
      デフォルトのコンシューマーオーバーライドプロパティを明示的なプロパティにします。
      戻り値:
      プロパティ。
      導入:
      2.9.11