org.springframework.integration.core.MessageProducer Java Examples

The following examples show how to use org.springframework.integration.core.MessageProducer. 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: TwitterstreamSourceConfiguration.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@Bean
public MessageProducer twitterStream(TwitterTemplate twitterTemplate) {
	TwitterStreamMessageProducer messageProducer =
			new TwitterStreamMessageProducer(twitterTemplate, twitterStreamProperties);
	messageProducer.setOutputChannel(source.output());
	return messageProducer;
}
 
Example #2
Source File: SnsMessageMarshallerTests.java    From spring-integration-aws with MIT License 5 votes vote down vote up
@Test
public void inboundAdapterConfig() {

	final MessageProducer producer = context.getBean("snsInbound",
			MessageProducer.class);
	checkMessageMarshallerRef(getSnsExecutor(producer, "snsExecutor"));
}
 
Example #3
Source File: SqsMessageMarshallerTests.java    From spring-integration-aws with MIT License 5 votes vote down vote up
@Test
public void inboundAdapterConfig() {

	final MessageProducer producer = context.getBean("sqsInbound",
			MessageProducer.class);
	checkMessageMarshallerRef(getSqsExecutor(producer, "sqsExecutor"));
}
 
Example #4
Source File: TestChannelBinder.java    From spring-cloud-stream with Apache License 2.0 5 votes vote down vote up
@Override
protected MessageProducer createConsumerEndpoint(ConsumerDestination destination,
		String group, ConsumerProperties properties) throws Exception {
	ErrorMessageStrategy errorMessageStrategy = new DefaultErrorMessageStrategy();
	SubscribableChannel siBinderInputChannel = ((SpringIntegrationConsumerDestination) destination)
			.getChannel();

	IntegrationMessageListeningContainer messageListenerContainer = new IntegrationMessageListeningContainer();
	IntegrationBinderInboundChannelAdapter adapter = new IntegrationBinderInboundChannelAdapter(
			messageListenerContainer);

	String groupName = StringUtils.hasText(group) ? group : "anonymous";
	ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(destination,
			groupName, properties);
	if (properties.getMaxAttempts() > 1) {
		adapter.setRetryTemplate(buildRetryTemplate(properties));
		adapter.setRecoveryCallback(errorInfrastructure.getRecoverer());
	}
	else {
		adapter.setErrorMessageStrategy(errorMessageStrategy);
		adapter.setErrorChannel(errorInfrastructure.getErrorChannel());
	}

	siBinderInputChannel.subscribe(messageListenerContainer);

	return adapter;
}
 
Example #5
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 #6
Source File: MqttConfig.java    From iot-dc3 with Apache License 2.0 5 votes vote down vote up
/**
 * 说明:
 * ConditionalOnProperty(value = "driver.mqtt.default.receive.enable")
 * 根据配置属性driver.mqtt.default.receive.enable选择是否开启 Default Topic 主题的数据接收逻辑
 *
 * @return
 */
@Bean
@ConditionalOnProperty(value = "driver.mqtt.default.receive.enable")
public MessageProducer defaultInbound() {
    MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter(
            clientId + "_default_inbound_",
            mqttClientFactory(),
            defaultTopic
    );
    adapter.setCompletionTimeout(mqttProperty.getCompletionTimeout());
    adapter.setConverter(new DefaultPahoMessageConverter());
    adapter.setQos(defaultQos);
    adapter.setOutputChannel(defaultMqttInputChannel());
    return adapter;
}
 
Example #7
Source File: PubSubMessageChannelBinder.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@Override
protected MessageProducer createConsumerEndpoint(ConsumerDestination destination, String group,
		ExtendedConsumerProperties<PubSubConsumerProperties> properties) {

	PubSubInboundChannelAdapter adapter = new PubSubInboundChannelAdapter(this.pubSubTemplate,
			destination.getName());

	ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(destination, group, properties);
	adapter.setErrorChannel(errorInfrastructure.getErrorChannel());
	adapter.setAckMode(properties.getExtension().getAckMode());

	return adapter;
}
 
