Example usage for org.springframework.amqp.rabbit.core RabbitTemplate setBeforePublishPostProcessors

List of usage examples for org.springframework.amqp.rabbit.core RabbitTemplate setBeforePublishPostProcessors

Introduction

In this page you can find the example usage for org.springframework.amqp.rabbit.core RabbitTemplate setBeforePublishPostProcessors.

Prototype

public void setBeforePublishPostProcessors(MessagePostProcessor... beforePublishPostProcessors) 

Source Link

Document

Set MessagePostProcessor s that will be invoked immediately before invoking Channel#basicPublish() , after all other processing, except creating the BasicProperties from MessageProperties .

Usage

From source file:org.springframework.xd.dirt.integration.rabbit.RabbitMessageBus.java

private RabbitTemplate determineRabbitTemplate(RabbitPropertiesAccessor properties) {
    RabbitTemplate rabbitTemplate = null;
    if (properties.isBatchingEnabled(this.defaultBatchingEnabled)) {
        BatchingStrategy batchingStrategy = new SimpleBatchingStrategy(
                properties.getBatchSize(this.defaultBatchSize),
                properties.geteBatchBufferLimit(this.defaultBatchBufferLimit),
                properties.getBatchTimeout(this.defaultBatchTimeout));
        rabbitTemplate = new BatchingRabbitTemplate(batchingStrategy, getApplicationContext()
                .getBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME, TaskScheduler.class));
        rabbitTemplate.setConnectionFactory(this.connectionFactory);
    }/* w  w w  . jav a  2s  .co  m*/
    if (properties.isCompress(this.defaultCompress)) {
        if (rabbitTemplate == null) {
            rabbitTemplate = new RabbitTemplate(this.connectionFactory);
        }
        rabbitTemplate.setBeforePublishPostProcessors(this.compressingPostProcessor);
        rabbitTemplate.afterPropertiesSet();
    }
    if (rabbitTemplate == null) {
        rabbitTemplate = this.rabbitTemplate;
    }
    return rabbitTemplate;
}