Skip to main content

Consumer

Consumer allows your application to listen to message queues sent through the Queue API.

Manifest Definition

modules:
consumer:
- key: queue-consumer
# Name of the queue for which this consumer will be invoked
queue: queue-name
# Optional, whether the queue is globally unique (i.e., can be accessed across applications), default is false
global: false
# Optional, transform the message body data
messageTransformer:
tenant: $.tenant
payload:
name: $.name
batchSize: 1
maxRetries: 5
resolver:
function: consumer-function
method: event-listener
function:
- key: consumer-function
handler: consumer.handler

Parameter Explanation

  • global: Whether the queue is globally unique (i.e., can be accessed across applications), default is false.
  • messageTransformer: Used to transform message data, requires tenant field and payload field.
  • batchSize: Number of tasks processed in parallel, default is 1.
  • maxRetries: Maximum number of retries on failure, default is 5.
  • resolver: The function in resolver points to the corresponding key in the function module, and the method in resolver corresponds to the method defined in the execution function. Refer to resolver.