Example #8
Source File: KinesisBinderProcessorTests.java    From spring-cloud-stream-binder-aws-kinesis with Apache License 2.0 5 votes vote down vote up
@Bean
public MessageProducer kinesisMessageDriverChannelAdapter() {
	KinesisMessageDrivenChannelAdapter kinesisMessageDrivenChannelAdapter =
			new KinesisMessageDrivenChannelAdapter(amazonKinesis(), Processor.OUTPUT);
	kinesisMessageDrivenChannelAdapter.setOutputChannel(fromProcessorChannel());
	kinesisMessageDrivenChannelAdapter.setConverter(null);
	kinesisMessageDrivenChannelAdapter.setBindSourceRecord(true);

	DirectFieldAccessor dfa = new DirectFieldAccessor(kinesisMessageDrivenChannelAdapter);
	dfa.setPropertyValue("describeStreamBackoff", 10);
	dfa.setPropertyValue("consumerBackoff", 10);
	dfa.setPropertyValue("idleBetweenPolls", 1);

	return kinesisMessageDrivenChannelAdapter;
}
 
Example #9
Source File: KinesisTestBinder.java    From spring-cloud-stream-binder-aws-kinesis with Apache License 2.0 5 votes vote down vote up
@Override
protected MessageProducer createConsumerEndpoint(ConsumerDestination destination,
		String group,
		ExtendedConsumerProperties<KinesisConsumerProperties> properties) {

	MessageProducer messageProducer = super.createConsumerEndpoint(destination,
			group, properties);
	DirectFieldAccessor dfa = new DirectFieldAccessor(messageProducer);
	dfa.setPropertyValue("describeStreamBackoff", 10);
	dfa.setPropertyValue("consumerBackoff", 10);
	dfa.setPropertyValue("idleBetweenPolls", 1);
	return messageProducer;
}
 
Example #10
Source File: KinesisMessageChannelBinder.java    From spring-cloud-stream-binder-aws-kinesis with Apache License 2.0 5 votes vote down vote up
@Override
protected MessageProducer createConsumerEndpoint(ConsumerDestination destination,
		String group,
		ExtendedConsumerProperties<KinesisConsumerProperties> properties) {

	ConsumerDestination destinationToUse = destination;

	if (properties.getExtension().isDynamoDbStreams()) {
		DescribeTableResult describeTableResult = this.dynamoDBClient.describeTable(destinationToUse.getName());
		String latestStreamArn = describeTableResult.getTable().getLatestStreamArn();
		if (StringUtils.hasText(latestStreamArn)) {
			destinationToUse = new KinesisConsumerDestination(latestStreamArn, Collections.emptyList());
		}
		else {
			throw new ProvisioningException("The DynamoDB table ["
					+ destinationToUse.getName()
					+ "] doesn't have Streams enabled.");
		}
	}
	else {
		this.streamsInUse.add(destinationToUse.getName());
	}

	MessageProducer adapter;
	if (this.configurationProperties.isKplKclEnabled()) {
		adapter = createKclConsumerEndpoint(destinationToUse, group, properties);
	}
	else {
		adapter = createKinesisConsumerEndpoint(destinationToUse, group, properties);
	}

	return adapter;
}
 
Example #11
Source File: MqttConfig.java    From iot-dc3 with Apache License 2.0 5 votes vote down vote up
@Bean
public MessageProducer inbound() {
    MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter(
            clientId + "_inbound",
            mqttClientFactory(),
            mqttProperty.getTopics().toArray(new String[0])
    );
    adapter.setCompletionTimeout(mqttProperty.getCompletionTimeout());
    adapter.setConverter(new DefaultPahoMessageConverter());
    adapter.setQos(mqttProperty.getQos().stream().mapToInt(Integer::valueOf).toArray());
    adapter.setOutputChannel(mqttInputChannel());
    return adapter;
}
 
Example #12
Source File: RabbitMessageChannelBinder.java    From spring-cloud-stream-binder-rabbit with Apache License 2.0 4 votes vote down vote up
@Override
protected MessageProducer createConsumerEndpoint(
		ConsumerDestination consumerDestination, String group,
		ExtendedConsumerProperties<RabbitConsumerProperties> properties) {
	Assert.state(!HeaderMode.embeddedHeaders.equals(properties.getHeaderMode()),
			"the RabbitMQ binder does not support embedded headers since RabbitMQ supports headers natively");
	String destination = consumerDestination.getName();
	boolean directContainer = properties.getExtension().getContainerType()
			.equals(ContainerType.DIRECT);
	AbstractMessageListenerContainer listenerContainer = directContainer
			? new DirectMessageListenerContainer(this.connectionFactory)
			: new SimpleMessageListenerContainer(this.connectionFactory);
	listenerContainer
			.setAcknowledgeMode(properties.getExtension().getAcknowledgeMode());
	listenerContainer.setChannelTransacted(properties.getExtension().isTransacted());
	listenerContainer
			.setDefaultRequeueRejected(properties.getExtension().isRequeueRejected());
	int concurrency = properties.getConcurrency();
	concurrency = concurrency > 0 ? concurrency : 1;
	if (directContainer) {
		setDMLCProperties(properties,
				(DirectMessageListenerContainer) listenerContainer, concurrency);
	}
	else {
		setSMLCProperties(properties,
				(SimpleMessageListenerContainer) listenerContainer, concurrency);
	}
	listenerContainer.setPrefetchCount(properties.getExtension().getPrefetch());
	listenerContainer
			.setRecoveryInterval(properties.getExtension().getRecoveryInterval());
	listenerContainer.setTaskExecutor(
			new SimpleAsyncTaskExecutor(consumerDestination.getName() + "-"));
	String[] queues = StringUtils.tokenizeToStringArray(destination, ",", true, true);
	listenerContainer.setQueueNames(queues);
	listenerContainer.setAfterReceivePostProcessors(this.decompressingPostProcessor);
	listenerContainer.setMessagePropertiesConverter(
			RabbitMessageChannelBinder.inboundMessagePropertiesConverter);
	listenerContainer.setExclusive(properties.getExtension().isExclusive());
	listenerContainer
			.setMissingQueuesFatal(properties.getExtension().getMissingQueuesFatal());
	if (properties.getExtension().getFailedDeclarationRetryInterval() != null) {
		listenerContainer.setFailedDeclarationRetryInterval(
				properties.getExtension().getFailedDeclarationRetryInterval());
	}
	if (getApplicationEventPublisher() != null) {
		listenerContainer
				.setApplicationEventPublisher(getApplicationEventPublisher());
	}
	else if (getApplicationContext() != null) {
		listenerContainer.setApplicationEventPublisher(getApplicationContext());
	}
	getContainerCustomizer().configure(listenerContainer,
			consumerDestination.getName(), group);
	if (StringUtils.hasText(properties.getExtension().getConsumerTagPrefix())) {
		final AtomicInteger index = new AtomicInteger();
		listenerContainer.setConsumerTagStrategy(
				q -> properties.getExtension().getConsumerTagPrefix() + "#"
						+ index.getAndIncrement());
	}
	listenerContainer.afterPropertiesSet();

	AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(
			listenerContainer);
	adapter.setBindSourceMessage(true);
	adapter.setBeanFactory(this.getBeanFactory());
	adapter.setBeanName("inbound." + destination);
	DefaultAmqpHeaderMapper mapper = DefaultAmqpHeaderMapper.inboundMapper();
	mapper.setRequestHeaderNames(properties.getExtension().getHeaderPatterns());
	adapter.setHeaderMapper(mapper);
	ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(
			consumerDestination, group, properties);
	if (properties.getMaxAttempts() > 1) {
		adapter.setRetryTemplate(buildRetryTemplate(properties));
		adapter.setRecoveryCallback(errorInfrastructure.getRecoverer());
	}
	else {
		adapter.setErrorMessageStrategy(errorMessageStrategy);
		adapter.setErrorChannel(errorInfrastructure.getErrorChannel());
	}
	adapter.setMessageConverter(passThoughConverter);
	return adapter;
}
 
