wiremock / wiremock/wiremock.org

Webhooks - Allow ordering to cater for multiple posts

Open
#352 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
12
Forks
71
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the serveEventListeners handling described in the issue and reproduce the configuration with two POST targets. Determine how listener dispatch currently chooses between /v1 and /v2 and how ordering should be represented. Done means repeated requests consistently call /v1 before /v2, with coverage for the ordering behavior.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.