Class BigQueryFileMessageHandler
java.lang.Object
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
com.google.cloud.spring.bigquery.integration.outbound.BigQueryFileMessageHandler
- All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.core.Ordered
,org.springframework.integration.context.ExpressionCapable
,org.springframework.integration.context.Orderable
,org.springframework.integration.core.MessageProducer
,org.springframework.integration.handler.HeaderPropagationAware
,org.springframework.integration.IntegrationPattern
,org.springframework.integration.support.context.NamedComponent
,org.springframework.integration.support.management.IntegrationManagement
,org.springframework.integration.support.management.TrackableComponent
,org.springframework.messaging.MessageHandler
,reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>
public class BigQueryFileMessageHandler
extends org.springframework.integration.handler.AbstractReplyProducingMessageHandler
A
MessageHandler
which handles sending and loading files to
a BigQuery table.- Since:
- 1.2
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler.RequestHandler
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplate
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doInit()
protected Object
handleRequestMessage
(org.springframework.messaging.Message<?> message) void
setFormatOptions
(com.google.cloud.bigquery.FormatOptions formatOptions) Sets the handler'sFormatOptions
which describe the type/format of data files being loaded.void
setFormatOptionsExpression
(org.springframework.expression.Expression formatOptionsExpression) Sets the SpELExpression
used to determine theFormatOptions
for the handler.void
setSync
(boolean sync) Aboolean
indicating if theBigQueryFileMessageHandler
should synchronously wait for each file to be successfully loaded to BigQuery.void
setTableName
(String tableName) Sets the BigQuery table name to use.void
setTableNameExpression
(org.springframework.expression.Expression tableNameExpression) Sets the SpELExpression
to evaluate to determine the table name.void
setTableSchema
(com.google.cloud.bigquery.Schema schema) Sets theSchema
of the table to load for the handler.void
setTableSchemaExpression
(org.springframework.expression.Expression tableSchemaExpression) Sets the SpEL expression used to determine theSchema
for the handler.void
setTimeout
(Duration timeout) Sets theDuration
to wait for a file to be loaded into BigQuery before timing out when waiting synchronously.Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
Methods inherited from class 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
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConvention
Methods inherited from class 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
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface reactor.core.CoreSubscriber
currentContext
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
BigQueryFileMessageHandler
-
-
Method Details
-
doInit
protected void doInit()- Overrides:
doInit
in classorg.springframework.integration.handler.AbstractReplyProducingMessageHandler
-
setTableNameExpression
public void setTableNameExpression(org.springframework.expression.Expression tableNameExpression) Sets the SpELExpression
to evaluate to determine the table name.- Parameters:
tableNameExpression
- the SpEL expression used to evaluate the table name
-
setTableName
Sets the BigQuery table name to use. This overwrites any previous settings made bysetTableNameExpression(org.springframework.expression.Expression)
.- Parameters:
tableName
- name of the BigQuery table
-
setFormatOptionsExpression
public void setFormatOptionsExpression(org.springframework.expression.Expression formatOptionsExpression) Sets the SpELExpression
used to determine theFormatOptions
for the handler.- Parameters:
formatOptionsExpression
- the SpEL expression used to evaluate theFormatOptions
-
setFormatOptions
public void setFormatOptions(com.google.cloud.bigquery.FormatOptions formatOptions) Sets the handler'sFormatOptions
which describe the type/format of data files being loaded. This overwrites any previous settings made bysetFormatOptionsExpression(org.springframework.expression.Expression)
.- Parameters:
formatOptions
- the format of the data file being loaded
-
setTableSchemaExpression
public void setTableSchemaExpression(org.springframework.expression.Expression tableSchemaExpression) Sets the SpEL expression used to determine theSchema
for the handler.- Parameters:
tableSchemaExpression
- the SpEL expression used to evaluate theSchema
.
-
setTableSchema
public void setTableSchema(com.google.cloud.bigquery.Schema schema) Sets theSchema
of the table to load for the handler.- Parameters:
schema
- the schema of the table to load.
-
setTimeout
Sets theDuration
to wait for a file to be loaded into BigQuery before timing out when waiting synchronously.- Parameters:
timeout
- theDuration
timeout to wait for a file to load
-
setSync
public void setSync(boolean sync) Aboolean
indicating if theBigQueryFileMessageHandler
should synchronously wait for each file to be successfully loaded to BigQuery.If set to true, the handler runs synchronously and returns
Job
for message responses. If set to false, the handler will returnCompletableFuture
of the Job as the response for each message.- Parameters:
sync
- whetherBigQueryFileMessageHandler
should wait synchronously for jobs to complete. Default is false (async).
-
handleRequestMessage
- Specified by:
handleRequestMessage
in classorg.springframework.integration.handler.AbstractReplyProducingMessageHandler
-