1

I am trying to integrate AMQ with api gateway so that i can push messages directly to AMQ from api gateway using AWS resource option in API gateway and gets this error on deployment AWS ARN for integration contains invalid action.

What action should i use here so that api gatwway know which AMQ it should use to push messages.

what all the things i need to take care so that i can setup apigateway with AMQ

enter image description here

divyanayan awasthi
  • 890
  • 1
  • 8
  • 33

1 Answers1

1

For integrating Amazon MQ with API Gateway, you will not be able to use the "AWS Service" integration. The reason is, "AWS Service" integration is only helpful if the AWS MQ Management API expose an operation to send messages to a MQ Broker. But if you look at the operations exposed by MQ API [1] they just offer the management operations. This is the reason, you cannot use "AWS Service" integration for your use case.

So if your API needs to connect to a MQ Broker and send message, I would suggest your API need to use "Lambda function" integration. To understand more about this, I would recommend to use the following documentation [2].

Then you can implement a Lambda function that initializes a message producer and send the message. For specific source code to implement the message producer and send the message please refer to the section titled "Step 2: Connect a Java Application to Your Broker" in [3].

[1] https://docs.aws.amazon.com/cli/latest/reference/mq/index.html

[2] https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy-for-lambda.html

[3] https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-getting-started.html#connect-java-application

Denis Weerasiri
  • 1,120
  • 1
  • 8
  • 16
  • thanks for the info.even i thought so.Is there any other way to achieve this directly from api gateway? – divyanayan awasthi Feb 22 '19 at 06:42
  • @divyanayan awasthi, there is no direct way. The reason is AMQ does not expose an API to send messages to the Broker. So you need to setup a client (eg- JMS,MQTT) that send the message to the broker. This is the reason I suggested to use a Java based Lambda function. – Denis Weerasiri Feb 22 '19 at 23:10