https://github.com/sfinx13/poc-celery-message-broker
Call a soap api asynchronous service with celery and a message broker
https://github.com/sfinx13/poc-celery-message-broker
celery design-pattern mock-server python redis soap soap-ui wiremock
Last synced: 8 months ago
JSON representation
Call a soap api asynchronous service with celery and a message broker
- Host: GitHub
- URL: https://github.com/sfinx13/poc-celery-message-broker
- Owner: sfinx13
- Created: 2022-03-18T14:39:36.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-09-07T07:32:54.000Z (9 months ago)
- Last Synced: 2025-09-07T09:20:56.042Z (9 months ago)
- Topics: celery, design-pattern, mock-server, python, redis, soap, soap-ui, wiremock
- Language: Python
- Homepage:
- Size: 341 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Asynchronous tasks with celery
Demo made with zeep as soap client and celery to manage the request asynchronously
Add a mock-server for soap endpoint
## Installation
> Create virtual environments
```
python -m venv env
```
> Activate virtual environment
```
source env/bin/activate
```
> Install packages with pip
```
pip install -r requirements.txt
```
> Install dependencies wiremock + redis
```
docker-compose up -d
```
## [Mock server] Prerequisite
Import packed project from soap-ui/test-soap-soapui-project.xml.zip
https://support.smartbear.com/readyapi/docs/projects/import.html
Launch mock server
https://www.soapui.org/docs/soap-mocking/service-mocking-overview/
Uncommment mock config/settings.ini and comment real api
```
### MOCK API (SOAP-UI)
wsdl_number_conversion_service = http://localhost:8088/NumberConversion.wso?WSDL
```
## Usage
> Run celery worker server
```
celery -A tasks worker --loglevel=INFO
```
> Call the task to_words
```
$ python
>>> from tasks import convert_to_words
>>> result = convert_to_words.delay(56324)
>>> result.status
'SUCCESS'
```
> Call the task to_dollars
```
$ python
>>> from tasks import convert_to_dollars
>>> result = convert_to_dollars.delay(56324)
>>> result.status
'SUCCESS'
```
> See what happend in worker terminal

## Documentation
* [Soap client with zeep](https://docs.python-zeep.org/en/master/)
* [First steps with celery](https://docs.celeryq.dev/en/stable/getting-started/first-steps-with-celery.html#first-steps)
* [Next steps with celery](https://docs.celeryq.dev/en/stable/getting-started/next-steps.html#next-steps)
* [Celery guide](https://docs.celeryq.dev/en/stable/userguide/index.html#guide)
* [SOAP Service Mocking Overview](https://www.soapui.org/docs/soap-mocking/service-mocking-overview/)
## @Todo : try to replace the current soap mock server by wiremock
* https://stackoverflow.com/questions/35974249/using-wiremock-with-soap-web-services-in-java
* https://wiremock.readthedocs.io/en/latest/index.html
* https://dev.to/adevintaspain/testing-with-wiremock-docker-2gh9
* https://wiremock.org/docs/request-matching/
* https://www.taheramlaki.com/blog/articles/wiremock-stubbing-and-response-templating/