🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
Test REST Consumers against a Mock
Hello, I am trying to test the following scenario:
I publish a mesage to a topic called rest, and then A rest Consumer picks that mesasge up and sends it to the mock server.
Is this scenario possible?
If so, i'll be running a postman mock and Solace will be running localy on Docker(I think i might run into some ssl problems).
Comments
-
hi @PedromDimas
Yes that is possible with RDP, where basically you'll have a Queue subscribing to the topic and then binding that Queue to a REST Delivery Point that will act as a REST client for your mock server.
Here's one code labs that might be useful.
In addition to that, couple of points I'd like to promote around RDP:
- learn more about the dynamic stuff, which is the substitution expression documented here.
- the topic can be many, and with finer grain topic name, the Queue can then subscribes with a wildcard to make things more interesting and flexible.
1 -
Hello @arih !
Many thanks for the information!
I will analyse the materials that you mentioned!0 -
Hello again @arih
After following the steps on the code labs i got an error which is wierd and i dont know how to solve this.So, i configured ngrock to forward localhost:3000 where i had a mock server running.
After that i followed all the steps on the code lab and ended up with this error:
Destination unreachable seemed wierd so i opened a terminal inside the docker container of solace and did a curl to the ngrock and it worked.
Does any one know why this happened?0 -
Hi @PedromDimas
I'm not familiar with Ngrock, or maybe it's Ngrok?
While I'm looking at that, can you try curl-ing host.docker.internal:3000 from Solace container first?
0 -
Wait, the error there is for the 'last' failure, doesn't mean it's still happening. I just realised the op status is actually Up in the picture there
check the RDP page and REST consumer page if everything is green / up.'
if you still don't see the event in your mock server, then something else is going on.
0 -
This is my mock setup:
the server running on my localhost:3000
ngrok tunneling it
a queue called rest-q
subscribed to topic rest
One rest client called rdp-rest
which is down
One rest Consumer
which is down
one queu-binding to rest-q
This is my brest consumerThe way i am testing it is i use the try me and publish to rest topic
Solace is running in docker on my local machine.
the curl
the curl to my ngrokThe solace container can reach my ngrok.
I do not know where i failed0 -
And @arih
Thank you so much for the help!0 -
Okay, so I did some tests on my own, and it seems Ngrok can give you different destination each time. I've seen the remote endpoint sometimes up and sometimes down and having different address each time
When it works it works, but when it's not it can be a peer TCP closed, or it can be unreachable, or other errors. So for now I think relying on Ngrok is not a good idea
I'm assuming Ngrok is just for dev or for convenience anyway, not production setup right?
So I suggest to just rely on docker networking instead. What OS are you running? I just searched and it seems for Linux you need to enable the host.docker.internal first. See here: https://medium.com/@TimvanBaarsen/how-to-connect-to-the-docker-host-from-inside-a-docker-container-112b4c71bc66
1 -
Ngrok is being used just for conevenience while developing, no production.
I'll try to use docker netwoking.
Thank you!1