public class PubSubMessageHandler
extends org.springframework.integration.handler.AbstractMessageHandler
It delegates Google Cloud Pub/Sub interaction to
PubSubTemplate
.
EXPRESSION_PARSER, logger
Constructor and Description |
---|
PubSubMessageHandler(PubSubPublisherOperations pubSubPublisherOperations,
String topic) |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.util.concurrent.ListenableFutureCallback<String> |
getPublishCallback() |
org.springframework.expression.Expression |
getPublishTimeoutExpression() |
org.springframework.expression.Expression |
getTopicExpression() |
protected void |
handleMessageInternal(org.springframework.messaging.Message<?> message) |
boolean |
isSync() |
protected void |
onInit() |
void |
setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<Map<String,String>> headerMapper)
Set the header mapper to map headers from
Message into outbound
PubsubMessage . |
void |
setPublishCallback(org.springframework.util.concurrent.ListenableFutureCallback<String> publishCallback)
Set the callback to be activated when the publish call resolves.
|
void |
setPublishTimeout(long timeoutMillis)
Set the timeout in milliseconds for a synchronous publish call to Google Cloud Pub/Sub.
|
void |
setPublishTimeoutExpression(org.springframework.expression.Expression publishTimeoutExpression)
Set the SpEL expression to evaluate a timeout in milliseconds for a synchronous publish call
to Google Cloud Pub/Sub.
|
void |
setPublishTimeoutExpressionString(String publishTimeoutExpression)
Set the SpEL expression to evaluate a timeout in milliseconds for a synchronous publish call
to Google Cloud Pub/Sub from a string.
|
void |
setSync(boolean sync)
Set publish method to be synchronous or asynchronous.
|
void |
setTopic(String topic)
Set the topic where this adapter sends messages to.
|
void |
setTopicExpression(org.springframework.expression.Expression topicExpression)
Set the SpEL expression for the topic this adapter sends messages to.
|
void |
setTopicExpressionString(String topicExpressionString)
Set the topic expression string that is evaluated into an actual expression.
|
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, configureMetrics, destroy, getActiveCount, getActiveCountLong, getComponentType, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getHandlerMetrics, getIntegrationPatternType, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMetricsCaptor, getMinDuration, getOrder, getOverrides, getStandardDeviationDuration, isCountsEnabled, isLoggingEnabled, isStatsEnabled, registerMetricsCaptor, reset, sendTimer, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabled, shouldTrack
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public PubSubMessageHandler(PubSubPublisherOperations pubSubPublisherOperations, String topic)
public boolean isSync()
public void setSync(boolean sync)
Publish is asynchronous be default.
sync
- true for synchronous, false for asynchronouspublic org.springframework.expression.Expression getPublishTimeoutExpression()
public void setPublishTimeoutExpression(org.springframework.expression.Expression publishTimeoutExpression)
publishTimeoutExpression
- the Expression
for the publish timeout in
millisecondspublic void setPublishTimeoutExpressionString(String publishTimeoutExpression)
publishTimeoutExpression
- a string with an expression for the publish timeout in
millisecondspublic void setPublishTimeout(long timeoutMillis)
timeoutMillis
- timeout in millisecondsprotected org.springframework.util.concurrent.ListenableFutureCallback<String> getPublishCallback()
public void setPublishCallback(org.springframework.util.concurrent.ListenableFutureCallback<String> publishCallback)
publishCallback
- callback for the publish futurepublic org.springframework.expression.Expression getTopicExpression()
public void setTopicExpression(org.springframework.expression.Expression topicExpression)
topicExpression
- the SpEL expression representing the topic namepublic void setTopic(String topic)
topic
- topic namepublic void setTopicExpressionString(String topicExpressionString)
topicExpressionString
- topic expression stringpublic void setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<Map<String,String>> headerMapper)
Message
into outbound
PubsubMessage
.headerMapper
- the header mapperprotected void handleMessageInternal(org.springframework.messaging.Message<?> message)
handleMessageInternal
in class org.springframework.integration.handler.AbstractMessageHandler
protected void onInit()
onInit
in class org.springframework.integration.handler.MessageHandlerSupport
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.