private SendingHandler(
     MessageHandler delegate, String replyTo, RabbitPropertiesAccessor properties) {
   this.delegate = delegate;
   this.replyTo = replyTo;
   this.partitioningMetadata =
       new PartitioningMetadata(properties, properties.getNextModuleCount());
   this.setBeanFactory(RabbitMessageChannelBinder.this.getBeanFactory());
 }
 private AmqpOutboundEndpoint buildOutboundEndpoint(
     final String name, RabbitPropertiesAccessor properties, RabbitTemplate rabbitTemplate) {
   String queueName = applyPrefix(properties.getPrefix(this.defaultPrefix), name);
   String partitionKeyExtractorClass = properties.getPartitionKeyExtractorClass();
   Expression partitionKeyExpression = properties.getPartitionKeyExpression();
   AmqpOutboundEndpoint queue = new AmqpOutboundEndpoint(rabbitTemplate);
   if (partitionKeyExpression == null && !StringUtils.hasText(partitionKeyExtractorClass)) {
     declareQueueIfNotPresent(new Queue(queueName));
     queue.setRoutingKey(queueName); // uses default exchange
   } else {
     queue.setExpressionRoutingKey(
         EXPRESSION_PARSER.parseExpression(buildPartitionRoutingExpression(queueName)));
     // if the stream is partitioned, create one queue for each target partition
     for (int i = 0; i < properties.getNextModuleCount(); i++) {
       this.rabbitAdmin.declareQueue(new Queue(queueName + "-" + i));
     }
   }
   configureOutboundHandler(queue, properties);
   return queue;
 }