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
ConstructorDescriptionPubSubInboundChannelAdapter
(PubSubSubscriberOperations pubSubSubscriberOperations, String subscriptionName) Instantiates a streaming Pub/Sub subscription adapter. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
protected void
doStop()
Class<?>
boolean
void
setAckMode
(AckMode ackMode) void
setHeaderMapper
(org.springframework.integration.mapping.HeaderMapper<Map<String, String>> headerMapper) Set the header mapper to map headers from incomingPubsubMessage
intoMessage
.void
setHealthTrackerRegistry
(HealthTrackerRegistry healthTrackerRegistry) void
setPayloadType
(Class<?> payloadType) Set the desired type of the payload of theMessage
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, 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 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 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 theMessage
constructed by converting the incoming Pub/Sub message. The channel adapter will use thePubSubMessageConverter
configured forPubSubSubscriberOperations.subscribeAndConvert(String, java.util.function.Consumer, Class)
. The default payload type isbyte[].class
.- Parameters:
payloadType
- the type of the payload of theMessage
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 incomingPubsubMessage
intoMessage
.- Parameters:
headerMapper
- the header mapper
-
doStart
protected void doStart()- Overrides:
doStart
in classorg.springframework.integration.endpoint.MessageProducerSupport
-
doStop
protected void doStop()- Overrides:
doStop
in classorg.springframework.integration.endpoint.MessageProducerSupport
-
healthCheckEnabled
public boolean healthCheckEnabled()
-