クラス GrpcOutboundGateway
java.lang.ObjectSE
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.grpc.outbound.GrpcOutboundGateway
- 実装済みのインターフェース一覧:
org.reactivestreams.Subscriber<Message<?>>、Aware、BeanClassLoaderAware、BeanFactoryAware、BeanNameAware、DisposableBean、InitializingBean、ApplicationContextAware、Ordered、ComponentSourceAware、ExpressionCapable、Orderable、MessageProducer、HeaderPropagationAware、IntegrationPattern、NamedComponent、IntegrationManagement、TrackableComponent、MessageHandler、reactor.core.CoreSubscriber<Message<?>>
gRPC クライアント呼び出し用の送信ゲートウェイ。
このコンポーネントは gRPC スタブとして機能し、リクエストは入力メッセージに基づいて行われ、呼び出すターゲット gRPC サービスメソッドは、入力メッセージに対する SpEL 式に基づいて実行時に解決されます。
サポートされている gRPC リクエスト:
- 単項 : 単一のリクエストオブジェクトを受け入れます
- サーバーストリーミング : 単一のリクエストオブジェクトを受け入れます
- クライアントストリーミング :
Flux、Mono、StreamSE、CollectionSE、単一のオブジェクトを受け入れます。 - 双方向ストリーミング :
Flux、Mono、StreamSE、CollectionSE、単一のオブジェクトを受け入れます。
ゲートウェイからのリクエストの戻り値の型:
- 単項 : デフォルトでは、レスポンスオブジェクトを含む
Monoを返します。AbstractMessageProducingHandler.isAsync()が false に設定されている場合、レスポンスオブジェクト自体を返します。 - サーバーストリーミング : レスポンスメッセージの
Fluxを返します - クライアントストリーミング : 単一のレスポンスを含む
Monoを返します - 双方向ストリーミング : レスポンスメッセージの
Fluxを返します
- 導入:
- 7.1
- 作成者:
- Glenn Renfro, Artem Bilan
ネストされたクラスの概要
クラス org.springframework.integration.handler.AbstractReplyProducingMessageHandler から継承されたネストクラス / インターフェース
AbstractReplyProducingMessageHandler.RequestHandlerインターフェース org.springframework.integration.support.management.IntegrationManagement から継承されたネストクラス / インターフェース
IntegrationManagement.ManagementOverridesフィールド概要
クラス org.springframework.integration.handler.AbstractMessageProducingHandler から継承されたフィールド
messagingTemplateクラス org.springframework.integration.context.IntegrationObjectSupport から継承されたフィールド
EXPRESSION_PARSER, loggerインターフェース org.springframework.integration.support.management.IntegrationManagement から継承されたフィールド
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEインターフェース org.springframework.core.Ordered から継承されたフィールド
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEコンストラクター概要
コンストラクターコンストラクター説明GrpcOutboundGateway(io.grpc.Channel channel, ClassSE<?> grpcServiceClass) gRPC サービスクラスに基づいて新しいGrpcOutboundGatewayを作成し、通信用にChannelを作成します。方法の概要
修飾子と型メソッド説明protected voiddoInit()protected ObjectSEhandleRequestMessage(Message<?> requestMessage) サブクラスはこのメソッドを実装して、リクエストメッセージを処理する必要があります。voidsetCallOptions(io.grpc.CallOptions callOptions) RPC 呼び出しでCallOptionsを設定します。voidsetMethodName(StringSE methodName) 呼び出す gRPC メソッドの名前を設定します。voidsetMethodNameExpression(Expression methodNameExpression) 実行時に gRPC メソッド名を解決するために、Expressionを設定します。クラス org.springframework.integration.handler.AbstractReplyProducingMessageHandler から継承されたメソッド
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyクラス org.springframework.integration.handler.AbstractMessageProducingHandler から継承されたメソッド
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersクラス org.springframework.integration.handler.AbstractMessageHandler から継承されたメソッド
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionクラス org.springframework.integration.handler.MessageHandlerSupport から継承されたメソッド
buildSendTimer, destroy, getComponentType, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackクラス org.springframework.integration.context.IntegrationObjectSupport から継承されたメソッド
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringクラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSEインターフェース reactor.core.CoreSubscriber から継承されたメソッド
currentContextインターフェース org.springframework.integration.support.management.IntegrationManagement から継承されたメソッド
getThisAsインターフェース org.springframework.integration.support.context.NamedComponent から継承されたメソッド
getBeanName, getComponentName
コンストラクターの詳細
GrpcOutboundGateway
Create a newGrpcOutboundGatewaybased on the gRPC service class andChannelfor communication. The gateway is set to async mode by default.- パラメーター:
channel- 通信に使用する gRPC チャネルgrpcServiceClass- gRPC サービスクラス (例:SimpleGrpc.class)
方法の詳細
setMethodNameExpression
Set theExpressionto resolve the gRPC method name at runtime. If not provided, the default expression checks theMessageHeadersfor aGrpcHeaders.SERVICE_METHOD. If the expression is not set and the service has only one method, then the gateway will set the expression to use the name of that method.- パラメーター:
methodNameExpression- メソッド名を解決する式
setMethodName
呼び出す gRPC メソッドの名前を設定します。メソッド名が指定されていない場合、デフォルトの式はMessageHeadersからGrpcHeaders.SERVICE_METHODを探すか、単一のサービスメソッドの場合はそのメソッド名を使用します。- パラメーター:
methodName- 呼び出す gRPC メソッドの名前
setCallOptions
public void setCallOptions(io.grpc.CallOptions callOptions) Set theCallOptionsthe RPC call. Default isCallOptions.DEFAULT- パラメーター:
callOptions- theCallOptionsfor the gateway.
doInit
protected void doInit()- オーバーライド:
- クラス
AbstractReplyProducingMessageHandlerのdoInit
handleRequestMessage
クラスからコピーされた説明:AbstractReplyProducingMessageHandlerサブクラスはこのメソッドを実装して、リクエストメッセージを処理する必要があります。戻り値は、メッセージ、MessageBuilder、任意のプレーンオブジェクトです。基本クラスは、これらの開始点のいずれかからの返信メッセージの最終的な作成を処理します。戻り値が null の場合、メッセージフローはここで終了します。- 次で指定:
- クラス
AbstractReplyProducingMessageHandlerのhandleRequestMessage - パラメーター:
requestMessage- リクエストメッセージ。- 戻り値:
- メッセージを処理した結果、または
null