public abstract class AbstractBinder<T,C extends ConsumerProperties,P extends ProducerProperties> extends Object implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean, Binder<T,C,P>
Modifier and Type | Class and Description |
---|---|
static class |
AbstractBinder.JavaClassMimeTypeConversion
Handles representing any java class as a
MimeType . |
Modifier and Type | Field and Description |
---|---|
protected EmbeddedHeadersMessageConverter |
embeddedHeadersMessageConverter |
protected org.springframework.expression.EvaluationContext |
evaluationContext |
protected org.apache.commons.logging.Log |
logger |
protected static String |
PARTITION_HEADER |
protected PartitionSelectorStrategy |
partitionSelector |
Constructor and Description |
---|
AbstractBinder() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
static String |
applyPrefix(String prefix,
String name)
For binder implementations that support a prefix, apply the prefix to the name.
|
Binding<T> |
bindConsumer(String name,
String group,
T target,
C properties)
Bind the target component as a message consumer to the logical entity identified by the name.
|
Binding<T> |
bindProducer(String name,
T outboundBindTarget,
P properties)
Bind the target component as a message producer to the logical entity identified by the name.
|
protected String |
buildPartitionRoutingExpression(String expressionRoot) |
protected org.springframework.retry.support.RetryTemplate |
buildRetryTemplateIfRetryEnabled(ConsumerProperties properties)
Create and configure a retry template if the consumer 'maxAttempts' property is set.
|
static String |
constructDLQName(String name)
For binder implementations that support dead lettering, construct the name of the dead letter entity for the
underlying pipe name.
|
protected MessageValues |
deserializePayloadIfNecessary(org.springframework.messaging.Message<?> message) |
protected MessageValues |
deserializePayloadIfNecessary(MessageValues messageValues) |
protected abstract Binding<T> |
doBindConsumer(String name,
String group,
T inputTarget,
C properties) |
protected abstract Binding<T> |
doBindProducer(String name,
T outboundBindTarget,
P properties) |
void |
doManualAck(LinkedList<org.springframework.messaging.MessageHeaders> messageHeaders)
Perform manual acknowledgement based on the metadata stored in the binder.
|
MessageValues |
extractMessageValues(org.springframework.messaging.Message<?> receivedMessage)
Extract the message values from the the received message when the received message is embedded with
header values.
|
protected org.springframework.context.support.AbstractApplicationContext |
getApplicationContext() |
protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory |
getBeanFactory() |
protected String |
groupedName(String name,
String group)
Construct a name comprised of the name and group.
|
protected void |
onInit()
Subclasses may implement this method to perform any necessary initialization.
|
protected MessageValues |
serializePayloadIfNecessary(org.springframework.messaging.Message<?> message) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setCodec(org.springframework.integration.codec.Codec codec) |
void |
setIntegrationEvaluationContext(org.springframework.expression.EvaluationContext evaluationContext) |
void |
setPartitionSelector(PartitionSelectorStrategy partitionSelector)
Set the partition strategy to be used by this binder if no partitionExpression is provided for a module.
|
protected static final String PARTITION_HEADER
protected final org.apache.commons.logging.Log logger
protected final EmbeddedHeadersMessageConverter embeddedHeadersMessageConverter
protected volatile org.springframework.expression.EvaluationContext evaluationContext
protected volatile PartitionSelectorStrategy partitionSelector
public static String applyPrefix(String prefix, String name)
prefix
- the prefix.name
- the name.public static String constructDLQName(String name)
name
- the name.public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
protected org.springframework.context.support.AbstractApplicationContext getApplicationContext()
protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory()
public void setCodec(org.springframework.integration.codec.Codec codec)
public void setPartitionSelector(PartitionSelectorStrategy partitionSelector)
partitionSelector
- The selector.public void setIntegrationEvaluationContext(org.springframework.expression.EvaluationContext evaluationContext)
public final void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public MessageValues extractMessageValues(org.springframework.messaging.Message<?> receivedMessage)
receivedMessage
- the received messageprotected void onInit() throws Exception
afterPropertiesSet()
which is itself final
.Exception
public final Binding<T> bindConsumer(String name, String group, T target, C properties)
Binder
bindConsumer
in interface Binder<T,C extends ConsumerProperties,P extends ProducerProperties>
name
- the logical identity of the message sourcegroup
- the consumer group to which this consumer belongs - subscriptions are shared among consumers
in the same group (a null
or empty String, must be treated as an anonymous group that doesn't share
the subscription with any other consumer)target
- the app interface to be bound as a consumerproperties
- the consumer propertiesprotected abstract Binding<T> doBindConsumer(String name, String group, T inputTarget, C properties)
public final Binding<T> bindProducer(String name, T outboundBindTarget, P properties)
Binder
bindProducer
in interface Binder<T,C extends ConsumerProperties,P extends ProducerProperties>
name
- the logical identity of the message targetoutboundBindTarget
- the app interface to be bound as a producerproperties
- the producer propertiesprotected abstract Binding<T> doBindProducer(String name, T outboundBindTarget, P properties)
protected final String groupedName(String name, String group)
name
- the name.group
- the group.protected final MessageValues serializePayloadIfNecessary(org.springframework.messaging.Message<?> message)
protected final MessageValues deserializePayloadIfNecessary(org.springframework.messaging.Message<?> message)
protected final MessageValues deserializePayloadIfNecessary(MessageValues messageValues)
protected String buildPartitionRoutingExpression(String expressionRoot)
protected org.springframework.retry.support.RetryTemplate buildRetryTemplateIfRetryEnabled(ConsumerProperties properties)
properties
- The properties.public void doManualAck(LinkedList<org.springframework.messaging.MessageHeaders> messageHeaders)
Copyright © 2016 Pivotal Software, Inc.. All rights reserved.