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, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionPubSubInboundChannelAdapter(PubSubSubscriberOperations pubSubSubscriberOperations, String subscriptionName) Instantiates a streaming Pub/Sub subscription adapter. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()protected voiddoStop()Class<?>booleanvoidsetAckMode(AckMode ackMode) voidsetHeaderMapper(org.springframework.integration.mapping.HeaderMapper<Map<String, String>> headerMapper) Set the header mapper to map headers from incomingPubsubMessageintoMessage.voidsetHealthTrackerRegistry(HealthTrackerRegistry healthTrackerRegistry) voidsetPayloadType(Class<?> payloadType) Set the desired type of the payload of theMessageconstructed 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, subscribeToPublisherMethods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
destroy, getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, registerMetricsCaptor, setLoggingEnabled, setManagedName, setManagedTypeMethods 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-PubSubSubscriberOperationsto usesubscriptionName- short subscription name, e.g., "subscriptionName", or the fully-qualified subscription name in theprojects/[project_name]/subscriptions/[subscription_name]format
-
-
Method Details
-
getAckMode
-
setAckMode
-
setHealthTrackerRegistry
-
getPayloadType
-
setPayloadType
Set the desired type of the payload of theMessageconstructed by converting the incoming Pub/Sub message. The channel adapter will use thePubSubMessageConverterconfigured forPubSubSubscriberOperations.subscribeAndConvert(String, java.util.function.Consumer, Class). The default payload type isbyte[].class.- Parameters:
payloadType- the type of the payload of theMessageproduced 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 incomingPubsubMessageintoMessage.- Parameters:
headerMapper- the header mapper
-
doStart
protected void doStart()- Overrides:
doStartin classorg.springframework.integration.endpoint.MessageProducerSupport
-
doStop
protected void doStop()- Overrides:
doStopin classorg.springframework.integration.endpoint.MessageProducerSupport
-
healthCheckEnabled
public boolean healthCheckEnabled()
-