Skip to content

Call a soap api asynchronous service with celery and a message broker

Notifications You must be signed in to change notification settings

sfinx13/poc-celery-message-broker

Repository files navigation

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

Screen

Documentation

@Todo : try to replace the current soap mock server by wiremock

About

Call a soap api asynchronous service with celery and a message broker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published