Example #13
Source File: KinesisMessageChannelBinder.java    From spring-cloud-stream-binder-aws-kinesis with Apache License 2.0 4 votes vote down vote up
private MessageProducer createKclConsumerEndpoint(ConsumerDestination destination, String group,
		ExtendedConsumerProperties<KinesisConsumerProperties> properties) {
	KinesisConsumerProperties kinesisConsumerProperties = properties.getExtension();

	String shardIteratorType = kinesisConsumerProperties.getShardIteratorType();

	AmazonKinesis amazonKinesisClient =
			kinesisConsumerProperties.isDynamoDbStreams()
					? this.dynamoDBStreamsAdapter
					: this.amazonKinesis;

	String stream = destination.getName();

	KinesisClientLibConfiguration kinesisClientLibConfiguration = obtainKinesisClientLibConfiguration(stream, group);

	KclMessageDrivenChannelAdapter adapter;

	String consumerGroup;
	if (kinesisClientLibConfiguration == null) {
		adapter = new KclMessageDrivenChannelAdapter(stream, amazonKinesisClient, this.cloudWatchClient,
						this.dynamoDBClient, this.awsCredentialsProvider);
		boolean anonymous = !StringUtils.hasText(group);
		consumerGroup = anonymous ? "anonymous." + UUID.randomUUID().toString() : group;
		adapter.setConsumerGroup(consumerGroup);
		if (StringUtils.hasText(shardIteratorType)) {
			adapter.setStreamInitialSequence(InitialPositionInStream.valueOf(shardIteratorType));
		}
		adapter.setIdleBetweenPolls(kinesisConsumerProperties.getIdleBetweenPolls());
		adapter.setConsumerBackoff(kinesisConsumerProperties.getConsumerBackoff());
		if (kinesisConsumerProperties.getWorkerId() != null) {
			adapter.setWorkerId(kinesisConsumerProperties.getWorkerId());
		}
	}
	else {
		adapter = new KclMessageDrivenChannelAdapter(kinesisClientLibConfiguration, amazonKinesisClient,
				this.cloudWatchClient, this.dynamoDBClient);
		consumerGroup = kinesisClientLibConfiguration.getApplicationName();
	}

	adapter.setCheckpointMode(kinesisConsumerProperties.getCheckpointMode());
	adapter.setCheckpointsInterval(kinesisConsumerProperties.getCheckpointInterval());

	adapter.setListenerMode(kinesisConsumerProperties.getListenerMode());

	if (properties.isUseNativeDecoding()) {
		adapter.setConverter(null);
	}
	else {
		// Defer byte[] conversion to the InboundContentTypeConvertingInterceptor
		adapter.setConverter((bytes) -> bytes);
	}

	ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(destination, consumerGroup, properties);
	adapter.setErrorMessageStrategy(ERROR_MESSAGE_STRATEGY);
	adapter.setErrorChannel(errorInfrastructure.getErrorChannel());
	adapter.setBindSourceRecord(true);
	return adapter;
}
 
Example #14
Source File: AbstractMessageChannelBinderTests.java    From spring-cloud-stream with Apache License 2.0 4 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testEndpointLifecycle() throws Exception {
	// @checkstyle:off
	AbstractMessageChannelBinder<ConsumerProperties, ProducerProperties, ProvisioningProvider<ConsumerProperties, ProducerProperties>> binder = this.context
			.getBean(AbstractMessageChannelBinder.class);
	// @checkstyle:on

	ConsumerProperties consumerProperties = new ConsumerProperties();
	consumerProperties.setMaxAttempts(1); // to force error infrastructure creation

	Binding<MessageChannel> consumerBinding = binder.bindConsumer("foo", "fooGroup",
			new DirectChannel(), consumerProperties);
	DirectFieldAccessor consumerBindingAccessor = new DirectFieldAccessor(
			consumerBinding);
	MessageProducer messageProducer = (MessageProducer) consumerBindingAccessor
			.getPropertyValue("lifecycle");
	assertThat(((Lifecycle) messageProducer).isRunning()).isTrue();
	assertThat(messageProducer.getOutputChannel()).isNotNull();

	SubscribableChannel errorChannel = (SubscribableChannel) consumerBindingAccessor
			.getPropertyValue("lifecycle.errorChannel");
	assertThat(errorChannel).isNotNull();
	Set<MessageHandler> handlers = TestUtils.getPropertyValue(errorChannel,
			"dispatcher.handlers", Set.class);
	assertThat(handlers.size()).isEqualTo(2);
	Iterator<MessageHandler> iterator = handlers.iterator();
	assertThat(iterator.next()).isInstanceOf(BridgeHandler.class);
	assertThat(iterator.next()).isInstanceOf(LastSubscriberMessageHandler.class);
	assertThat(this.context.containsBean("foo.fooGroup.errors")).isTrue();
	assertThat(this.context.containsBean("foo.fooGroup.errors.recoverer")).isTrue();
	assertThat(this.context.containsBean("foo.fooGroup.errors.handler")).isTrue();
	assertThat(this.context.containsBean("foo.fooGroup.errors.bridge")).isTrue();
	consumerBinding.unbind();
	assertThat(this.context.containsBean("foo.fooGroup.errors")).isFalse();
	assertThat(this.context.containsBean("foo.fooGroup.errors.recoverer")).isFalse();
	assertThat(this.context.containsBean("foo.fooGroup.errors.handler")).isFalse();
	assertThat(this.context.containsBean("foo.fooGroup.errors.bridge")).isFalse();

	assertThat(((Lifecycle) messageProducer).isRunning()).isFalse();

	ProducerProperties producerProps = new ProducerProperties();
	producerProps.setErrorChannelEnabled(true);
	Binding<MessageChannel> producerBinding = binder.bindProducer("bar",
			new DirectChannel(), producerProps);
	assertThat(this.context.containsBean("bar.errors")).isTrue();
	assertThat(this.context.containsBean("bar.errors.bridge")).isTrue();
	producerBinding.unbind();
	assertThat(this.context.containsBean("bar.errors")).isFalse();
	assertThat(this.context.containsBean("bar.errors.bridge")).isFalse();
}
 
Example #15
Source File: SqsPermissionsParserTests.java    From spring-integration-aws with MIT License 4 votes vote down vote up
@Test
public void inboundAdapterPermissions() {
	MessageProducer producer = context.getBean("sqs-inbound",
			MessageProducer.class);
	assertThat(producer, is(notNullValue()));

	final SqsExecutor executor = TestUtils.getPropertyValue(producer,
			"sqsExecutor", SqsExecutor.class);
	assertThat(executor, is(notNullValue()));

	@SuppressWarnings("unchecked")
	Set<Permission> permissions = (Set<Permission>) TestUtils
			.getPropertyValue(executor, "permissions");
	assertThat("permissions is not null", permissions, is(notNullValue()));
	assertThat("all permissions loaded", permissions.size(), is(equalTo(2)));

	Set<String> labels = new HashSet<String>();
	Map<String, Set<String>> labelActionMap = new HashMap<String, Set<String>>();
	Map<String, Set<String>> labelAccountMap = new HashMap<String, Set<String>>();

	for (Permission p : permissions) {
		labels.add(p.getLabel());
		assertThat("actions are not null", p.getActions(),
				is(notNullValue()));
		assertThat("awsAccounts are not null", p.getAwsAccountIds(),
				is(notNullValue()));
		labelActionMap.put(p.getLabel(), p.getActions());
		labelAccountMap.put(p.getLabel(), p.getAwsAccountIds());
	}

	assertThat("All labels found", labels,
			containsInAnyOrder("label1", "label2"));
	assertThat("All label1 actions loaded", labelActionMap.get("label1"),
			containsInAnyOrder("SendMessage", "GetQueueUrl"));
	assertThat("All label2 actions loaded", labelActionMap.get("label2"),
			containsInAnyOrder("ReceiveMessage"));
	assertThat("All label1 accounts loaded", labelAccountMap.get("label1"),
			containsInAnyOrder("12345", "23456", "34567"));
	assertThat("All label2 accounts loaded", labelAccountMap.get("label2"),
			containsInAnyOrder("45678"));
}
 
