Constructor
new MessageSubscribeSpec(params)
Parameters:
Name | Type | Description |
---|---|---|
params | MessageSubscribeSpecParams |
Members
consumer :number|null
Indicates the position in the instrumented consumer function's arguments list that represents the thing that will handle messages.
Type:
- number |
null
functions :Array.<string>|null
Indicates names of functions to be wrapped for message consumption. This must be used in tandem with consumer.
Type:
- Array.<string> |
null
// Wrap the eachMessage method on a consumer
class Consumer() {
constructor() {}
async run(consumer) {
consumer.eachMessage({ message })
}
}
const spec = new MessageSubscribeSpec({
name: 'Consumer#run'
promise: true
consumer: shim.FIRST,
functions: ['eachMessage']
})
shim.recordSubscribedConsume(Consumer.prototype, 'run', spec)