org.springframework.cloud.stream.config.ConsumerEndpointCustomizer Java Examples

The following examples show how to use org.springframework.cloud.stream.config.ConsumerEndpointCustomizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RabbitMessageChannelBinderConfiguration.java    From spring-cloud-stream-binder-rabbit with Apache License 2.0 6 votes vote down vote up
@Bean
RabbitMessageChannelBinder rabbitMessageChannelBinder(
		@Nullable ListenerContainerCustomizer<AbstractMessageListenerContainer> listenerContainerCustomizer,
		@Nullable MessageSourceCustomizer<AmqpMessageSource> sourceCustomizer,
		@Nullable ProducerMessageHandlerCustomizer<AmqpOutboundEndpoint> producerMessageHandlerCustomizer,
		@Nullable ConsumerEndpointCustomizer<AmqpInboundChannelAdapter> consumerCustomizer,
		List<DeclarableCustomizer> declarableCustomizers) {

	RabbitMessageChannelBinder binder = new RabbitMessageChannelBinder(
			this.rabbitConnectionFactory, this.rabbitProperties,
			provisioningProvider(declarableCustomizers), listenerContainerCustomizer, sourceCustomizer);
	binder.setAdminAddresses(
			this.rabbitBinderConfigurationProperties.getAdminAddresses());
	binder.setCompressingPostProcessor(gZipPostProcessor());
	binder.setDecompressingPostProcessor(deCompressingPostProcessor());
	binder.setNodes(this.rabbitBinderConfigurationProperties.getNodes());
	binder.setExtendedBindingProperties(this.rabbitExtendedBindingProperties);
	binder.setProducerMessageHandlerCustomizer(producerMessageHandlerCustomizer);
	binder.setConsumerEndpointCustomizer(consumerCustomizer);
	return binder;
}
 
Example #2
Source File: AbstractMessageChannelBinder.java    From spring-cloud-stream with Apache License 2.0 5 votes vote down vote up
/**
 * Configure an optional {@link ConsumerEndpointCustomizer} for further
 * configuration of consumer {@link MessageProducer} instances created by the binder.
 * @param endpointCustomizer the {@link ConsumerEndpointCustomizer} to use.
 * @since 3.0
 */
@SuppressWarnings("unchecked")
public void setConsumerEndpointCustomizer(
	@Nullable ConsumerEndpointCustomizer<? extends MessageProducer> endpointCustomizer) {

	this.consumerCustomizer =
			endpointCustomizer == null
			? (handler, destination, group) -> { }
			: (ConsumerEndpointCustomizer<MessageProducer>) endpointCustomizer;
}
 
Example #3
Source File: KafkaBinderActuatorTests.java    From spring-cloud-stream-binder-kafka with Apache License 2.0 4 votes vote down vote up
@Bean
public ConsumerEndpointCustomizer<KafkaMessageDrivenChannelAdapter<?, ?>> consumerCustomizer() {
	return (p, q, g) -> p.setBeanName("setByCustomizer:" + q);
}
 
Example #4
Source File: RabbitBinderModuleTests.java    From spring-cloud-stream-binder-rabbit with Apache License 2.0 4 votes vote down vote up
@Bean
public ConsumerEndpointCustomizer<AmqpInboundChannelAdapter> adapterCustomizer() {
	return (producer, dest, grp) -> producer.setBeanName("setByCustomizer:" + grp);
}