Java Code Examples for org.springframework.integration.channel.AbstractMessageChannel

The following examples show how to use org.springframework.integration.channel.AbstractMessageChannel. These examples are extracted from open source projects. 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
protected String getChannelName(MessageChannel messageChannel) {
  String name = null;
  if (ClassUtils.isPresent("org.springframework.integration.context.IntegrationObjectSupport", null)) {
    if (messageChannel instanceof IntegrationObjectSupport) {
      name = ((IntegrationObjectSupport) messageChannel).getComponentName();
    }
    if (name == null && messageChannel instanceof AbstractMessageChannel) {
      name = ((AbstractMessageChannel) messageChannel).getFullChannelName();
    }
  }

  if (name == null) {
    return messageChannel.toString();
  }

  return name;
}
 
Example 2
@Override
protected void postProcessOutputChannel(MessageChannel outputChannel,
		ExtendedProducerProperties<KafkaProducerProperties> producerProperties) {

	if (expressionInterceptorNeeded(producerProperties)) {
		((AbstractMessageChannel) outputChannel).addInterceptor(0, new KafkaExpressionEvaluatingInterceptor(
				producerProperties.getExtension().getMessageKeyExpression(), getEvaluationContext()));
	}
}
 
Example 3
@Override
protected void postProcessOutputChannel(MessageChannel outputChannel,
		ExtendedProducerProperties<RabbitProducerProperties> producerProperties) {
	RabbitProducerProperties extendedProperties = producerProperties.getExtension();
	if (expressionInterceptorNeeded(extendedProperties)) {
		((AbstractMessageChannel) outputChannel).addInterceptor(0,
				new RabbitExpressionEvaluatingInterceptor(
						extendedProperties.getRoutingKeyExpression(),
						extendedProperties.getDelayExpression(),
						getEvaluationContext()));
	}
}
 
Example 4
private String channelName(MessageChannel channel) {
	String name = null;
	if (this.integrationObjectSupportPresent) {
		if (channel instanceof IntegrationObjectSupport) {
			name = ((IntegrationObjectSupport) channel).getComponentName();
		}
		if (name == null && channel instanceof AbstractMessageChannel) {
			name = ((AbstractMessageChannel) channel).getFullChannelName();
		}
	}
	if (name == null) {
		name = channel.toString();
	}
	return name;
}
 
Example 5
/**
 * Setup data-type and message converters for the given message channel.
 * @param channel message channel to set the data-type and message converters
 * @param channelName the channel name
 * @param inbound inbound (i.e., "input") or outbound channel
 */
private void configureMessageChannel(MessageChannel channel, String channelName,
		boolean inbound) {
	Assert.isAssignable(AbstractMessageChannel.class, channel.getClass());
	AbstractMessageChannel messageChannel = (AbstractMessageChannel) channel;
	BindingProperties bindingProperties = this.bindingServiceProperties
			.getBindingProperties(channelName);
	String contentType = bindingProperties.getContentType();
	ProducerProperties producerProperties = bindingProperties.getProducer();
	boolean partitioned = !inbound && producerProperties != null && producerProperties.isPartitioned();
	boolean functional = streamFunctionProperties != null
			&& (StringUtils.hasText(streamFunctionProperties.getDefinition()) || StringUtils.hasText(bindingServiceProperties.getSource()));

	if (partitioned) {
		if (inbound || !functional) {
			messageChannel.addInterceptor(new PartitioningInterceptor(bindingProperties));
		}
	}

	ConsumerProperties consumerProperties = bindingProperties.getConsumer();
	if (this.isNativeEncodingNotSet(producerProperties, consumerProperties, inbound)) {
		if (inbound) {
			messageChannel.addInterceptor(
					new InboundContentTypeEnhancingInterceptor(contentType));
		}
		else {
			messageChannel.addInterceptor(
					new OutboundContentTypeConvertingInterceptor(contentType,
							this.compositeMessageConverter));
		}
	}
}
 
Example 6
private SubscribableChannel provisionDestination(String name, boolean pubSub) {
	String destinationName = name + ".destination";
	SubscribableChannel destination = this.provisionedDestinations
			.get(destinationName);
	if (destination == null) {
		destination = pubSub ? new PublishSubscribeChannel() : new DirectChannel();
		((AbstractMessageChannel) destination).setBeanName(destinationName);
		((AbstractMessageChannel) destination).setComponentName(destinationName);
		this.provisionedDestinations.put(destinationName, destination);
	}
	return destination;
}
 
Example 7
Source Project: spring-cloud-stream   Source File: TestSupportBinder.java    License: Apache License 2.0 5 votes vote down vote up
private BlockingQueue<Message<?>> register(MessageChannel channel,
		boolean useNativeEncoding) {
	// we need to add this interceptor to ensure MessageCollector's compatibility
	// with
	// previous versions of SCSt when native encoding is disabled.
	if (!useNativeEncoding) {
		((AbstractMessageChannel) channel)
				.addInterceptor(new InboundMessageConvertingInterceptor());
	}
	LinkedBlockingDeque<Message<?>> result = new LinkedBlockingDeque<>();
	Assert.isTrue(!this.results.containsKey(channel),
			"Channel [" + channel + "] was already bound");
	this.results.put(channel, result);
	return result;
}
 
Example 8
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 9
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 10
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 11
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 12
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 13
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 14
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 15
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 16
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 17
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 18
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 19
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 20
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 21
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 22
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 23
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 24
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 25
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 26
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 27
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 28
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}
 
Example 29
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll();
}
 
Example 30
@Before
public void setupDb() {
	input = (AbstractMessageChannel) channels.input();
	repository.deleteAll().block();
}