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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected Object
    handleRequestMessage(org.springframework.messaging.Message<?> message)
     
    void
    setFormatOptions(com.google.cloud.bigquery.FormatOptions formatOptions)
    Sets the handler's FormatOptions which describe the type/format of data files being loaded.
    void
    setFormatOptionsExpression(org.springframework.expression.Expression formatOptionsExpression)
    Sets the SpEL Expression used to determine the FormatOptions for the handler.
    void
    setSync(boolean sync)
    A boolean indicating if the BigQueryFileMessageHandler 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 SpEL Expression to evaluate to determine the table name.
    void
    setTableSchema(com.google.cloud.bigquery.Schema schema)
    Sets the Schema of the table to load for the handler.
    void
    setTableSchemaExpression(org.springframework.expression.Expression tableSchemaExpression)
    Sets the SpEL expression used to determine the Schema for the handler.
    void
    Sets the Duration 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

      public BigQueryFileMessageHandler(BigQueryTemplate bigQueryTemplate)
  • Method Details

    • doInit

      protected void doInit()
      Overrides:
      doInit in class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
    • setTableNameExpression

      public void setTableNameExpression(org.springframework.expression.Expression tableNameExpression)
      Sets the SpEL Expression to evaluate to determine the table name.
      Parameters:
      tableNameExpression - the SpEL expression used to evaluate the table name
    • setTableName

      public void setTableName(String tableName)
      Sets the BigQuery table name to use. This overwrites any previous settings made by setTableNameExpression(org.springframework.expression.Expression).
      Parameters:
      tableName - name of the BigQuery table
    • setFormatOptionsExpression

      public void setFormatOptionsExpression(org.springframework.expression.Expression formatOptionsExpression)
      Sets the SpEL Expression used to determine the FormatOptions for the handler.
      Parameters:
      formatOptionsExpression - the SpEL expression used to evaluate the FormatOptions
    • setFormatOptions

      public void setFormatOptions(com.google.cloud.bigquery.FormatOptions formatOptions)
      Sets the handler's FormatOptions which describe the type/format of data files being loaded. This overwrites any previous settings made by setFormatOptionsExpression(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 the Schema for the handler.
      Parameters:
      tableSchemaExpression - the SpEL expression used to evaluate the Schema.
    • setTableSchema

      public void setTableSchema(com.google.cloud.bigquery.Schema schema)
      Sets the Schema of the table to load for the handler.
      Parameters:
      schema - the schema of the table to load.
    • setTimeout

      public void setTimeout(Duration timeout)
      Sets the Duration to wait for a file to be loaded into BigQuery before timing out when waiting synchronously.
      Parameters:
      timeout - the Duration timeout to wait for a file to load
    • setSync

      public void setSync(boolean sync)
      A boolean indicating if the BigQueryFileMessageHandler 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 return CompletableFuture of the Job as the response for each message.

      Parameters:
      sync - whether BigQueryFileMessageHandler should wait synchronously for jobs to complete. Default is false (async).
    • handleRequestMessage

      protected Object handleRequestMessage(org.springframework.messaging.Message<?> message)
      Specified by:
      handleRequestMessage in class org.springframework.integration.handler.AbstractReplyProducingMessageHandler