Make exchanges persistent with MongoDB. You can search and inspect the HTTP traffic later even after restarts. View live data in the Admin Console from the MongoDB store. Great for debugging, audits, or traffic insights.
- Run MongoDB:
-
Run the following command to start MongoDB in a Docker container:
docker run --name mongo -p 27017:27017 mongo:latest
-
This starts MongoDB, accessible at
mongodb://localhost:27017.
-
-
Download MongoDB Driver:
- Download these three JARs (all the same version):
- Place all three JARs in the
libdirectory of your Membrane installation.
-
Run membrane:
./membrane.sh- You can test it using curl:
curl -X POST http://localhost:2000 -H "Content-Type: application/json" -d '{"message": "Hallo"}'- Verify Exchange Storage via Admin Console:
- Open the Admin Console by navigating to
http://localhost:9000in your browser. - Under the
Callsection, you will see a list of exchanges. These are the same entries stored in the MongoDB collection. - Even if you stop Membrane and restart it, the exchanges will still appear in the Admin Console. This is because Membrane pulls the exchange data from MongoDB on startup.
- Take a look at the
apis.yamlto see how it is configured.