org.springframework.cloud.aws.messaging.core.QueueMessagingTemplate Java Examples

The following examples show how to use org.springframework.cloud.aws.messaging.core.QueueMessagingTemplate. 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: JavaQueueListenerTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Bean
public QueueMessageHandlerFactory queueMessageHandlerFactory(
		QueueMessagingTemplate queueMessagingTemplate) {
	QueueMessageHandlerFactory factory = new QueueMessageHandlerFactory();
	factory.setSendToMessagingTemplate(queueMessagingTemplate);

	return factory;
}
 
Example #2
Source File: BootQueueMessagingTemplateIntegrationTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Bean
public QueueMessagingTemplate defaultQueueMessagingTemplate(
		AmazonSQSAsync amazonSqs, ResourceIdResolver resourceIdResolver) {
	QueueMessagingTemplate queueMessagingTemplate = new QueueMessagingTemplate(
			amazonSqs, resourceIdResolver);
	queueMessagingTemplate.setDefaultDestinationName("JsonQueue");

	return queueMessagingTemplate;
}
 
Example #3
Source File: BootQueueMessagingTemplateIntegrationTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplateWithCustomConverter(
		AmazonSQSAsync amazonSqs, ResourceIdResolver resourceIdResolver) {
	QueueMessagingTemplate queueMessagingTemplate = new QueueMessagingTemplate(
			amazonSqs, resourceIdResolver);
	queueMessagingTemplate.setDefaultDestinationName("StreamQueue");
	queueMessagingTemplate.setMessageConverter(new ObjectMessageConverter());

	return queueMessagingTemplate;
}
 
Example #4
Source File: JavaQueueMessagingTemplateIntegrationTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Bean
public QueueMessagingTemplate defaultQueueMessagingTemplate(
		AmazonSQSAsync amazonSqs, ResourceIdResolver resourceIdResolver) {
	QueueMessagingTemplate queueMessagingTemplate = new QueueMessagingTemplate(
			amazonSqs, resourceIdResolver);
	queueMessagingTemplate.setDefaultDestinationName("JsonQueue");

	return queueMessagingTemplate;
}
 
Example #5
Source File: JavaQueueMessagingTemplateIntegrationTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplateWithCustomConverter(
		AmazonSQSAsync amazonSqs, ResourceIdResolver resourceIdResolver) {
	QueueMessagingTemplate queueMessagingTemplate = new QueueMessagingTemplate(
			amazonSqs, resourceIdResolver);
	queueMessagingTemplate.setDefaultDestinationName("StreamQueue");
	queueMessagingTemplate.setMessageConverter(new ObjectMessageConverter());

	return queueMessagingTemplate;
}
 
Example #6
Source File: SqsConfigurationTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Test
void configuration_withMinimalBeans_shouldStartSqsListenerContainer()
		throws Exception {
	// Arrange & Act
	AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(
			MinimalConfiguration.class);
	SimpleMessageListenerContainer container = applicationContext
			.getBean(SimpleMessageListenerContainer.class);

	// Assert
	assertThat(container.isRunning()).isTrue();
	QueueMessageHandler queueMessageHandler = applicationContext
			.getBean(QueueMessageHandler.class);
	assertThat(QueueMessageHandler.class.isInstance(queueMessageHandler)).isTrue();

	HandlerMethodReturnValueHandler sendToReturnValueHandler = queueMessageHandler
			.getCustomReturnValueHandlers().get(0);
	QueueMessagingTemplate messagingTemplate = (QueueMessagingTemplate) ReflectionTestUtils
			.getField(sendToReturnValueHandler, "messageTemplate");
	AmazonSQSBufferedAsyncClient amazonBufferedSqsClient = (AmazonSQSBufferedAsyncClient) ReflectionTestUtils
			.getField(messagingTemplate, "amazonSqs");
	AmazonSQSAsyncClient amazonSqsClient = (AmazonSQSAsyncClient) ReflectionTestUtils
			.getField(amazonBufferedSqsClient, "realSQS");
	assertThat(
			ReflectionTestUtils.getField(amazonSqsClient, "awsCredentialsProvider"))
					.isNotNull();
}
 
Example #7
Source File: MessagingConfig.java    From blog-tutorials with MIT License 4 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplate(@Autowired AmazonSQSAsync amazonSQS) {
  return new QueueMessagingTemplate(amazonSQS);
}
 
Example #8
Source File: SampleApplication.java    From spring-boot-aws-mock with MIT License 4 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplate(AmazonSQSAsync amazonSqs) {
	return new QueueMessagingTemplate(amazonSqs);
}
 
Example #9
Source File: Sample2Application.java    From spring-boot-aws-mock with MIT License 4 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplate(AmazonSQSAsync amazonSqs) {
	return new QueueMessagingTemplate(amazonSqs);
}
 
Example #10
Source File: JavaQueueListenerTest.java    From spring-cloud-aws with Apache License 2.0 4 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplate(AmazonSQSAsync amazonSqs,
		ResourceIdResolver resourceIdResolver) {
	return new QueueMessagingTemplate(amazonSqs, resourceIdResolver);
}
 
Example #11
Source File: QueueMessageHandlerFactory.java    From spring-cloud-aws with Apache License 2.0 4 votes vote down vote up
private QueueMessagingTemplate getDefaultSendToQueueMessagingTemplate(
		AmazonSQSAsync amazonSqs, ResourceIdResolver resourceIdResolver) {
	return new QueueMessagingTemplate(amazonSqs, resourceIdResolver,
			getDefaultMappingJackson2MessageConverter(this.objectMapper));
}
 
Example #12
Source File: SqsController.java    From aws-refapp with Apache License 2.0 4 votes vote down vote up
@Autowired
public SqsController(QueueMessagingTemplate queueMessagingTemplate,
                     @Qualifier("sqsWebSocketHandler") SendingTextWebSocketHandler sqsSendingTextWebSocketHandler) {
    this.queueMessagingTemplate = queueMessagingTemplate;
    this.sqsSendingTextWebSocketHandler = sqsSendingTextWebSocketHandler;
}
 
Example #13
Source File: ReferenceApplication.java    From aws-refapp with Apache License 2.0 4 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplate(AmazonSQS amazonSqs, ResourceIdResolver resourceIdResolver) {
    return new QueueMessagingTemplate(amazonSqs, resourceIdResolver);
}
 
Example #14
Source File: SpringCloudAwsConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public QueueMessagingTemplate queueMessagingTemplate(AmazonSQSAsync amazonSQSAsync) {
    return new QueueMessagingTemplate(amazonSQSAsync);
}