Hi @here,
I have followed the documentation to define a consumer for Forge Async Events: https://developer.atlassian.com/platform/forge/runtime-reference/async-events-api/
Here are the relevant manifest parts:
modules:
consumer:
# Name of the queue for which this consumer will be invoked
queue: queue-name
resolver:
function: consumer-function
# resolver function to be called with payload
method: event-listener
## some other definitions ...
function:
- key: consumer-function
handler: consumer.handler
The deployment fails with the following message:
What am I doing wrong?
Hi @a.yessipovskiy,
Haven’t had the chance yet to play with async events myself, but based on the error message, have you tried making an array out of the consumer
as suggested?
modules:
consumer:
- queue: queue-name
resolver:
function: consumer-function
method: event-listener
Cheers,
Sven
Hey @SvenSchatter ,
thank you for the hint. I was not sure how to make an array out of a “queue”. Tried that, the linter wants me then to provide a key, added a key and it produces then another error. Will play arround a bit with other attributes and wait for an official response, in case of a success will also let you know.
1 Like
What’s also interesting is that the manifest.d.ts describes a structure which is different to the one defined in the documentation:
consumer?: [
{
queue: Queue;
resolver: {
function: string;
method: string;
};
key: ModuleKeySchema;
},
so it really expects a key. Error in the documentation? Or was there an update to the package which did not work right? This is the version of the @forge/manifest (dependency) installed with the current version of @forge/cli: @forge/manifest@2.3.0
According to the npm the latest version of the manifest package is: @forge/manifest@2.3.0 but there is a next version available: 2.4.0-next.5
The deployment linter seems to accept this structure:
consumer:
# Name of the queue for which this consumer will be invoked
- key: queue-key
queue: queue-name
resolver:
function: consumer-function
# resolver function to be called with payload
method: event-listener
function:
- key: consumer-function
handler: consumer.handler
Queues seem also to work fine, so the Documentation page needs to be corrected.
tagging @SvenSchatter
2 Likes
Hey @a.yessipovskiy ,
Thanks a lot for highlighting this and sharing feedback. I will look into updating the documentation to update the consumer code example.
Cheers,
Ajay
Hey @amathur , you are welcome. It was fun to dig into the source code.
1 Like