Example #16
Source File: RocketMQMessageChannelBinder.java    From spring-cloud-alibaba with Apache License 2.0 4 votes vote down vote up
@Override
protected MessageProducer createConsumerEndpoint(ConsumerDestination destination,
		String group,
		ExtendedConsumerProperties<RocketMQConsumerProperties> consumerProperties)
		throws Exception {
	if (group == null || "".equals(group)) {
		throw new RuntimeException(
				"'group must be configured for channel " + destination.getName());
	}

	RocketMQListenerBindingContainer listenerContainer = new RocketMQListenerBindingContainer(
			consumerProperties, rocketBinderConfigurationProperties, this);
	listenerContainer.setConsumerGroup(group);
	listenerContainer.setTopic(destination.getName());
	listenerContainer.setConsumeThreadMax(consumerProperties.getConcurrency());
	listenerContainer.setSuspendCurrentQueueTimeMillis(
			consumerProperties.getExtension().getSuspendCurrentQueueTimeMillis());
	listenerContainer.setDelayLevelWhenNextConsume(
			consumerProperties.getExtension().getDelayLevelWhenNextConsume());
	listenerContainer
			.setNameServer(rocketBinderConfigurationProperties.getNameServer());
	listenerContainer.setHeaderMapper(createHeaderMapper(consumerProperties));

	RocketMQInboundChannelAdapter rocketInboundChannelAdapter = new RocketMQInboundChannelAdapter(
			listenerContainer, consumerProperties, instrumentationManager);

	topicInUse.put(destination.getName(), group);

	ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(destination,
			group, consumerProperties);
	if (consumerProperties.getMaxAttempts() > 1) {
		rocketInboundChannelAdapter
				.setRetryTemplate(buildRetryTemplate(consumerProperties));
		rocketInboundChannelAdapter
				.setRecoveryCallback(errorInfrastructure.getRecoverer());
	}
	else {
		rocketInboundChannelAdapter
				.setErrorChannel(errorInfrastructure.getErrorChannel());
	}

	return rocketInboundChannelAdapter;
}
 
Example #17
Source File: SnsPermissionsParserTests.java    From spring-integration-aws with MIT License 4 votes vote down vote up
@Test
public void inboundAdapterPermissions() {
	MessageProducer producer = context.getBean("sns-inbound",
			MessageProducer.class);
	assertThat(producer, is(notNullValue()));

	final SnsExecutor executor = TestUtils.getPropertyValue(producer,
			"snsExecutor", SnsExecutor.class);
	assertThat("snsExecutor is not null", executor, is(notNullValue()));

	@SuppressWarnings("unchecked")
	Set<Permission> permissions = (Set<Permission>) TestUtils
			.getPropertyValue(executor, "permissions");
	assertThat("permissions is not null", permissions, is(notNullValue()));
	assertThat("all permissions loaded", permissions.size(), is(equalTo(2)));

	Set<String> labels = new HashSet<String>();
	Map<String, Set<String>> labelActionMap = new HashMap<String, Set<String>>();
	Map<String, Set<String>> labelAccountMap = new HashMap<String, Set<String>>();

	for (Permission p : permissions) {
		labels.add(p.getLabel());
		assertThat("actions are not null", p.getActions(),
				is(notNullValue()));
		assertThat("awsAccounts are not null", p.getAwsAccountIds(),
				is(notNullValue()));
		labelActionMap.put(p.getLabel(), p.getActions());
		labelAccountMap.put(p.getLabel(), p.getAwsAccountIds());
	}

	assertThat("All labels found", labels,
			containsInAnyOrder("label1", "label2"));
	assertThat("All label1 actions loaded", labelActionMap.get("label1"),
			containsInAnyOrder("Publish", "Receive"));
	assertThat("All label2 actions loaded", labelActionMap.get("label2"),
			containsInAnyOrder("GetTopicAttributes"));
	assertThat("All label1 accounts loaded", labelAccountMap.get("label1"),
			containsInAnyOrder("123456", "234567", "345678"));
	assertThat("All label2 accounts loaded", labelAccountMap.get("label2"),
			containsInAnyOrder("456789"));
}
 
Example #18
Source File: SnsInboundChannelAdapterParserTests.java    From spring-integration-aws with MIT License 4 votes vote down vote up
public void setUp(String name, Class<?> cls, String consumerId) {
	context = new ClassPathXmlApplicationContext(name, cls);
	producer = this.context.getBean(consumerId, MessageProducer.class);
	messageMarshaller = new JsonMessageMarshaller();
}
 
Example #19
Source File: AbstractMessageChannelBinder.java    From spring-cloud-stream with Apache License 2.0 2 votes vote down vote up
/**
 * Creates {@link MessageProducer} that receives data from the consumer destination.
 * will be started and stopped by the binder.
 * @param group the consumer group
 * @param destination reference to the consumer destination
 * @param properties the consumer properties
 * @return the consumer endpoint.
 * @throws Exception when consumer endpoint creation failed.
 */
protected abstract MessageProducer createConsumerEndpoint(
		ConsumerDestination destination, String group, C properties) throws Exception;