Giter Club home page Giter Club logo

exp-1_ddd's Introduction

Experiment the first

contrary to popular believe DDD is not DomainDrivenDesign. . . at least not in this case, it is this: D/D/D

the way this goes is

  • CardDispenser -> sends card info to YuGiOh-Card-Queue rabbitMQ bus thru the default exchange,
  • CardProcessor <- Read the card data from YuGiOh-Card-Queue
  • CardProcessor -- process the card
  • CardProcessor -> Sends the processed cards to YuGiOh-Processed-Queue
  • Card_Saver <- Reads from YuGiOh-Processed-Queue
  • Card_Saver -- saves the cards into postgres db

you have yugioh cards in a file which u got from: YgoProDeck ; get the cards like this and don't annoy their api

http GET https://db.ygoprodeck.com/api/v7/cardinfo.php > AllCards.json

if u don't have httpie install it via python,scoop or package manager


i was sick and bored so my tired brain came up with this, it serves no practical purpose, think of it as an experiment

card info gotten from Ygoprodeck.com, i got all the cards as to not annoy their API


Run

  1. get RabbitMQ started:
docker run --hostname YuGiOh-rabbit  --name yugioh-bus -p 5672:5672 -p 15672:15672 rabbitmq:3-management

5672: to access the node 15672: to access the web interface

  1. start pubing the cards
cd cardDispenser
python -m venv venv
.\venv\Scripts\activate # source venv/bin/activate
pip install -r reqs.txt

uvicorn main:app --reload -p 4444 # or whatever u want
  1. run the c# code

  2. save the cards from the queueueueue to the database a. i. start a postgress instance docker container run -p 5432:5432 --name testgres postgres i. make sure it's correctly sat up either by dbeaver or thru the terminal i. docker exec -it <container name (docker ps helps)> psql -U admin b. cd into card_saver -> cargo build -> cargo run

Starring

  1. FastAPI as pythonAPI that will keep pumping RAW card info as JSON into rabbitMQ queueName=YuGiOh-Card-Queue, it has 2 endpoints:
    1. Start. /start. ; will start populating the que
    2. Stop. /stop; will cease hostilites and declare peace. . . .

the way the inital plan was for the API to get either a start or stop commands via REST and ivoke an event depending, at least that was the main idea, toggle switching, but as the data we have is finite, i didnt want duplication hence the way i did it.

  1. RabbitMQ as the bus that will distribute the info between the apps

  2. C# 7 as the cards proccessor, it takes the card from pyPi and removes some props and throws it again at the space rabbit this time onto a different queue queueName=YuGiOh-Processed-Queue

  3. rust as the database manager

  4. postgress as the DB

  5. Docker as the rich guy that provided the places to act

I would love to thank:

  • Panadol for making me see ghosts
  • lemon and honey
  • windows for not crashing randomly
  • git for saving me from windows

the loop is pointless as this should just run once and only once, if this was supposed to listen infinitly it should invoke events or something anyways i'm having fun used raw sql cause it's healthier than an ORM (you don't know what they put in there)

Resources

  1. turn Json to language
  2. RabbitMq c# docs
  3. RabbitMq python docs
  4. python events package
  5. this to read queue size
  6. microsoft json docs
  7. rust by example
  8. postgres docs

exp-1_ddd's People

Contributors

canaangm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.