Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback Service Call #106

Open
guvense opened this issue Oct 1, 2021 · 4 comments
Open

Callback Service Call #106

guvense opened this issue Oct 1, 2021 · 4 comments
Assignees

Comments

@guvense
Copy link

guvense commented Oct 1, 2021

When the mock server gets a request after a while sends a request to the given url. This feature might be useful for 3rd API service which works with send notifications. I prepared case:

    {
        "request": {
            "method": "GET",
            "endpoint": "/gophers/01D8EMQ185CA8PRGE20DKZTGSR"            
        },
        "callback": {
            "request": {
                "method": "GET",
                "endpoint": "http://localhost:8089/v1",
                "headers": {
                    "Content-Type": "application/json"
                },
                "body": "{\"test\": \"test\"}"
                    
            },
            "delay" : "5s:10s"
        },
        "response": {
            "status": 200,
            "headers": {
                "Content-Type": "application/json"
            },
            "body": "{\"data\":{\"type\":\"gophers\",\"id\":\"01D8EMQ185CA8PRGE20DKZTGSR\",\"attributes\":{\"name\":\"Zebediah\",\"color\":\"Purples\",\"age\":55}}}"
        }
    }
]

when request get by mock server after given delay, it will send request to "http://localhost:8089/v1""
As mentioned I prepared codes then it works.

@guvense guvense closed this as completed Oct 1, 2021
@guvense guvense reopened this Oct 1, 2021
@aperezg
Copy link
Member

aperezg commented Oct 2, 2021

Hello @guvense thanks for the idea, could you share a real use case for that purpouse, I understand what do you want to achive with this, but I'm not sure is a real problem to solve using mock server, so if you can explain a little bit more the use case would be great :D

@guvense
Copy link
Author

guvense commented Oct 3, 2021

Hello @aperezg, in my case when the mock server gets a request, it should push the event to Kafka. Because I try to mock a service which put request to queue and process request in order. Therefore mock server returns a response after some time it should push the event to kafka. At the same time, my real application listens to kafka.

Another case, some third-party application. notify the status of the request. It can be the status of a money transaction. I will give an endpoint to the mock server, after some delay mock server sends a request about the transaction. Therefore I can simulate it. We can also add sse service, pushing events to Kafka sending HTTP request anything in the callback field.

@musinit
Copy link

musinit commented Aug 14, 2023

We need that as well.
We are developing a payment system. We trigger another 3-rd party by HTTP call, and that API returns a callback to us.
The structure of the configuration is precisely the same, as @guvense suggested.

@peacewalker122
Copy link

peacewalker122 commented Aug 28, 2023

hello @guvense can u assign this to me

#146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants