1

We are using Amazon MQ which internally use ActiveMQ. We can trigger AWS lambda function whenever ActiveMQ receives a message. I wrote a lambda function which reads the message from an SQS event. We have a type called SQSevent which we can capture, but in the case of Amazon MQ I don't know what type of function signature to be used.

For SQS we use this:

ProcessSQSMessage( SQSEvent event1, ILambdaContext context) 

I don't know what to use for Amazon MQ:

?ProcessMQMessage( ?? )  

Please help. I don't have access to AWS from local so checking before deploying code.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43

1 Answers1

1

Currently, there is no out of the box event for MQ according to the docs To work with AWS you can follow this recommendation and as described either:

  • use default handler with Stream parameter and convert Stream to a C# class messages. This is how the handler will look like:

    public Stream MyHandler(Stream stream, ILambdaContext context)
         {
            //converting Stream into MQEvent and function logic
         }
    
  • Create a custom implementation of ILambdaSerializer. Then decorate your lambda class with [assembly: LambdaSerializer(typeof(CustomInputDeserializer))]

Maurice
  • 11,482
  • 2
  • 25
  • 45
svoychik
  • 1,188
  • 1
  • 8
  • 19