Skip to content

Webhooks - Allow ordering to cater for multiple posts #352

@absb909

Description

@absb909

Proposal

It would be great if the serveEventListeners can be extended to include an ordering mechanism. eg. using the request below

{
"request": {
"url": "/go"
},
"response": {
"status": 200,
"delayDistribution": {
"type": "uniform",
"lower": 250,
"upper": 500
},
"headers": {
"Content-Type": "text/xml;charset=UTF-8"
},
"transformers": ["response-template"]
},
"serveEventListeners": [
{
"name": "webhook",
"sequence":"1",
"parameters": {
"method": "POST",
"url": "http://localhost:8081/v1",
"headers": {
"Content-Type": "application/json"
},
"delay": {
"type": "fixed",
"milliseconds": 5000
},
"body": "PostedToV1"
}
},
{
"name": "webhook",
"sequence":"2"
"parameters": {
"method": "POST",
"url": "http://localhost:8081/v2",
"headers": {
"Content-Type": "application/json"
},
"delay": {
"type": "fixed",
"milliseconds": 5000
},
"body": "PostedToV2"
}
}
]

	  },

the template above does indeed post to /v1 and /v2, however there doesnt seem to be a way to specify ordering, a way to enforce the calling of v1 first, then v2, either with a sequence attribute, or the likes. In my case, there is a dependancy that requires /v1 to get hit first, and then /v2. As it currently stands, it seems the either v1 or v2 will get hit at random. Below is from posting twice , back to back.

2025-04-13 08:35:01.374 INFO 17977 --- [nio-8081-exec-1] z.c.a.a.controllers.HomeController : HIT V2 --> PostedToV2
2025-04-13 08:35:01.375 INFO 17977 --- [nio-8081-exec-2] z.c.a.a.controllers.HomeController : HIT V1--> PostedToV1
2025-04-13 08:35:23.141 INFO 17977 --- [nio-8081-exec-5] z.c.a.a.controllers.HomeController : HIT V1--> PostedToV1
2025-04-13 08:35:23.141 INFO 17977 --- [nio-8081-exec-6] z.c.a.a.controllers.HomeController : HIT V2 --> PostedToV2

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions