# Shopcloud-EventBus
Async Processing, write to Log an Event and send it to a Queue
```mermaid
graph TD;
AppEngine-->Log;
Log-->EventBus;
EventBus-->AppEngine;
```
## Usage
````sh
$ pip install shopcloud-eventbus
````
```sh
$ eventbus init
$ eventbus deploy
```
__Vanilla:__
````py
from shopcloud_eventbus import Event
event = Event(
name="de.talk-point.platform/module/model/sync",
model=self,
)
event.add_task(
queue="default",
url=f"module/api/model/{self.id}/action/",
json={}
)
event.fire()
````
__Django__
use for example the [shopcloud-django-toolbox](https://pypi.org/project/shopcloud-django-toolbox/) library
```py
from shopcloud_django_toolbox import Event
event = Event(
name="de.talk-point.platform/module/model/sync",
model=self,
)
event.add_task(
queue="default",
url=f"module/api/model/{self.id}/action/",
json={}
)
event.fire()
```
## Install
### Services
```
$ gcloud services enable cloudtasks.googleapis.com --project="test-eventbus-project"
$ gcloud pubsub topics create events --project='test-eventbus-project'
$ gcloud tasks queues create default --project='test-eventbus-project' --location='europe-west3'
```
### Log Sink
Create a [log sink](https://console.cloud.google.com/logs/router/sink) with the following filter `resource.type="gae_app" "event-fire"`
```sh
$ eventbus --help
$ eventbus deploy
```
## Development
```sh
$ python3 setup.py install
$ python3 -m shopcloud_eventbus -d init --project="test-eventbus-project" --region="europe-west3" --app-endpoint="https://test-eventbus-project.ey.r.appspot.com" --secrethub-endpoint-user="talk-point/app-eventbus-test/production/evenbus-user" --secrethub-endpoint-pwd="talk-point/app-eventbus-test/production/evenbus-pwd"
$ python3 -m shopcloud_eventbus -d deploy
```
dann kann das Script getestet werden per
```sh
$ cd .eventbus
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ functions-framework --target main_http --debug
```
oder deployen und eine Test-Message durchsenden
```sh
```
### Deploy
```sh
$ rm -rf build dist
$ pip3 install wheel twine
$ python3 setup.py sdist bdist_wheel
$ twine upload dist/*
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Talk-Point/shopcloud-eventbus",
"name": "shopcloud-eventbus",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "CLI",
"author": "Konstantin Stoldt",
"author_email": "konstantin.stoldt@talk-point.de",
"download_url": "https://files.pythonhosted.org/packages/ff/15/8c07f8e8b6725ff6f43fc3ed14e7a6d151fd54302d32d31cf6204f058d4f/shopcloud_eventbus-1.4.0.tar.gz",
"platform": null,
"description": "# Shopcloud-EventBus\n\nAsync Processing, write to Log an Event and send it to a Queue\n\n```mermaid\ngraph TD;\n AppEngine-->Log;\n Log-->EventBus;\n EventBus-->AppEngine;\n```\n\n## Usage\n\n````sh\n$ pip install shopcloud-eventbus\n````\n\n```sh\n$ eventbus init\n$ eventbus deploy\n```\n\n__Vanilla:__\n\n````py\nfrom shopcloud_eventbus import Event\n\nevent = Event(\n name=\"de.talk-point.platform/module/model/sync\",\n model=self,\n)\nevent.add_task(\n queue=\"default\",\n url=f\"module/api/model/{self.id}/action/\",\n json={}\n)\nevent.fire()\n````\n\n__Django__\n\nuse for example the [shopcloud-django-toolbox](https://pypi.org/project/shopcloud-django-toolbox/) library\n\n```py\nfrom shopcloud_django_toolbox import Event\n\nevent = Event(\n name=\"de.talk-point.platform/module/model/sync\",\n model=self,\n)\nevent.add_task(\n queue=\"default\",\n url=f\"module/api/model/{self.id}/action/\",\n json={}\n)\nevent.fire()\n```\n\n## Install\n\n### Services\n\n```\n$ gcloud services enable cloudtasks.googleapis.com --project=\"test-eventbus-project\"\n$ gcloud pubsub topics create events --project='test-eventbus-project'\n$ gcloud tasks queues create default --project='test-eventbus-project' --location='europe-west3'\n```\n\n### Log Sink\n\nCreate a [log sink](https://console.cloud.google.com/logs/router/sink) with the following filter `resource.type=\"gae_app\" \"event-fire\"`\n\n```sh\n$ eventbus --help\n$ eventbus deploy\n```\n\n## Development\n\n```sh\n$ python3 setup.py install\n$ python3 -m shopcloud_eventbus -d init --project=\"test-eventbus-project\" --region=\"europe-west3\" --app-endpoint=\"https://test-eventbus-project.ey.r.appspot.com\" --secrethub-endpoint-user=\"talk-point/app-eventbus-test/production/evenbus-user\" --secrethub-endpoint-pwd=\"talk-point/app-eventbus-test/production/evenbus-pwd\"\n$ python3 -m shopcloud_eventbus -d deploy\n```\n\ndann kann das Script getestet werden per\n\n```sh\n$ cd .eventbus\n$ python3 -m venv venv\n$ source venv/bin/activate\n$ pip install -r requirements.txt\n$ functions-framework --target main_http --debug\n```\n\noder deployen und eine Test-Message durchsenden\n\n```sh\n\n```\n\n### Deploy\n\n```sh\n$ rm -rf build dist\n$ pip3 install wheel twine\n$ python3 setup.py sdist bdist_wheel\n$ twine upload dist/*\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI tool for the Shopcloud EventBus",
"version": "1.4.0",
"project_urls": {
"Homepage": "https://github.com/Talk-Point/shopcloud-eventbus"
},
"split_keywords": [
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cdfaa79cee1d4f1c31e47d3f70722bab8852faaa8ea8707cfe548569d3bb58ba",
"md5": "780bbf8536901f515cc0150f3c64f1ab",
"sha256": "a5b87473478a4751d0069bc46dd549cb22ba9fe4df4a1f382c86d04ba23e8732"
},
"downloads": -1,
"filename": "shopcloud_eventbus-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "780bbf8536901f515cc0150f3c64f1ab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10237,
"upload_time": "2023-12-03T08:27:24",
"upload_time_iso_8601": "2023-12-03T08:27:24.372765Z",
"url": "https://files.pythonhosted.org/packages/cd/fa/a79cee1d4f1c31e47d3f70722bab8852faaa8ea8707cfe548569d3bb58ba/shopcloud_eventbus-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ff158c07f8e8b6725ff6f43fc3ed14e7a6d151fd54302d32d31cf6204f058d4f",
"md5": "50ebc9024367ab7e68728241e98f24d9",
"sha256": "fe6fcc8f003a790bdc04b479939e43c86b38cda808e31734b34810cbb9e56903"
},
"downloads": -1,
"filename": "shopcloud_eventbus-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "50ebc9024367ab7e68728241e98f24d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9088,
"upload_time": "2023-12-03T08:27:26",
"upload_time_iso_8601": "2023-12-03T08:27:26.093772Z",
"url": "https://files.pythonhosted.org/packages/ff/15/8c07f8e8b6725ff6f43fc3ed14e7a6d151fd54302d32d31cf6204f058d4f/shopcloud_eventbus-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-03 08:27:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Talk-Point",
"github_project": "shopcloud-eventbus",
"github_not_found": true,
"lcname": "shopcloud-eventbus"
}