Class PubSubInboundChannelAdapter

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
com.google.cloud.spring.pubsub.integration.inbound.PubSubInboundChannelAdapter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.core.MessageProducer, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationInboundManagement, org.springframework.integration.support.management.IntegrationManagement, org.springframework.integration.support.management.ManageableLifecycle, org.springframework.integration.support.management.ManageableSmartLifecycle, org.springframework.integration.support.management.TrackableComponent

public class PubSubInboundChannelAdapter extends org.springframework.integration.endpoint.MessageProducerSupport
Converts from GCP Pub/Sub message to Spring message and sends the Spring message to the attached channels.
  • Nested Class Summary

    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.endpoint.AbstractEndpoint

    lifecycleCondition, lifecycleLock

    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.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors
    Constructor
    Description
    PubSubInboundChannelAdapter(PubSubSubscriberOperations pubSubSubscriberOperations, String subscriptionName)
    Instantiates a streaming Pub/Sub subscription adapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected void
     
     
     
    boolean
     
    void
     
    void
    setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<Map<String,String>> headerMapper)
    Set the header mapper to map headers from incoming PubsubMessage into Message.
    void
     
    void
    setPayloadType(Class<?> payloadType)
    Set the desired type of the payload of the Message constructed by converting the incoming Pub/Sub message.

    Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport

    afterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, isObserved, onInit, registerObservationRegistry, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setObservationConvention, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisher

    Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint

    destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop

    Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport

    afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, 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 org.springframework.integration.support.management.IntegrationManagement

    destroy, getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, registerMetricsCaptor, setLoggingEnabled, setManagedName, setManagedType

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName, getComponentType
  • Constructor Details

    • PubSubInboundChannelAdapter

      public PubSubInboundChannelAdapter(PubSubSubscriberOperations pubSubSubscriberOperations, String subscriptionName)
      Instantiates a streaming Pub/Sub subscription adapter.
      Parameters:
      pubSubSubscriberOperations - PubSubSubscriberOperations to use
      subscriptionName - short subscription name, e.g., "subscriptionName", or the fully-qualified subscription name in the projects/[project_name]/subscriptions/[subscription_name] format
  • Method Details

    • getAckMode

      public AckMode getAckMode()
    • setAckMode

      public void setAckMode(AckMode ackMode)
    • setHealthTrackerRegistry

      public void setHealthTrackerRegistry(HealthTrackerRegistry healthTrackerRegistry)
    • getPayloadType

      public Class<?> getPayloadType()
    • setPayloadType

      public void setPayloadType(Class<?> payloadType)
      Set the desired type of the payload of the Message constructed by converting the incoming Pub/Sub message. The channel adapter will use the PubSubMessageConverter configured for PubSubSubscriberOperations.subscribeAndConvert(String, java.util.function.Consumer, Class). The default payload type is byte[].class.
      Parameters:
      payloadType - the type of the payload of the Message produced by the adapter. Cannot be set to null.
    • setHeaderMapper

      public void setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<Map<String,String>> headerMapper)
      Set the header mapper to map headers from incoming PubsubMessage into Message.
      Parameters:
      headerMapper - the header mapper
    • doStart

      protected void doStart()
      Overrides:
      doStart in class org.springframework.integration.endpoint.MessageProducerSupport
    • doStop

      protected void doStop()
      Overrides:
      doStop in class org.springframework.integration.endpoint.MessageProducerSupport
    • healthCheckEnabled

      public boolean healthCheckEnabled()