public class PubSubMessageHandler
extends org.springframework.integration.handler.AbstractMessageHandler
It delegates Google Cloud Pub/Sub interaction to PubSubOperations
. It also converts
the Message
payload into a PubsubMessage
accepted by the Google Cloud Pub/Sub
Client Library. It supports synchronous and asynchronous sending.
EXPRESSION_PARSER, logger
Constructor and Description |
---|
PubSubMessageHandler(PubSubOperations pubSubTemplate,
String topic) |
Modifier and Type | Method and Description |
---|---|
org.springframework.messaging.converter.MessageConverter |
getMessageConverter() |
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 |
setMessageConverter(org.springframework.messaging.converter.MessageConverter messageConverter) |
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.
|
configureMetrics, getActiveCount, getActiveCountLong, getComponentType, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMinDuration, getOrder, getOverrides, getStandardDeviationDuration, handleMessage, isCountsEnabled, isLoggingEnabled, isStatsEnabled, onComplete, onError, onNext, onSubscribe, registerMetricsCaptor, reset, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabled
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public PubSubMessageHandler(PubSubOperations pubSubTemplate, String topic)
protected void handleMessageInternal(org.springframework.messaging.Message<?> message) throws Exception
handleMessageInternal
in class org.springframework.integration.handler.AbstractMessageHandler
Exception
public org.springframework.messaging.converter.MessageConverter getMessageConverter()
public void setMessageConverter(org.springframework.messaging.converter.MessageConverter messageConverter)
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
- SpEL expression representing the topic namepublic void setTopic(String topic)
topic
- topic namepublic void setTopicExpressionString(String topicExpressionString)
topicExpressionString
- topic expression stringCopyright © 2018 Pivotal Software, Inc.. All rights reserved.