Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AWS SQS FIFO queues #221

Open
johndevs opened this issue Feb 27, 2022 · 3 comments
Open

Support AWS SQS FIFO queues #221

johndevs opened this issue Feb 27, 2022 · 3 comments

Comments

@johndevs
Copy link

johndevs commented Feb 27, 2022

Expected Behavior

I expect the examples in the documentation to work with Amazon SQS Fifo queues

Actual Behaviour

When sending a message the following exception is thrown:

18:17:25.996 ERROR c.a.s.j.AmazonSQSMessagingClientWrapper - AmazonServiceException: sendMessage. RequestId: 78676d41-b0bc-50f9-ab6b-37d404d947a7
HTTPStatusCode: 400 AmazonErrorCode: MissingParameter
com.amazonaws.services.sqs.model.AmazonSQSException: The request must contain the parameter MessageGroupId. (Service: AmazonSQS; Status Code: 400; Error Code: MissingParameter; Request ID: 78676d41-b0bc-50f9-ab6b-37d404d947a7; Proxy: null)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1862)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1415)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1384)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1154)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:811)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:779)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:753)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:713)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:695)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:559)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:539)
	at com.amazonaws.services.sqs.AmazonSQSClient.doInvoke(AmazonSQSClient.java:2271)
	at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2238)
	at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2227)
	at com.amazonaws.services.sqs.AmazonSQSClient.executeSendMessage(AmazonSQSClient.java:1817)
	at com.amazonaws.services.sqs.AmazonSQSClient.sendMessage(AmazonSQSClient.java:1786)
	at com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper.sendMessage(AmazonSQSMessagingClientWrapper.java:202)
	at com.amazon.sqs.javamessaging.SQSMessageProducer.sendInternal(SQSMessageProducer.java:143)
	at com.amazon.sqs.javamessaging.SQSMessageProducer.send(SQSMessageProducer.java:359)
	at com.amazon.sqs.javamessaging.SQSMessageProducer.send(SQSMessageProducer.java:384)
	at io.micronaut.jms.templates.JmsProducer.send(JmsProducer.java:162)
	at io.micronaut.jms.templates.JmsProducer.send(JmsProducer.java:90)
	at io.micronaut.jms.configuration.JMSProducerMethodInterceptor.intercept(JMSProducerMethodInterceptor.java:116)
	at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
	at com.devsoap.hits.aws.AmazonSqsService$MessageProducer$Intercepted.send(Unknown Source)
	at com.devsoap.hits.aws.AmazonSqsService.onApplicationEvent(AmazonSqsService.java:33)
	at com.devsoap.hits.aws.AmazonSqsService.onApplicationEvent(AmazonSqsService.java:18)
	at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
	at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
	at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

3.1.1

@marcmarcet
Copy link

I think you can use fifo queues by just setting the right message headers. Something like this should work:

@JMSProducer(CONNECTION_FACTORY_BEAN_NAME)
interface TestProducer {
    @Queue("my-queue-name.fifo")
    fun send(
        @MessageBody message: String,
        @MessageHeader("JMSXGroupID") messageGroupId: String,
        @MessageHeader("JMS_SQS_DeduplicationId") messageDeduplicationId: String
    )
}

@elliottpope
Copy link
Collaborator

@johndevs can you confirm whether the provided solution works for your use case?

@Kumar2106
Copy link

@elliottpope I am also facing the same issue, I have tried the solution given by @marcmarcet but it is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants